diff --git a/pandora/edit/models.py b/pandora/edit/models.py
index f14c0d86..343b3d22 100644
--- a/pandora/edit/models.py
+++ b/pandora/edit/models.py
@@ -350,7 +350,6 @@ class Edit(models.Model):
'description',
'duration',
'editable',
- 'editable',
'groups',
'id',
'items',
diff --git a/static/js/folderList.js b/static/js/folderList.js
index 342f7e61..85e5cad8 100644
--- a/static/js/folderList.js
+++ b/static/js/folderList.js
@@ -15,7 +15,7 @@ pandora.ui.folderList = function(id, section) {
columns = [
{
clickable: function(data) {
- return data.user == pandora.user.username
+ return data.editable
|| (id == 'featured' && canEditFeatured);
},
format: function(value, data) {
@@ -31,7 +31,7 @@ pandora.ui.folderList = function(id, section) {
id: 'user',
operator: '+',
tooltip: function(data) {
- return data.user == pandora.user.username
+ return data.editable
|| (id == 'featured' && canEditFeatured)
? Ox._('Edit Icon')
: '';
@@ -52,7 +52,7 @@ pandora.ui.folderList = function(id, section) {
},
{
editable: function(data) {
- return data.user == pandora.user.username;
+ return data.editable;
},
format: function(value) {
return Ox.encodeHTMLEntities(value);
@@ -81,7 +81,7 @@ pandora.ui.folderList = function(id, section) {
{
clickable: function(data) {
return section != 'texts' && (
- data.type == 'smart' || data.user == pandora.user.username
+ data.type == 'smart' || data.editable
);
},
format: function(value, data) {
@@ -98,16 +98,16 @@ pandora.ui.folderList = function(id, section) {
width: '10px',
height: '10px',
padding: '3px',
- opacity: section == 'texts' || data.user == pandora.user.username ? 1 : 0.25
+ opacity: section == 'texts' || data.editable ? 1 : 0.25
});
},
id: 'type',
operator: '+',
tooltip: function(data) {
return data.type == 'static'
- ? (data.user == pandora.user.username ? Ox._('Edit {0}', [Ox._(folderItem)]) : '')
+ ? (data.editable ? Ox._('Edit {0}', [Ox._(folderItem)]) : '')
: data.type == 'smart'
- ? (data.user == pandora.user.username ? Ox._('Edit Query') : Ox._('Show Query'))
+ ? (data.editable ? Ox._('Edit Query') : Ox._('Show Query'))
: data.type.toUpperCase();
},
visible: true,
@@ -264,7 +264,7 @@ pandora.ui.folderList = function(id, section) {
columns: columns,
droppable: id != 'volumes',
items: items,
- keys: ['modified'].concat(section != 'texts'
+ keys: ['modified', 'editable', 'groups'].concat(section != 'texts'
? ['query', 'name', 'view'] : ['rightslevel']),
max: 1,
min: 0,
diff --git a/static/js/groupsDialog.js b/static/js/groupsDialog.js
index 15064887..6065a519 100644
--- a/static/js/groupsDialog.js
+++ b/static/js/groupsDialog.js
@@ -36,13 +36,18 @@ pandora.ui.groupsDialog = function(options) {
groups,
selectedGroups;
- pandora.api[isItem ? 'get' : 'getUser']({
- id: options.id,
- keys: ['groups']
- }, function(result) {
- selectedGroups = result.data.groups;
+ if (options.groups) {
+ selectedGroups = options.groups;
renderGroups();
- });
+ } else {
+ pandora.api[isItem ? 'get' : 'getUser']({
+ id: options.id,
+ keys: ['groups']
+ }, function(result) {
+ selectedGroups = result.data.groups;
+ renderGroups();
+ });
+ }
function addGroup() {
// disableElements();
diff --git a/static/js/listDialog.js b/static/js/listDialog.js
index e9a9eb2c..0df4dfa1 100644
--- a/static/js/listDialog.js
+++ b/static/js/listDialog.js
@@ -266,6 +266,67 @@ pandora.ui.listGeneralPanel = function(listData) {
)
.css({position: 'absolute', left: '160px', top: '64px'})
.appendTo(that),
+ $groupsInput = Ox.Input({
+ disabled: false,
+ label: Ox._('Groups'),
+ labelWidth: 80,
+ value: listData.groups.join(', '),
+ width: 320
+ })
+ .bindEvent({
+ change: editGroups
+ })
+ .css({position: 'absolute', left: '160px', top: '88px'})
+ .appendTo(that),
+ /*
+ $groupsLabel,
+ $groupsInput = Ox.FormElementGroup({
+ elements: [
+ Ox.Label({
+ overlap: 'right',
+ textAlign: 'right',
+ title: Ox._('Groups'),
+ width: 80
+ }),
+ Ox.FormElementGroup({
+ elements: [
+ $groupsLabel = Ox.Label({
+ title: listData.groups ? listData.groups.join(', ') : '',
+ width: 224
+ }),
+ Ox.Button({
+ overlap: 'left',
+ title: 'edit',
+ tooltip: Ox._('Edit Groups'),
+ type: 'image'
+ })
+ .bindEvent({
+ click: function() {
+ console.log(listData)
+ pandora.$ui.groupsDialog = pandora.ui.groupsDialog({
+ id: listData.id,
+ name: listData.id,
+ groups: listData.groups,
+ type: 'list'
+ })
+ .bindEvent({
+ groups: function(data) {
+ var groups = data.groups.join(', ');
+ //fixme edit groups
+ $groupsLabel.options({title: groups});
+ }
+ })
+ .open();
+ }
+ })
+ ],
+ float: 'right'
+ })
+ ],
+ float: 'left'
+ }).css({position: 'absolute', left: '160px', top: '88px'})
+ .appendTo(that),
+ */
$subscribersInput = Ox.Input({
disabled: true,
label: Ox._('Subscribers'),
@@ -273,7 +334,7 @@ pandora.ui.listGeneralPanel = function(listData) {
value: subscribers,
width: 320
})
- .css({position: 'absolute', left: '160px', top: '88px'})
+ .css({position: 'absolute', left: '160px', top: '112px'})
[getSubscribersAction()]()
.appendTo(that),
$descriptionInput = Ox.Input({
@@ -321,6 +382,19 @@ pandora.ui.listGeneralPanel = function(listData) {
});
}
}
+ function editGroups(data) {
+ var groups = data.value.split(', ');
+ console.log(groups);
+ pandora.api['edit' + folderItem]({
+ id: listData.id,
+ groups: groups
+ }, function(result) {
+ listData.groups = result.data.groups;
+ pandora.$ui.folderList[listData.folder].value(
+ result.data.id, 'groups', listData.groups
+ );
+ });
+ }
function editStatus(data) {
var status = data.value;
$statusSelect.value(status == 'private' ? 'public' : 'private');
@@ -368,10 +442,10 @@ pandora.ui.listGeneralPanel = function(listData) {
});
}
function getDescriptionHeight() {
- return listData.status == 'private' ? 184 : 160;
+ return (listData.status == 'private' ? 184 : 160) - 24;
}
function getDescriptionTop() {
- return listData.status == 'private' ? 88 : 112;
+ return (listData.status == 'private' ? 88 : 112) + 24;
}
function getSubscribersAction() {
return listData.status == 'private' ? 'hide' : 'show';
diff --git a/static/js/utils.js b/static/js/utils.js
index 66ef9f76..206e97f5 100644
--- a/static/js/utils.js
+++ b/static/js/utils.js
@@ -714,7 +714,7 @@ pandora.enableDragAndDrop = function($list, canMove, section, getItems) {
data = $list.value(id);
if (drag.targets) {
drag.targets[id] = Ox.extend({
- editable: data.user == pandora.user.username
+ editable: data.editable
&& data.type == 'static',
selected: $item.is('.OxSelected')
}, data);
@@ -828,8 +828,10 @@ pandora.enableDragAndDrop = function($list, canMove, section, getItems) {
operator: '&'
}
}, function(result) {
- var folder = drag.target.status != 'featured'
- ? 'personal' : 'featured';
+ var folder = drag.target.status == 'featured' ? 'featured' : (
+ drag.target.user == pandora.user.username
+ ? 'personal' : 'favorite'
+ );
pandora.$ui.folderList[folder].value(
drag.target.id, 'items', result.data.items
);
@@ -938,7 +940,7 @@ pandora.enableDragAndDrop = function($list, canMove, section, getItems) {
);
} else if (
drag.action == 'move'
- && drag.source.user != pandora.user.username
+ && !drag.source.editable
) {
image = 'symbolClose';
text = Ox._(
@@ -951,7 +953,7 @@ pandora.enableDragAndDrop = function($list, canMove, section, getItems) {
'You can\'t remove {0}
from smart {1}.',
[itemName.plural, targetName.plural]
);
- } else if (drag.target && drag.target.user != pandora.user.username) {
+ } else if (drag.target && !drag.target.editable) {
image = 'symbolClose';
text = Ox._(
'You can only {0} {1}
to your own {2}',
@@ -1726,9 +1728,10 @@ pandora.getListData = function(list) {
if (folder) {
data = pandora.$ui.folderList[folder].value(list);
if (pandora.user.ui.section == 'item') {
- data.editable = data.user == pandora.user.username && data.type == 'static';
+ data.editable = data.editable && data.type == 'static';
} else {
- data.editable = data.user == pandora.user.username;
+ data.editable = data.editable || data.user == pandora.user.username;
+
}
data.folder = folder;
}