forked from 0x2620/pandora
merge
This commit is contained in:
commit
f6bcda564a
3 changed files with 21 additions and 12 deletions
|
@ -1,8 +1,8 @@
|
||||||
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
||||||
'use strict';
|
'use strict';
|
||||||
pandora.ui.folderList = function(id) {
|
pandora.ui.folderList = function(id) {
|
||||||
// FIXME: use canEditFeaturedLists capability, not 'admin'
|
|
||||||
var i = Ox.getIndexById(pandora.site.sectionFolders[pandora.user.ui.section], id),
|
var i = Ox.getIndexById(pandora.site.sectionFolders[pandora.user.ui.section], id),
|
||||||
|
canEditFeaturedLists = pandora.site.capabilities.canEditFeaturedLists[pandora.user.level],
|
||||||
that;
|
that;
|
||||||
if (pandora.user.ui.section == 'items') {
|
if (pandora.user.ui.section == 'items') {
|
||||||
var columns, items;
|
var columns, items;
|
||||||
|
@ -10,7 +10,7 @@ pandora.ui.folderList = function(id) {
|
||||||
columns = [
|
columns = [
|
||||||
{
|
{
|
||||||
clickable: function(data) {
|
clickable: function(data) {
|
||||||
return data.user == pandora.user.username;
|
return data.user == pandora.user.username || (id == 'featured' && canEditFeaturedLists);
|
||||||
},
|
},
|
||||||
format: function(value, data) {
|
format: function(value, data) {
|
||||||
return $('<img>').attr({
|
return $('<img>').attr({
|
||||||
|
@ -25,7 +25,10 @@ pandora.ui.folderList = function(id) {
|
||||||
id: 'user',
|
id: 'user',
|
||||||
operator: '+',
|
operator: '+',
|
||||||
tooltip: function(data) {
|
tooltip: function(data) {
|
||||||
return data.user == pandora.user.username ? 'Edit Icon' : '';
|
return data.user == pandora.user.username
|
||||||
|
|| (id == 'featured' && canEditFeaturedLists)
|
||||||
|
? 'Edit Icon'
|
||||||
|
: '';
|
||||||
},
|
},
|
||||||
visible: true,
|
visible: true,
|
||||||
width: 16
|
width: 16
|
||||||
|
@ -104,7 +107,7 @@ pandora.ui.folderList = function(id) {
|
||||||
height: '10px',
|
height: '10px',
|
||||||
padding: '3px',
|
padding: '3px',
|
||||||
opacity: value == 'private' ? 0.25 : 1
|
opacity: value == 'private' ? 0.25 : 1
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
id: 'status',
|
id: 'status',
|
||||||
operator: '+',
|
operator: '+',
|
||||||
|
@ -240,7 +243,7 @@ pandora.ui.folderList = function(id) {
|
||||||
pageLength: 1000,
|
pageLength: 1000,
|
||||||
//selected: pandora.getListData().folder == id ? [pandora.user.ui._list] : [],
|
//selected: pandora.getListData().folder == id ? [pandora.user.ui._list] : [],
|
||||||
sort: [{key: 'position', operator: '+'}],
|
sort: [{key: 'position', operator: '+'}],
|
||||||
sortable: id != 'featured' || pandora.user.level == 'admin'
|
sortable: id != 'featured' || canEditFeaturedLists
|
||||||
})
|
})
|
||||||
.css({
|
.css({
|
||||||
left: 0,
|
left: 0,
|
||||||
|
@ -276,7 +279,7 @@ pandora.ui.folderList = function(id) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if (id == 'favorite' || (id == 'featured' && pandora.user.level == 'admin')) {
|
} else if (id == 'favorite' || (id == 'featured' && canEditFeaturedLists)) {
|
||||||
// this makes the button trigger a change event,
|
// this makes the button trigger a change event,
|
||||||
// which is already being handled in folders.js
|
// which is already being handled in folders.js
|
||||||
pandora.$ui.manageListsButton[id].options({value: true});
|
pandora.$ui.manageListsButton[id].options({value: true});
|
||||||
|
@ -321,7 +324,7 @@ pandora.ui.folderList = function(id) {
|
||||||
Ox.Request.clearCache(); // fixme: remove
|
Ox.Request.clearCache(); // fixme: remove
|
||||||
that.reloadList();
|
that.reloadList();
|
||||||
});
|
});
|
||||||
} else if (id == 'featured' && pandora.user.level == 'admin') {
|
} else if (id == 'featured' && canEditFeaturedLists) {
|
||||||
that.options({selected: []});
|
that.options({selected: []});
|
||||||
pandora.api.editList({
|
pandora.api.editList({
|
||||||
id: data.ids[0],
|
id: data.ids[0],
|
||||||
|
|
|
@ -137,7 +137,8 @@ pandora.ui.info = function() {
|
||||||
pandora.ui.listInfo = function() {
|
pandora.ui.listInfo = function() {
|
||||||
|
|
||||||
var list = pandora.user.ui._list,
|
var list = pandora.user.ui._list,
|
||||||
editable = list.split(':')[0] == pandora.user.username,
|
canEditFeaturedLists = pandora.site.capabilities.canEditFeaturedLists[pandora.user.level],
|
||||||
|
editable = list.split(':')[0] == pandora.user.username || canEditFeaturedLists,
|
||||||
that = $('<div>').css({padding: '16px', textAlign: 'center'}),
|
that = $('<div>').css({padding: '16px', textAlign: 'center'}),
|
||||||
$icon = Ox.Element({
|
$icon = Ox.Element({
|
||||||
element: '<img>',
|
element: '<img>',
|
||||||
|
@ -164,16 +165,17 @@ pandora.ui.listInfo = function() {
|
||||||
if (list) {
|
if (list) {
|
||||||
pandora.api.findLists({
|
pandora.api.findLists({
|
||||||
query: {conditions: [{key: 'id', value: list, operator: '=='}]},
|
query: {conditions: [{key: 'id', value: list, operator: '=='}]},
|
||||||
keys: ['description', 'name', 'user']
|
keys: ['description', 'status', 'name', 'user']
|
||||||
}, function(result) {
|
}, function(result) {
|
||||||
if (result.data.items.length) {
|
if (result.data.items.length) {
|
||||||
var item = result.data.items[0],
|
var item = result.data.items[0],
|
||||||
editable = item.user == pandora.user.username;
|
editable = item.user == pandora.user.username
|
||||||
|
|| (item.status == 'featured' && canEditFeaturedLists);
|
||||||
that.append(
|
that.append(
|
||||||
$title = Ox.Editable({
|
$title = Ox.Editable({
|
||||||
editable: editable,
|
editable: editable,
|
||||||
format: function(value) {
|
format: function(value) {
|
||||||
return Ox.encodeHTML(item.user + ': ' + value)
|
return Ox.encodeHTML(editable ? value : item.user + ': ' + value)
|
||||||
},
|
},
|
||||||
tooltip: editable ? 'Doubleclick to edit title' : '',
|
tooltip: editable ? 'Doubleclick to edit title' : '',
|
||||||
value: item.name,
|
value: item.name,
|
||||||
|
|
|
@ -134,7 +134,11 @@ pandora.ui.logsDialog = function() {
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
closeButton: true,
|
closeButton: true,
|
||||||
content: $('<code>').append($('<pre>').css({margin: '16px'}).html(value.text)),
|
content: $('<code>').append($('<pre>').css({
|
||||||
|
margin: '16px',
|
||||||
|
MozUserSelect: 'text',
|
||||||
|
WebkitUserSelect: 'text'
|
||||||
|
}).html(value.text)),
|
||||||
height: height - 48,
|
height: height - 48,
|
||||||
keys: {enter: 'close', escape: 'close'},
|
keys: {enter: 'close', escape: 'close'},
|
||||||
maximizeButton: true,
|
maximizeButton: true,
|
||||||
|
|
Loading…
Reference in a new issue