shared toolbar radio button style is working. just need to store state.

This commit is contained in:
kay.one 2013-04-25 21:45:45 -07:00
parent 6636b77489
commit fe554849c2
15 changed files with 183 additions and 142 deletions

View file

@ -0,0 +1,38 @@
"use strict";
define(['app'], function () {
NzbDrone.Shared.Toolbar.RadioButtonView = Backbone.Marionette.ItemView.extend({
template : 'Shared/Toolbar/ButtonTemplate',
className: 'btn',
events: {
'click': 'invokeCallback'
},
onRender: function () {
if (this.model.get('active')) {
this.$el.addClass('active');
this.invokeCallback();
}
},
invokeCallback: function () {
if (!this.model.ownerContext) {
throw 'ownerContext must be set.';
}
var callback = this.model.get('callback');
if (callback) {
callback.call(this.model.ownerContext);
}
}
});
});