mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-09 04:22:30 +01:00
added support for multi-button groups to toolbar
This commit is contained in:
parent
7ae9e79540
commit
19732ba31a
@ -72,3 +72,9 @@ html {
|
||||
text-align: center;
|
||||
padding: 30px;
|
||||
}
|
||||
|
||||
|
||||
.page-toolbar{
|
||||
margin-top: 10px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
'use strict';
|
||||
|
||||
define(['app', 'Series/SeriesModel'], function () {
|
||||
|
||||
NzbDrone.Series.Delete.DeleteSeriesView = Backbone.Marionette.ItemView.extend({
|
||||
|
@ -1,4 +1,5 @@
|
||||
define(['app', 'Series/EpisodeModel'], function () {
|
||||
"use strict";
|
||||
define(['app', 'Series/EpisodeModel'], function () {
|
||||
NzbDrone.Series.EpisodeCollection = Backbone.Collection.extend({
|
||||
url : NzbDrone.Constants.ApiRoot + '/episodes',
|
||||
model: NzbDrone.Series.EpisodeModel
|
||||
|
@ -1,3 +1,4 @@
|
||||
"use strict";
|
||||
define(['app'], function () {
|
||||
NzbDrone.Series.EpisodeModel = Backbone.Model.extend({
|
||||
|
||||
|
6
UI/Series/Index/EmptySeriesIndexView.js
Normal file
6
UI/Series/Index/EmptySeriesIndexView.js
Normal file
@ -0,0 +1,6 @@
|
||||
'use strict';
|
||||
define(['app'], function () {
|
||||
NzbDrone.Series.Index.EmptySeriesCollectionView = Backbone.Marionette.CompositeView.extend({
|
||||
template: 'Series/Index/EmptySeriesIndexTemplate'
|
||||
});
|
||||
});
|
@ -2,6 +2,7 @@
|
||||
define([
|
||||
'app',
|
||||
'Series/Index/List/CollectionView',
|
||||
<<<<<<< HEAD
|
||||
'Config'
|
||||
'Series/Index/Posters/CollectionView',
|
||||
'Series/Index/EmptyView',
|
||||
@ -9,6 +10,9 @@ define([
|
||||
'Series/Index/Table/AirDateCell',
|
||||
'Series/Index/Table/SeriesStatusCell'
|
||||
'Shared/Toolbar/ToolbarView',
|
||||
=======
|
||||
'Shared/Toolbar/ToolbarLayout',
|
||||
>>>>>>> added support for multi-button groups to toolbar
|
||||
'Config'
|
||||
],
|
||||
function () {
|
||||
@ -180,13 +184,19 @@ define([
|
||||
|
||||
onShow: function () {
|
||||
|
||||
var commands = new NzbDrone.Shared.Toolbar.CommandCollection();
|
||||
var menuLeft = new NzbDrone.Shared.Toolbar.CommandCollection();
|
||||
|
||||
commands.add(new NzbDrone.Shared.Toolbar.CommandModel({title: "Add Series", icon: "icon-plus"}));
|
||||
commands.add(new NzbDrone.Shared.Toolbar.CommandModel({title: "RSS Sync", icon: "icon-rss"}));
|
||||
commands.add(new NzbDrone.Shared.Toolbar.CommandModel({title: "Sync Database", icon: "icon-refresh"}));
|
||||
menuLeft.add(new NzbDrone.Shared.Toolbar.CommandModel({title: "Add Series", icon: "icon-plus"}));
|
||||
menuLeft.add(new NzbDrone.Shared.Toolbar.CommandModel({title: "RSS Sync", icon: "icon-rss"}));
|
||||
menuLeft.add(new NzbDrone.Shared.Toolbar.CommandModel({title: "Sync Database", icon: "icon-refresh"}));
|
||||
|
||||
this.toolbar.show(new NzbDrone.Shared.Toolbar.ToolbarView({collection: commands}));
|
||||
var menuRight = new NzbDrone.Shared.Toolbar.CommandCollection();
|
||||
|
||||
menuRight.add(new NzbDrone.Shared.Toolbar.CommandModel({title: "Add Series", icon: "icon-plus"}));
|
||||
menuRight.add(new NzbDrone.Shared.Toolbar.CommandModel({title: "RSS Sync", icon: "icon-rss"}));
|
||||
menuRight.add(new NzbDrone.Shared.Toolbar.CommandModel({title: "Sync Database", icon: "icon-refresh"}));
|
||||
|
||||
this.toolbar.show(new NzbDrone.Shared.Toolbar.ToolbarLayout({left: [ menuLeft], right: [menuRight]}));
|
||||
|
||||
switch (this.viewStyle) {
|
||||
case 1:
|
||||
|
@ -1,4 +1,5 @@
|
||||
define(['app', 'Series/SeasonModel'], function () {
|
||||
"use strict";
|
||||
define(['app', 'Series/SeasonModel'], function () {
|
||||
NzbDrone.Series.SeasonCollection = Backbone.Collection.extend({
|
||||
url : NzbDrone.Constants.ApiRoot + '/season',
|
||||
model: NzbDrone.Series.SeasonModel
|
||||
|
11
UI/Shared/Toolbar/ButtonGroupView.js
Normal file
11
UI/Shared/Toolbar/ButtonGroupView.js
Normal file
@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
define(['app', 'Shared/Toolbar/CommandView'], function () {
|
||||
NzbDrone.Shared.Toolbar.ButtonGroupView = Backbone.Marionette.CollectionView.extend({
|
||||
className: 'btn-group',
|
||||
itemView : NzbDrone.Shared.Toolbar.CommandView
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
1
UI/Shared/Toolbar/CommandTemplate.html
Normal file
1
UI/Shared/Toolbar/CommandTemplate.html
Normal file
@ -0,0 +1 @@
|
||||
<i class="{{icon}}"/> {{title}}
|
21
UI/Shared/Toolbar/CommandView.js
Normal file
21
UI/Shared/Toolbar/CommandView.js
Normal file
@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
define(['app'], function () {
|
||||
|
||||
NzbDrone.Shared.Toolbar.CommandView = Backbone.Marionette.ItemView.extend({
|
||||
template : 'Shared/Toolbar/CommandTemplate',
|
||||
className: 'btn',
|
||||
|
||||
events: {
|
||||
'click': 'onClick'
|
||||
},
|
||||
|
||||
onClick: function () {
|
||||
window.alert('click');
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
40
UI/Shared/Toolbar/ToolbarLayout.js
Normal file
40
UI/Shared/Toolbar/ToolbarLayout.js
Normal file
@ -0,0 +1,40 @@
|
||||
"use strict";
|
||||
define(['app', 'Shared/Toolbar/ButtonGroupView','Shared/Toolbar/CommandCollection'], function () {
|
||||
NzbDrone.Shared.Toolbar.ToolbarLayout = Backbone.Marionette.Layout.extend({
|
||||
template: 'Shared/Toolbar/ToolbarLayoutTemplate',
|
||||
|
||||
regions: {
|
||||
left_1 : '.x-toolbar-left-1',
|
||||
left_2 : '.x-toolbar-left-2',
|
||||
right_1: '.x-toolbar-right-1',
|
||||
right_2: '.x-toolbar-right-2'
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
this.left = options.left;
|
||||
this.right = options.right;
|
||||
},
|
||||
|
||||
onShow: function () {
|
||||
if (this.left) {
|
||||
_.each(this.left, this._showToolbarLeft, this);
|
||||
}
|
||||
if (this.right) {
|
||||
_.each(this.right, this._showToolbarRight, this);
|
||||
}
|
||||
},
|
||||
|
||||
_showToolbarLeft: function (element, index) {
|
||||
this['left_' + (index + 1).toString()].show(new NzbDrone.Shared.Toolbar.ButtonGroupView({collection: element}));
|
||||
},
|
||||
|
||||
_showToolbarRight: function (element, index) {
|
||||
this['right_' + (index + 1).toString()].show(new NzbDrone.Shared.Toolbar.ButtonGroupView({collection: element}));
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
8
UI/Shared/Toolbar/ToolbarLayoutTemplate.html
Normal file
8
UI/Shared/Toolbar/ToolbarLayoutTemplate.html
Normal file
@ -0,0 +1,8 @@
|
||||
<div class="pull-left page-toolbar">
|
||||
<div class="x-toolbar-left-1 btn-group"/>
|
||||
<div class="x-toolbar-left-2 btn-group"/>
|
||||
</div>
|
||||
<div class="pull-right page-toolbar">
|
||||
<div class="x-toolbar-right-1 btn-group"/>
|
||||
<div class="x-toolbar-right-2 btn-group"/>
|
||||
</div>
|
@ -1,18 +0,0 @@
|
||||
<div class="btn-group">
|
||||
{{#commands}}
|
||||
<a class="btn" href="{{target}}" data-target="0">
|
||||
<i class="{{icon}}"/>
|
||||
{{title}}
|
||||
</a>
|
||||
{{/commands}}
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<div class="btn-group">
|
||||
<a class="btn x-series-change-view x-series-show-table" href="#" title="Table" data-target="0"><i class="icon-table"></i></a>
|
||||
<a class="btn x-series-change-view x-series-show-list" href="#" title="List" data-target="1"><i class="icon-list"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--replace this with padding-->
|
||||
<br/>
|
||||
<br/>
|
@ -1,21 +0,0 @@
|
||||
"use strict";
|
||||
define(['app', 'Shared/Toolbar/CommandCollection'], function () {
|
||||
|
||||
NzbDrone.Shared.Toolbar.ToolbarView = Backbone.Marionette.ItemView.extend({
|
||||
template: 'Shared/Toolbar/ToolbarTemplate',
|
||||
|
||||
initialize: function () {
|
||||
if (!this.collection) {
|
||||
throw 'CommandCollection needs to be provided';
|
||||
}
|
||||
|
||||
this.model = new Backbone.Model();
|
||||
this.model.set('commands', this.collection.toJSON());
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user