Moved tab changed listener into tab control

This commit is contained in:
Fergal Moran
2013-07-18 21:24:14 +01:00
parent df97be41fa
commit 8d11b3e7b3
4 changed files with 18 additions and 12 deletions

View File

@@ -17,10 +17,5 @@ define ['marionette', 'vent', 'views/widgets/mixTabHeaderView', 'views/mix/mixLi
showMixList: (options)->
console.log("Layout: showoing mixlist")
@bodyRegion.show(new MixListView(options))
@tabChanged(options.order_by)
tabChanged: (type) ->
$('#mix-tab li[id=li-' + type + ']', @el).addClass('active')
true
MixListRegionView

View File

@@ -30,13 +30,7 @@
MixListRegionView.prototype.showMixList = function(options) {
console.log("Layout: showoing mixlist");
this.bodyRegion.show(new MixListView(options));
return this.tabChanged(options.order_by);
};
MixListRegionView.prototype.tabChanged = function(type) {
$('#mix-tab li[id=li-' + type + ']', this.el).addClass('active');
return true;
return this.bodyRegion.show(new MixListView(options));
};
return MixListRegionView;

View File

@@ -4,4 +4,12 @@ define ['marionette', 'underscore', 'vent', 'text!/tpl/MixTabHeaderView'],
class MixTabHeaderView extends Marionette.ItemView
template: _.template(Template)
initialize: ->
@listenTo(vent, "mix:showlist", @tabChanged)
tabChanged: (options) ->
$('#mix-tab li[id=li-' + options.order_by + ']', @el).addClass('active')
true
MixTabHeaderView

View File

@@ -15,6 +15,15 @@
MixTabHeaderView.prototype.template = _.template(Template);
MixTabHeaderView.prototype.initialize = function() {
return this.listenTo(vent, "mix:showlist", this.tabChanged);
};
MixTabHeaderView.prototype.tabChanged = function(options) {
$('#mix-tab li[id=li-' + options.order_by + ']', this.el).addClass('active');
return true;
};
return MixTabHeaderView;
})(Marionette.ItemView);