edit rightslevel in text general dialog

This commit is contained in:
j 2013-02-28 13:10:16 +00:00
parent 4d0af754c3
commit 27f5745d16
3 changed files with 17 additions and 14 deletions

View file

@ -156,6 +156,7 @@ class Text(models.Model):
keys=[ keys=[
'description', 'description',
'editable', 'editable',
'rightslevel',
'id', 'id',
'links', 'links',
'name', 'name',

View file

@ -244,7 +244,7 @@ pandora.ui.folderList = function(id) {
that = Ox.TableList({ that = Ox.TableList({
columns: columns, columns: columns,
items: items, items: items,
keys: ui.section == 'items' ? ['query'] : [], keys: ui.section == 'items' ? ['query'] : ['rightslevel'],
max: 1, max: 1,
min: 0, min: 0,
pageLength: 1000, pageLength: 1000,

View file

@ -174,18 +174,21 @@ pandora.ui.listGeneralPanel = function(listData) {
.css({position: 'absolute', left: '160px', top: '40px'}) .css({position: 'absolute', left: '160px', top: '40px'})
.appendTo(that) .appendTo(that)
: Ox.Select({ : Ox.Select({
items: [ items: pandora.site.textRightsLevels.map(function(rightsLevel, i) {
{id: 'html', title: 'HMTL'}, console.log(listData);
{id: 'pdf', title: 'PDF'} return {
], id: i,
label: 'Type', title: rightsLevel.name,
labelWidth: 80, };
value: listData.type, }),
label: 'Rights Level',
labelWidth: 90,
value: listData.rightslevel,
width: 320 width: 320
}) })
.css({position: 'absolute', left: '160px', top: '40px'}) .css({position: 'absolute', left: '160px', top: '40px'})
.bindEvent({ .bindEvent({
change: editType change: editRightsLevel
}) })
.appendTo(that), .appendTo(that),
$statusSelect = listData.status == 'featured' $statusSelect = listData.status == 'featured'
@ -286,16 +289,15 @@ pandora.ui.listGeneralPanel = function(listData) {
); );
}); });
} }
function editType(data) { function editRightsLevel(data) {
var type = data.value; var rightslevel = data.value;
$itemsInput.value(type == 'html' ? 'html' : 'pdf');
pandora.api.editText({ pandora.api.editText({
id: listData.id, id: listData.id,
type: type rightslevel: rightslevel
}, function(result) { }, function(result) {
Ox.Request.clearCache('getText'); Ox.Request.clearCache('getText');
//fixme: reload text and folder list //fixme: reload text and folder list
$itemsInput.value(result.data.type); $itemsInput.value(result.data.rightslevel);
}); });
} }
function getDescriptionHeight() { function getDescriptionHeight() {