2013-06-22 06:24:24 +00:00
|
|
|
'use strict';
|
2013-06-24 23:41:59 +00:00
|
|
|
define(
|
|
|
|
[
|
|
|
|
'marionette',
|
|
|
|
'Episode/Summary/View',
|
2013-06-29 00:35:21 +00:00
|
|
|
'Episode/Search/Layout'
|
|
|
|
], function (Marionette, SummaryView, SearchLayout) {
|
2013-05-15 01:17:24 +00:00
|
|
|
|
2013-06-24 23:41:59 +00:00
|
|
|
return Marionette.Layout.extend({
|
|
|
|
template: 'Episode/LayoutTemplate',
|
2013-05-21 00:17:33 +00:00
|
|
|
|
2013-06-24 23:41:59 +00:00
|
|
|
regions: {
|
|
|
|
summary : '#episode-summary',
|
|
|
|
activity: '#episode-activity',
|
|
|
|
search : '#episode-search'
|
|
|
|
},
|
2013-05-21 00:17:33 +00:00
|
|
|
|
2013-06-24 23:41:59 +00:00
|
|
|
ui: {
|
|
|
|
summary : '.x-episode-summary',
|
|
|
|
activity: '.x-episode-activity',
|
|
|
|
search : '.x-episode-search'
|
|
|
|
},
|
2013-05-21 00:17:33 +00:00
|
|
|
|
2013-06-24 23:41:59 +00:00
|
|
|
events: {
|
2013-05-21 00:17:33 +00:00
|
|
|
|
2013-06-28 22:12:57 +00:00
|
|
|
'click .x-episode-summary' : '_showSummary',
|
|
|
|
'click .x-episode-activity': '_showActivity',
|
|
|
|
'click .x-episode-search' : '_showSearch'
|
2013-06-24 23:41:59 +00:00
|
|
|
},
|
2013-05-21 00:17:33 +00:00
|
|
|
|
2013-06-24 23:41:59 +00:00
|
|
|
onShow: function () {
|
2013-06-28 22:12:57 +00:00
|
|
|
this._showSummary();
|
2013-07-04 03:04:26 +00:00
|
|
|
this.searchLayout = new SearchLayout({ model: this.model });
|
2013-06-24 23:41:59 +00:00
|
|
|
},
|
2013-05-21 00:17:33 +00:00
|
|
|
|
|
|
|
|
2013-06-28 22:12:57 +00:00
|
|
|
_showSummary: function (e) {
|
2013-06-24 23:41:59 +00:00
|
|
|
if (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
}
|
2013-05-21 00:17:33 +00:00
|
|
|
|
2013-06-24 23:41:59 +00:00
|
|
|
this.ui.summary.tab('show');
|
|
|
|
this.summary.show(new SummaryView({model: this.model}));
|
2013-05-21 00:17:33 +00:00
|
|
|
|
2013-06-24 23:41:59 +00:00
|
|
|
},
|
2013-05-21 00:17:33 +00:00
|
|
|
|
2013-06-28 22:12:57 +00:00
|
|
|
_showActivity: function (e) {
|
2013-06-24 23:41:59 +00:00
|
|
|
if (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
}
|
2013-05-21 00:17:33 +00:00
|
|
|
|
2013-06-24 23:41:59 +00:00
|
|
|
this.ui.activity.tab('show');
|
|
|
|
},
|
2013-05-21 00:17:33 +00:00
|
|
|
|
2013-06-28 22:12:57 +00:00
|
|
|
_showSearch: function (e) {
|
2013-06-24 23:41:59 +00:00
|
|
|
if (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
}
|
2013-05-21 00:17:33 +00:00
|
|
|
|
2013-06-24 23:41:59 +00:00
|
|
|
this.ui.search.tab('show');
|
2013-07-04 03:04:26 +00:00
|
|
|
this.search.show(this.searchLayout);
|
2013-06-24 23:41:59 +00:00
|
|
|
}
|
2013-05-15 01:17:24 +00:00
|
|
|
|
2013-06-24 23:41:59 +00:00
|
|
|
});
|
2013-05-15 01:17:24 +00:00
|
|
|
|
2013-06-24 23:41:59 +00:00
|
|
|
});
|