From 27f5745d16d492887676aa646d9ded530750ed02 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Thu, 28 Feb 2013 13:10:16 +0000 Subject: [PATCH] edit rightslevel in text general dialog --- pandora/text/models.py | 1 + static/js/pandora/folderList.js | 2 +- static/js/pandora/listDialog.js | 28 +++++++++++++++------------- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/pandora/text/models.py b/pandora/text/models.py index 23c242982..2d758ae77 100644 --- a/pandora/text/models.py +++ b/pandora/text/models.py @@ -156,6 +156,7 @@ class Text(models.Model): keys=[ 'description', 'editable', + 'rightslevel', 'id', 'links', 'name', diff --git a/static/js/pandora/folderList.js b/static/js/pandora/folderList.js index cc20919a0..819611f49 100644 --- a/static/js/pandora/folderList.js +++ b/static/js/pandora/folderList.js @@ -244,7 +244,7 @@ pandora.ui.folderList = function(id) { that = Ox.TableList({ columns: columns, items: items, - keys: ui.section == 'items' ? ['query'] : [], + keys: ui.section == 'items' ? ['query'] : ['rightslevel'], max: 1, min: 0, pageLength: 1000, diff --git a/static/js/pandora/listDialog.js b/static/js/pandora/listDialog.js index 620b1aec8..243d565e2 100644 --- a/static/js/pandora/listDialog.js +++ b/static/js/pandora/listDialog.js @@ -174,18 +174,21 @@ pandora.ui.listGeneralPanel = function(listData) { .css({position: 'absolute', left: '160px', top: '40px'}) .appendTo(that) : Ox.Select({ - items: [ - {id: 'html', title: 'HMTL'}, - {id: 'pdf', title: 'PDF'} - ], - label: 'Type', - labelWidth: 80, - value: listData.type, + items: pandora.site.textRightsLevels.map(function(rightsLevel, i) { + console.log(listData); + return { + id: i, + title: rightsLevel.name, + }; + }), + label: 'Rights Level', + labelWidth: 90, + value: listData.rightslevel, width: 320 }) .css({position: 'absolute', left: '160px', top: '40px'}) .bindEvent({ - change: editType + change: editRightsLevel }) .appendTo(that), $statusSelect = listData.status == 'featured' @@ -286,16 +289,15 @@ pandora.ui.listGeneralPanel = function(listData) { ); }); } - function editType(data) { - var type = data.value; - $itemsInput.value(type == 'html' ? 'html' : 'pdf'); + function editRightsLevel(data) { + var rightslevel = data.value; pandora.api.editText({ id: listData.id, - type: type + rightslevel: rightslevel }, function(result) { Ox.Request.clearCache('getText'); //fixme: reload text and folder list - $itemsInput.value(result.data.type); + $itemsInput.value(result.data.rightslevel); }); } function getDescriptionHeight() {