Vulcan/client/views/common/layout.js

43 lines
1 KiB
JavaScript
Raw Normal View History

Template.layout.helpers({
2015-03-12 18:07:23 +09:00
navLayout: function () {
2015-03-28 18:30:26 +09:00
return Settings.get('navLayout', 'top-nav');
2015-03-12 18:07:23 +09:00
},
pageName : function(){
return getCurrentTemplate();
2013-02-14 10:17:26 +09:00
},
2015-02-24 14:07:58 -05:00
extraCode: function() {
2015-03-28 18:30:26 +09:00
return Settings.get('extraCode');
2015-02-24 14:07:58 -05:00
},
heroModules: function () {
2015-03-16 10:00:11 +09:00
return _.sortBy(heroModules, 'order');
}
});
Template.layout.created = function(){
Session.set('currentScroll', null);
};
Template.layout.rendered = function(){
2014-05-23 13:08:40 +09:00
if(currentScroll=Session.get('currentScroll')){
$('body').scrollTop(currentScroll);
Session.set('currentScroll', null);
}
2015-02-14 19:03:22 +09:00
// favicon
var link = document.createElement('link');
link.type = 'image/x-icon';
link.rel = 'shortcut icon';
2015-03-28 18:30:26 +09:00
link.href = Settings.get('faviconUrl', '/img/favicon.ico');
2015-02-14 19:03:22 +09:00
document.getElementsByTagName('head')[0].appendChild(link);
};
Template.layout.events({
'click .inner-wrapper': function (e) {
if ($('body').hasClass('mobile-nav-open')) {
e.preventDefault();
$('body').removeClass('mobile-nav-open');
}
}
2015-03-28 18:30:26 +09:00
});