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

View file

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