use item not itemId for moveMedia

This commit is contained in:
j 2013-05-27 13:28:35 +00:00
parent 85bb82f683
commit 14f58532a8
2 changed files with 7 additions and 7 deletions

View file

@ -340,17 +340,17 @@ def moveMedia(request):
change file / item link
takes {
ids: ids of files
itemId: new itemId
item: new itemId
}
returns {
}
'''
data = json.loads(request.POST['data'])
if Item.objects.filter(itemId=data['itemId']).count() == 1:
i = Item.objects.get(itemId=data['itemId'])
if Item.objects.filter(itemId=data['item']).count() == 1:
i = Item.objects.get(itemId=data['item'])
else:
data['itemId'] = data['itemId'].strip()
data['itemId'] = data['item'].pop().strip()
if len(data['itemId']) != 7:
del data['itemId']
if 'director' in data and isinstance(data['director'], basestring):
@ -377,7 +377,7 @@ def moveMedia(request):
c.save()
item.tasks.update_timeline.delay(itemId)
response = json_response(text='updated')
response['data']['itemId'] = i.itemId
response['data']['item'] = i.itemId
return render_to_json_response(response)
actions.register(moveMedia, cache=False)

View file

@ -475,7 +475,7 @@ pandora.ui.mediaView = function(options, self) {
function moveFiles(data) {
var data = {
ids: self.selected,
itemId: self.$idInput.value()
item: self.$idInput.value()
};
['title', 'director', 'year'].forEach(function(key) {
data[key] = self['$' + key + 'Input'].value();
@ -490,7 +490,7 @@ pandora.ui.mediaView = function(options, self) {
) {
Ox.Request.clearCache(); // fixme: remove
if (self.$switch.value()) {
pandora.UI.set({item: result.data.itemId});
pandora.UI.set({item: result.data.item});
pandora.updateItemContext();
} else {
self.$filesList.reloadList();