add/remove items from list

This commit is contained in:
j 2011-06-04 18:19:06 +02:00
parent fe9d19c6ad
commit 15d0a14d59
3 changed files with 7 additions and 6 deletions

View file

@ -117,3 +117,4 @@ class Annotation(models.Model):
def __unicode__(self): def __unicode__(self):
return u"%s/%s-%s" %(self.item, self.start, self.end) return u"%s/%s-%s" %(self.item, self.start, self.end)

View file

@ -22,8 +22,8 @@ class List(models.Model):
modified = models.DateTimeField(auto_now=True) modified = models.DateTimeField(auto_now=True)
user = models.ForeignKey(User, related_name='lists') user = models.ForeignKey(User, related_name='lists')
name = models.CharField(max_length=255) name = models.CharField(max_length=255)
status = models.CharField(max_length=20, default='private') status = models.CharField(max_length=20, default='personal')
_status = ['private', 'public', 'featured'] _status = ['personal', 'public', 'featured']
query = DictField(default={"static": True}) query = DictField(default={"static": True})
type= models.CharField(max_length=255, default='static') type= models.CharField(max_length=255, default='static')
description = models.TextField(default='') description = models.TextField(default='')

View file

@ -193,10 +193,10 @@ pandora.ui.list = function(view) { // fixme: remove view argument
}); });
}, },
'delete': function(event, data) { 'delete': function(event, data) {
getListData().editable && pandora.api.removeListItems({ pandora.getListData().editable && pandora.api.removeListItems({
list: app.user.ui.list, list: app.user.ui.list,
items: data.ids items: data.ids
}, reloadList); }, pandora.reloadList);
}, },
init: function(event, data) { init: function(event, data) {
app.$ui.total.html(pandora.ui.status('total', data)); app.$ui.total.html(pandora.ui.status('total', data));
@ -317,10 +317,10 @@ pandora.ui.list = function(view) { // fixme: remove view argument
}); });
}, },
paste: function(event, data) { paste: function(event, data) {
data.items && getListData().editable && pandora.api.addListItems({ data.items && pandora.getListData().editable && pandora.api.addListItems({
list: app.user.ui.list, list: app.user.ui.list,
items: data.items items: data.items
}, reloadList); }, pandora.reloadList);
}, },
select: function(event, data) { select: function(event, data) {
var $still, $timeline; var $still, $timeline;