forked from 0x2620/pandora
more minor fixes
This commit is contained in:
parent
bfc9f63034
commit
6b42efcc8b
2 changed files with 36 additions and 4 deletions
|
@ -288,6 +288,21 @@ def editList(request):
|
||||||
qs = models.Position.objects.filter(user=request.user, section='featured')
|
qs = models.Position.objects.filter(user=request.user, section='featured')
|
||||||
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()
|
||||||
|
else:
|
||||||
|
models.Position.objects.filter(list=list).delete()
|
||||||
|
pos, created = models.Position.objects.get_or_create(list=list, user=list.user,
|
||||||
|
section='my')
|
||||||
|
qs = models.Position.objects.filter(user=list.user, section='my')
|
||||||
|
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.save()
|
||||||
|
|
||||||
list.status = value
|
list.status = value
|
||||||
elif key == 'name':
|
elif key == 'name':
|
||||||
name = data['name'].strip()
|
name = data['name'].strip()
|
||||||
|
|
|
@ -35,6 +35,17 @@ var pandora = new Ox.App({
|
||||||
$.browser.safari && Ox.theme('modern');
|
$.browser.safari && Ox.theme('modern');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fixme: remove
|
||||||
|
app.uiDefaults = {
|
||||||
|
"list": {
|
||||||
|
"columns": ["id", "title", "director", "country", "year", "language", "runtime", "genre"],
|
||||||
|
"listView": "icons",
|
||||||
|
"selected": [],
|
||||||
|
"sort": [
|
||||||
|
{"key": "director", "operator": ""}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
// fixme: remove
|
// fixme: remove
|
||||||
app.user.ui.showSection = {
|
app.user.ui.showSection = {
|
||||||
"my": true,
|
"my": true,
|
||||||
|
@ -1653,7 +1664,7 @@ var pandora = new Ox.App({
|
||||||
{key: 'status', value: 'public', operator: '='}
|
{key: 'status', value: 'public', operator: '='}
|
||||||
], operator: '&'} : {conditions: [
|
], operator: '&'} : {conditions: [
|
||||||
{key: 'status', value: 'public', operator: '='},
|
{key: 'status', value: 'public', operator: '='},
|
||||||
{key: 'status', value: 'public', operator: '='}
|
{key: 'status', value: 'featured', operator: '='}
|
||||||
], operator: '|'};
|
], operator: '|'};
|
||||||
return pandora.api.findLists($.extend(data, {
|
return pandora.api.findLists($.extend(data, {
|
||||||
query: query
|
query: query
|
||||||
|
@ -2418,9 +2429,12 @@ var pandora = new Ox.App({
|
||||||
query = {conditions: [
|
query = {conditions: [
|
||||||
{key: 'user', value: app.user.username, operator: '='},
|
{key: 'user', value: app.user.username, operator: '='},
|
||||||
{key: 'status', value: 'featured', operator: '!'}
|
{key: 'status', value: 'featured', operator: '!'}
|
||||||
], operator: ''};
|
], operator: '&'};
|
||||||
} else if (id == 'public') {
|
} else if (id == 'public') {
|
||||||
query = {conditions: [{key: 'subscribed', value: true, operator: '='}], operator: ''};
|
query = {conditions: [
|
||||||
|
{key: 'subscribed', value: true, operator: '='},
|
||||||
|
{key: 'status', value: 'featured', operator: '!'},
|
||||||
|
], operator: '&'};
|
||||||
} else if (id == 'featured') {
|
} else if (id == 'featured') {
|
||||||
query = {conditions: [{key: 'status', value: 'featured', operator: '='}], operator: '&'};
|
query = {conditions: [{key: 'status', value: 'featured', operator: '='}], operator: '&'};
|
||||||
}
|
}
|
||||||
|
@ -2485,6 +2499,7 @@ var pandora = new Ox.App({
|
||||||
pandora.api.removeList({
|
pandora.api.removeList({
|
||||||
id: data.ids[0]
|
id: data.ids[0]
|
||||||
}, function(result) {
|
}, function(result) {
|
||||||
|
delete app.user.ui.lists[data.ids[0]]; // fixme: how to delete a ui preference?
|
||||||
Ox.Request.emptyCache(); // fixme: remove
|
Ox.Request.emptyCache(); // fixme: remove
|
||||||
$list.reloadList();
|
$list.reloadList();
|
||||||
});
|
});
|
||||||
|
@ -2586,7 +2601,8 @@ var pandora = new Ox.App({
|
||||||
})
|
})
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
click: function(event, data) {
|
click: function(event, data) {
|
||||||
var id;
|
var $list = app.$ui.sectionList[i],
|
||||||
|
id;
|
||||||
if (data.id == 'new' || data.id == 'newsmart') {
|
if (data.id == 'new' || data.id == 'newsmart') {
|
||||||
pandora.api.addList({
|
pandora.api.addList({
|
||||||
name: 'Untitled',
|
name: 'Untitled',
|
||||||
|
@ -2594,6 +2610,7 @@ var pandora = new Ox.App({
|
||||||
type: data.id == 'new' ? 'static' : 'smart'
|
type: data.id == 'new' ? 'static' : 'smart'
|
||||||
}, function(result) {
|
}, function(result) {
|
||||||
id = result.data.id;
|
id = result.data.id;
|
||||||
|
app.user.ui.lists[id] = app.uiDefaults.list;
|
||||||
URL.set('?find=list:' + id)
|
URL.set('?find=list:' + id)
|
||||||
Ox.Request.emptyCache(); // fixme: remove
|
Ox.Request.emptyCache(); // fixme: remove
|
||||||
$list.reloadList().bindEvent({load: load});
|
$list.reloadList().bindEvent({load: load});
|
||||||
|
|
Loading…
Reference in a new issue