update all items element

This commit is contained in:
rolux 2013-03-03 12:04:42 +05:30
parent 14ead5ed2d
commit 40a8c23d4f

View file

@ -2,48 +2,50 @@
pandora.ui.allItems = function() { pandora.ui.allItems = function() {
var that = Ox.Element() var canAddItems = !pandora.site.itemRequiresVideo && pandora.site.capabilities.canAddItems[pandora.user.level],
.addClass('OxSelectableElement' + (pandora.user.ui._list ? '' : ' OxSelected')) canUploadVideo = pandora.site.capabilities.canAddItems[pandora.user.level],
.css({ that = Ox.Element()
height: '16px', .addClass('OxSelectableElement' + (pandora.user.ui._list ? '' : ' OxSelected'))
cursor: 'default', .css({
overflow: 'hidden' height: '16px',
}) cursor: 'default',
.on({ overflow: 'hidden'
click: function() { })
that.gainFocus(); .on({
if (pandora.user.ui.section == 'items') { click: function() {
pandora.user.ui._list && pandora.UI.set('find', {conditions: [], operator: '&'}); that.gainFocus();
} else { if (pandora.user.ui.section == 'items') {
pandora.UI.set(pandora.user.ui.section.slice(0, -1), ''); pandora.user.ui._list && pandora.UI.set('find', {conditions: [], operator: '&'});
} else {
pandora.UI.set(pandora.user.ui.section.slice(0, -1), '');
}
} }
} })
}) .bindEvent({
.bindEvent({ pandora_find: function() {
pandora_find: function() { that[pandora.user.ui._list ? 'removeClass' : 'addClass']('OxSelected');
that[pandora.user.ui._list ? 'removeClass' : 'addClass']('OxSelected'); }
} }),
}), $icon = $('<img>')
$icon = $('<img>') .attr({src: '/static/png/icon.png'})
.attr({src: '/static/png/icon.png'}) .css({float: 'left', width: '14px', height: '14px', margin: '1px'})
.css({float: 'left', width: '14px', height: '14px', margin: '1px'}) .appendTo(that),
.appendTo(that), $name = $('<div>')
$name = $('<div>') .css({
.css({ float: 'left',
float: 'left', height: '14px',
height: '14px', margin: '1px 4px 1px 3px',
margin: '1px 4px 1px 3px', textOverflow: 'ellipsis',
textOverflow: 'ellipsis', overflow: 'hidden',
overflow: 'hidden', whiteSpace: 'nowrap'
whiteSpace: 'nowrap' })
}) .html(
.html( pandora.user.ui.section == 'items'
pandora.user.ui.section == 'items' ? 'All ' + pandora.site.itemName.plural
? 'All ' + pandora.site.itemName.plural : pandora.site.site.name + ' ' + Ox.toTitleCase(pandora.user.ui.section)
: pandora.site.site.name + ' ' + Ox.toTitleCase(pandora.user.ui.section) )
) .appendTo(that),
.appendTo(that), $items;
$items;
if (pandora.user.ui.section == 'items') { if (pandora.user.ui.section == 'items') {
$items = $('<div>') $items = $('<div>')
@ -56,16 +58,27 @@ pandora.ui.allItems = function() {
.appendTo(that); .appendTo(that);
Ox.Button({ Ox.Button({
style: 'symbol', style: 'symbol',
title: 'click', title: 'add',
tooltip: canAddItems ? 'Add ' + pandora.site.itemName.singular : ''
type: 'image' type: 'image'
}) })
.css({opacity: 0.25}) .css({opacity: canAddItems ? 1 : 0.25})
.bindEvent({
click: pandora.addItem
})
.appendTo(that); .appendTo(that);
Ox.Button({ Ox.Button({
style: 'symbol', style: 'symbol',
title: 'upload', title: 'upload',
tooltip: canUploadVideo ? 'Upload Video...' : '',
type: 'image' type: 'image'
}) })
.css({opacity: canUploadVideo ? 1 : 0.25})
.bindEvent({
click: function() {
pandora.$ui.uploadDialog = pandora.ui.uploadDialog().open();
}
})
.appendTo(that); .appendTo(that);
pandora.api.find({ pandora.api.find({
query: {conditions: [], operator: '&'} query: {conditions: [], operator: '&'}
@ -79,6 +92,7 @@ pandora.ui.allItems = function() {
tooltip: 'HTML', tooltip: 'HTML',
type: 'image' type: 'image'
}) })
.css({opacity: 0.25})
.appendTo(that); .appendTo(that);
Ox.Button({ Ox.Button({
style: 'symbol', style: 'symbol',
@ -86,6 +100,7 @@ pandora.ui.allItems = function() {
tooltip: 'Help', tooltip: 'Help',
type: 'image' type: 'image'
}) })
.css({opacity: 0.25})
.appendTo(that); .appendTo(that);
} }