1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

added mail toolbar to series view

This commit is contained in:
kay.one 2013-05-11 13:51:32 -07:00
parent 57e78e31fe
commit ff225e1753
5 changed files with 121 additions and 15 deletions

View File

@ -11,13 +11,7 @@ public class Container : IContainer
public Container(TinyIoCContainer container)
{
_container = container;
//_container.Options.AllowOverridingRegistrations = true;
//_container.RegisterSingle(LogManager.GetCurrentClassLogger());
_container.Register<IContainer>(this);
//container.RegisterWithContext(dependencyContext => LogManager.GetLogger(dependencyContext.ImplementationType.Name));
}
public void Register<TService, TImplementation>()

View File

@ -111,7 +111,7 @@ define([
var viewButtons = {
type : 'radio',
storeState : 'true',
storeState : true,
menuKey : 'seriesViewMode',
defaultAction: 'listView',
items : [
@ -136,7 +136,34 @@ define([
]
};
this.toolbar.show(new NzbDrone.Shared.Toolbar.ToolbarLayout({right: [ viewButtons], context: this}));
var leftSideButtons = {
type : 'default',
storeState: false,
items : [
{
title: 'Add Series',
icon : 'icon-plus',
route: 'series/add'
},
{
title : 'RSS Sync',
icon : 'icon-rss',
command: 'rsssync'
},
{
title : 'Update Library',
icon : 'icon-refresh',
command: 'updatelibrary'
}
]
};
this.toolbar.show(new NzbDrone.Shared.Toolbar.ToolbarLayout({
right : [ viewButtons],
left : [ leftSideButtons],
context: this
}));
}
})

View File

@ -0,0 +1,9 @@
"use strict";
define(['app', 'Shared/Toolbar/Button/ButtonView', 'Config'], function () {
NzbDrone.Shared.Toolbar.ButtonCollectionView = Backbone.Marionette.CollectionView.extend({
className: 'btn-group',
itemView : NzbDrone.Shared.Toolbar.ButtonView
});
});

View File

@ -0,0 +1,63 @@
"use strict";
define(['app', 'Config'], function () {
NzbDrone.Shared.Toolbar.ButtonView = Backbone.Marionette.ItemView.extend({
template : 'Shared/Toolbar/ButtonTemplate',
className: 'btn',
events: {
'click': 'onClick'
},
initialize: function () {
this.storageKey = this.model.get('menuKey') + ':' + this.model.get('key');
},
onRender: function () {
if (this.model.get('active')) {
this.$el.addClass('active');
this.invokeCallback();
}
},
onClick: function () {
this.invokeRoute();
this.invokeCallback();
this.invokeCommand();
},
invokeCommand: function () {
var command = this.model.get('command');
if (command) {
window.alert(command);
}
},
invokeRoute: function () {
var route = this.model.get('route');
if (route) {
NzbDrone.Router.navigate(route, {trigger: true});
}
},
invokeCallback: function () {
if (!this.model.ownerContext) {
throw 'ownerContext must be set.';
}
var callback = this.model.get('callback');
if (callback) {
callback.call(this.model.ownerContext);
}
}
});
});

View File

@ -1,5 +1,5 @@
"use strict";
define(['app', 'Shared/Toolbar/Radio/RadioButtonCollectionView', 'Shared/Toolbar/ButtonCollection'], function () {
define(['app', 'Shared/Toolbar/Radio/RadioButtonCollectionView','Shared/Toolbar/Button/ButtonCollectionView', 'Shared/Toolbar/ButtonCollection'], function () {
NzbDrone.Shared.Toolbar.ToolbarLayout = Backbone.Marionette.Layout.extend({
template: 'Shared/Toolbar/ToolbarLayoutTemplate',
@ -64,12 +64,25 @@ define(['app', 'Shared/Toolbar/Radio/RadioButtonCollectionView', 'Shared/Toolbar
var buttonGroupView;
if (buttonGroup.type === 'radio') {
switch (buttonGroup.type) {
case 'radio':
{
buttonGroupView = new NzbDrone.Shared.Toolbar.RadioButtonCollectionView(
{
collection: groupCollection,
menu : buttonGroup
});
break;
}
default :
{
buttonGroupView = new NzbDrone.Shared.Toolbar.ButtonCollectionView(
{
collection: groupCollection,
menu : buttonGroup
});
break;
}
}
this[position + '_' + (index + 1).toString()].show(buttonGroupView);