forked from 0x2620/pandora
replace edits view with text
This commit is contained in:
parent
9c967c7ac4
commit
274a8ffcca
1 changed files with 29 additions and 32 deletions
|
@ -359,38 +359,35 @@ pandora.ui.editPanel = function(isEmbed) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderEdits() {
|
function renderEdits() {
|
||||||
that = Ox.IconList({
|
that.css({
|
||||||
borderRadius: 16,
|
'overflow-y': 'auto'
|
||||||
defaultRatio: 1,
|
});
|
||||||
draggable: true,
|
var $content = Ox.Element()
|
||||||
item: function(data, sort, size) {
|
.css({padding: '16px'})
|
||||||
size = size || 128;
|
.appendTo(that),
|
||||||
var ui = pandora.user.ui,
|
isEditable = pandora.site.capabilities.canEditSitePages[pandora.user.level];
|
||||||
url = pandora.getMediaURL('/edit/' + data.id + '/icon' + size + '.jpg?' + data.modified),
|
pandora.api.getPage({name: 'edits'}, function(result) {
|
||||||
info = Ox.formatDuration(data.duration);
|
Ox.EditableContent({
|
||||||
return {
|
clickLink: pandora.clickLink,
|
||||||
height: size,
|
editable: isEditable,
|
||||||
id: data.id,
|
tooltip: isEditable ? pandora.getEditTooltip() : '',
|
||||||
title: data.name,
|
type: 'textarea',
|
||||||
info: info,
|
placeholder: isEditable ? Ox._('Doubleclick to insert text') : '',
|
||||||
url: url,
|
value: result.data.text
|
||||||
width: size,
|
})
|
||||||
};
|
.css({
|
||||||
},
|
width: '100%'
|
||||||
items: function(data, callback) {
|
|
||||||
pandora.api.findEdits(data, callback);
|
|
||||||
return Ox.clone(data, true);
|
|
||||||
},
|
|
||||||
keys: ['id', 'modified', 'name', 'duration'],
|
|
||||||
size: 128,
|
|
||||||
sort: [{key: 'id', operator: '+'}],
|
|
||||||
unique: 'id'
|
|
||||||
})
|
})
|
||||||
.addClass('OxMedia')
|
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
open: function(data) {
|
submit: function(data) {
|
||||||
pandora.UI.set('edit', data.ids[0]);
|
Ox.Request.clearCache('getPage');
|
||||||
|
pandora.api.editPage({
|
||||||
|
name: 'edits',
|
||||||
|
text: data.value
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.appendTo($content);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue