2014-09-07 19:49:11 +02:00
|
|
|
var App = App || {};
|
|
|
|
App.Presenters = App.Presenters || {};
|
|
|
|
|
|
|
|
App.Presenters.HelpPresenter = function(
|
|
|
|
jQuery,
|
2014-10-12 11:26:23 +02:00
|
|
|
promise,
|
|
|
|
util,
|
2014-09-07 19:49:11 +02:00
|
|
|
topNavigationPresenter) {
|
|
|
|
|
|
|
|
var $el = jQuery('#content');
|
2014-10-12 11:26:23 +02:00
|
|
|
var templates = {};
|
|
|
|
var activeTab;
|
2014-09-07 19:49:11 +02:00
|
|
|
|
2014-10-09 21:41:46 +02:00
|
|
|
function init(params, loaded) {
|
2014-09-07 19:49:11 +02:00
|
|
|
topNavigationPresenter.select('help');
|
2014-09-11 13:59:12 +02:00
|
|
|
topNavigationPresenter.changeTitle('Help');
|
2014-10-12 11:26:23 +02:00
|
|
|
|
|
|
|
promise.wait(util.promiseTemplate('help'))
|
|
|
|
.then(function(template) {
|
|
|
|
templates.help = template;
|
|
|
|
reinit(params, loaded);
|
|
|
|
}).fail(function() {
|
|
|
|
console.log(arguments);
|
|
|
|
loaded();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function reinit(params, loaded) {
|
|
|
|
activeTab = params.tab || 'about';
|
2014-09-07 19:49:11 +02:00
|
|
|
render();
|
2014-09-17 22:37:49 +02:00
|
|
|
loaded();
|
2014-09-07 19:49:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function render() {
|
2014-10-12 11:26:23 +02:00
|
|
|
$el.html(templates.help({title: topNavigationPresenter.getBaseTitle() }));
|
|
|
|
$el.find('.big-button').removeClass('active');
|
|
|
|
$el.find('.big-button[href*="' + activeTab + '"]').addClass('active');
|
|
|
|
$el.find('div[data-tab]').hide();
|
|
|
|
$el.find('div[data-tab*="' + activeTab + '"]').show();
|
2014-09-08 22:02:28 +02:00
|
|
|
}
|
2014-09-07 19:49:11 +02:00
|
|
|
|
|
|
|
return {
|
|
|
|
init: init,
|
2014-10-12 11:26:23 +02:00
|
|
|
reinit: reinit,
|
2014-09-07 19:49:11 +02:00
|
|
|
render: render,
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2014-10-12 11:26:23 +02:00
|
|
|
App.DI.register('helpPresenter', ['jQuery', 'promise', 'util', 'topNavigationPresenter'], App.Presenters.HelpPresenter);
|