dont reset list position while setting private lists public
This commit is contained in:
parent
2d7d0414f9
commit
dac0738047
3 changed files with 16 additions and 14 deletions
|
@ -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},
|
||||||
|
|
|
@ -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,20 +329,20 @@ 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')
|
||||||
qs = models.Position.objects.filter(user=list.user,
|
qs = models.Position.objects.filter(user=list.user,
|
||||||
section='personal')
|
section='personal')
|
||||||
|
pos.position = qs.aggregate(Max('position'))['position__max'] + 1
|
||||||
|
pos.save()
|
||||||
|
for u in list.subscribed_users.all():
|
||||||
|
pos, created = models.Position.objects.get_or_create(list=list, user=u,
|
||||||
|
section='public')
|
||||||
|
qs = models.Position.objects.filter(user=u, section='public')
|
||||||
pos.position = qs.aggregate(Max('position'))['position__max'] + 1
|
pos.position = qs.aggregate(Max('position'))['position__max'] + 1
|
||||||
pos.save()
|
pos.save()
|
||||||
for u in list.subscribed_users.all():
|
|
||||||
pos, created = models.Position.objects.get_or_create(list=list, user=u,
|
|
||||||
section='public')
|
|
||||||
qs = models.Position.objects.filter(user=u, section='public')
|
|
||||||
pos.position = qs.aggregate(Max('position'))['position__max'] + 1
|
|
||||||
pos.save()
|
|
||||||
|
|
||||||
list.status = value
|
list.status = value
|
||||||
elif key == 'name':
|
elif key == 'name':
|
||||||
|
|
|
@ -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') {
|
||||||
|
|
Loading…
Reference in a new issue