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