allow deleting own videos

This commit is contained in:
j 2014-02-13 11:54:30 +00:00
parent 7c4746765b
commit a32435b577
3 changed files with 9 additions and 10 deletions

View file

@ -4,7 +4,7 @@ pandora.ui.infoView = function(data) {
var ui = pandora.user.ui,
canEdit = pandora.site.capabilities.canEditMetadata[pandora.user.level] || data.editable,
canRemove = pandora.site.capabilities.canRemoveItems[pandora.user.level],
canRemove = pandora.site.capabilities.canRemoveItems[pandora.user.level] || data.editable,
css = {
marginTop: '4px',
textAlign: 'justify'

View file

@ -119,9 +119,7 @@ pandora.ui.item = function() {
} else if (pandora.user.ui.itemView == 'media') {
pandora.$ui.contentPanel.replaceElement(1,
pandora.$ui.item = pandora.ui.mediaView({
id: result.data.id
})
pandora.$ui.item = pandora.ui.mediaView(result.data)
);
} else if (pandora.user.ui.itemView == 'frames' || pandora.user.ui.itemView == 'posters') {

View file

@ -2,19 +2,20 @@
'use strict';
pandora.ui.mediaView = function(options, self) {
pandora.ui.mediaView = function(options) {
var self = self || {},
var canRemove = pandora.site.capabilities.canRemoveItems[pandora.user.level] || options.editable,
self = {},
that = Ox.Element({}, self)
.defaults({
id: ''
})
.options(options || {});
.options({});
self.filesQuery = {
conditions: [{
key: 'id',
value: self.options.id,
value: options.id,
operator: '=='
}]
};
@ -35,7 +36,7 @@ pandora.ui.mediaView = function(options, self) {
},
{},
{
disabled: !pandora.site.capabilities.canRemoveItems[pandora.user.level],
disabled: !canRemove,
id: 'delete',
title: Ox._('Delete {0}...', [Ox._(pandora.site.itemName.singular)])
}
@ -527,7 +528,7 @@ pandora.ui.mediaView = function(options, self) {
);
pandora.api.moveMedia(data, function(result) {
if (
pandora.user.ui.item == self.options.id
pandora.user.ui.item == options.id
&& pandora.user.ui.itemView == 'media'
) {
Ox.Request.clearCache(); // fixme: remove