dont reset list position while setting private lists public

This commit is contained in:
j 2011-11-10 23:12:20 +00:00
parent 2d7d0414f9
commit dac0738047
3 changed files with 16 additions and 14 deletions

View file

@ -16,6 +16,7 @@
// "canClickMap": {"friend": true, "staff": true, "admin": true}, // "canClickMap": {"friend": true, "staff": true, "admin": true},
"canDeleteItems": {"admin": true}, "canDeleteItems": {"admin": true},
"canDownloadVideo": {"guest": 0, "member": 0, "friend": 4, "staff": 4, "admin": 4}, "canDownloadVideo": {"guest": 0, "member": 0, "friend": 4, "staff": 4, "admin": 4},
"canEditFeaturedLists": {"staff": true, "admin": true},
"canEditMetadata": {"staff": true, "admin": true}, "canEditMetadata": {"staff": true, "admin": true},
"canEditSitePages": {"staff": true, "admin": true}, "canEditSitePages": {"staff": true, "admin": true},
"canEditUsers": {"admin": true}, "canEditUsers": {"admin": true},

View file

@ -233,8 +233,8 @@ def addList(request):
value = data['status'] value = data['status']
if value not in list._status: if value not in list._status:
value = list._status[0] value = list._status[0]
if not request.user.is_staff and value == 'featured': if value == 'featured' and request.user.get_profile().capability('canEditFeaturedLists'):
value = 'private' value = list.status
list.status = value list.status = value
if 'description' in data: if 'description' in data:
list.description = data['description'] list.description = data['description']
@ -329,7 +329,7 @@ def editList(request):
pos.position = qs.aggregate(Max('position'))['position__max'] + 1 pos.position = qs.aggregate(Max('position'))['position__max'] + 1
pos.save() pos.save()
models.Position.objects.filter(list=list).exclude(id=pos.id).delete() models.Position.objects.filter(list=list).exclude(id=pos.id).delete()
else: elif list.status == 'featured' and value == 'public':
models.Position.objects.filter(list=list).delete() models.Position.objects.filter(list=list).delete()
pos, created = models.Position.objects.get_or_create(list=list, pos, created = models.Position.objects.get_or_create(list=list,
user=list.user,section='personal') user=list.user,section='personal')

View file

@ -1,6 +1,7 @@
// 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.getPositionById(pandora.site.sectionFolders[pandora.user.ui.section], id), var i = Ox.getPositionById(pandora.site.sectionFolders[pandora.user.ui.section], id),
that; that;
if (pandora.user.ui.section == 'items') { if (pandora.user.ui.section == 'items') {