added mail toolbar to series view

pull/4/head
kay.one 12 years ago
parent 57e78e31fe
commit ff225e1753

@ -11,13 +11,7 @@ namespace NzbDrone.Common.Composition
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>()

@ -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
}));
}
})

@ -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
});
});

@ -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);
}
}
});
});

@ -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);

Loading…
Cancel
Save