mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-13 08:33:58 -07:00
added mail toolbar to series view
This commit is contained in:
parent
57e78e31fe
commit
ff225e1753
5 changed files with 121 additions and 15 deletions
63
UI/Shared/Toolbar/Button/ButtonView.js
Normal file
63
UI/Shared/Toolbar/Button/ButtonView.js
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue