mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-20 21:54:25 -04:00
UI Cleanup - Updated Shared and Shims subtrees.
This commit is contained in:
@@ -7,49 +7,61 @@ var SortingButtonCollectionView = require('./Sorting/SortingButtonCollectionView
|
||||
var _ = require('underscore');
|
||||
|
||||
module.exports = Marionette.Layout.extend({
|
||||
template : 'Shared/Toolbar/ToolbarLayoutTemplate',
|
||||
className : 'toolbar',
|
||||
ui : {
|
||||
template : 'Shared/Toolbar/ToolbarLayoutTemplate',
|
||||
className : 'toolbar',
|
||||
|
||||
ui : {
|
||||
left_x : '.x-toolbar-left',
|
||||
right_x : '.x-toolbar-right'
|
||||
},
|
||||
initialize : function(options){
|
||||
if(!options) {
|
||||
|
||||
initialize : function(options) {
|
||||
if (!options) {
|
||||
throw 'options needs to be passed';
|
||||
}
|
||||
if(!options.context) {
|
||||
|
||||
if (!options.context) {
|
||||
throw 'context needs to be passed';
|
||||
}
|
||||
|
||||
this.left = options.left;
|
||||
this.right = options.right;
|
||||
this.toolbarContext = options.context;
|
||||
},
|
||||
onShow : function(){
|
||||
if(this.left) {
|
||||
|
||||
onShow : function() {
|
||||
if (this.left) {
|
||||
_.each(this.left, this._showToolbarLeft, this);
|
||||
}
|
||||
if(this.right) {
|
||||
if (this.right) {
|
||||
_.each(this.right, this._showToolbarRight, this);
|
||||
}
|
||||
},
|
||||
_showToolbarLeft : function(element, index){
|
||||
|
||||
_showToolbarLeft : function(element, index) {
|
||||
this._showToolbar(element, index, 'left');
|
||||
},
|
||||
_showToolbarRight : function(element, index){
|
||||
|
||||
_showToolbarRight : function(element, index) {
|
||||
this._showToolbar(element, index, 'right');
|
||||
},
|
||||
_showToolbar : function(buttonGroup, index, position){
|
||||
|
||||
_showToolbar : function(buttonGroup, index, position) {
|
||||
var groupCollection = new ButtonCollection();
|
||||
_.each(buttonGroup.items, function(button){
|
||||
if(buttonGroup.storeState && !button.key) {
|
||||
|
||||
_.each(buttonGroup.items, function(button) {
|
||||
if (buttonGroup.storeState && !button.key) {
|
||||
throw 'must provide key for all buttons when storSstate is enabled';
|
||||
}
|
||||
|
||||
var model = new ButtonModel(button);
|
||||
model.set('menuKey', buttonGroup.menuKey);
|
||||
model.ownerContext = this.toolbarContext;
|
||||
groupCollection.add(model);
|
||||
}, this);
|
||||
|
||||
var buttonGroupView;
|
||||
|
||||
switch (buttonGroup.type) {
|
||||
case 'radio':
|
||||
{
|
||||
@@ -77,13 +89,16 @@ module.exports = Marionette.Layout.extend({
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var regionId = position + '_' + (index + 1);
|
||||
var region = this[regionId];
|
||||
if(!region) {
|
||||
|
||||
if (!region) {
|
||||
var regionClassName = 'x-toolbar-' + position + '-' + (index + 1);
|
||||
this.ui[position + '_x'].append('<div class="toolbar-group ' + regionClassName + '" />\r\n');
|
||||
region = this.addRegion(regionId, '.' + regionClassName);
|
||||
}
|
||||
|
||||
region.show(buttonGroupView);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user