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, var ui = pandora.user.ui,
canEdit = pandora.site.capabilities.canEditMetadata[pandora.user.level] || data.editable, 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 = { css = {
marginTop: '4px', marginTop: '4px',
textAlign: 'justify' textAlign: 'justify'

View file

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

View file

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