Template.mainLayout.onRendered(function(){

    // Minimalize menu when screen is less than 768px
    $(window).bind("resize load", function () {
        if ($(this).width() < 769) {
            $('body').addClass('body-small')
        } else {
            $('body').removeClass('body-small')
        }
    });

    // Fix height of layout when resize, scroll and load
    $(window).bind("load resize scroll", function() {
        if(!$("body").hasClass('body-small')) {

            var navbarHeigh = $('nav.navbar-default').height();
            var wrapperHeigh = $('#page-wrapper').height();

            if(navbarHeigh > wrapperHeigh){
                $('#page-wrapper').css("min-height", navbarHeigh + "px");
            }

            if(navbarHeigh < wrapperHeigh){
                $('#page-wrapper').css("min-height", $(window).height()  + "px");
            }

            if ($('body').hasClass('fixed-nav')) {
                if (navbarHeigh > wrapperHeigh) {
                    $('#page-wrapper').css("min-height", navbarHeigh - 60 + "px");
                } else {
                    $('#page-wrapper').css("min-height", $(window).height() - 60 + "px");
                }
            }
        }
    });


    // SKIN OPTIONS
    // Uncomment this if you want to have different skin option:
    // Available skin: (skin-1 or skin-3, skin-2 deprecated, md-skin)
    $('body').addClass('md-skin');

    // FIXED-SIDEBAR
    // Uncomment this if you want to have fixed left navigation
    // $('body').addClass('fixed-sidebar');
    // $('.sidebar-collapse').slimScroll({
    //     height: '100%',
    //     railOpacity: 0.9
    // });

    // BOXED LAYOUT
    // Uncomment this if you want to have boxed layout
    // $('body').addClass('boxed-layout');


});
Esempio n. 2
0
  });
};

Template.mainLayout.onRendered(function () {
  $(document).idleTimer(30 * 60 * 1000);
  $(document).on('idle.idleTimer', () => {
    // toastr.info('You are idle for 30 minutes :(', 'Idle');
  });
  $(document).on('active.idleTimer', () => {
    Notification.success('welcome-back');
  });

  doUIStuff();

  const settings = this.subscribe('settings');

  let initializedLiveChat = false;
  this.autorun(() => {
    if (settings.ready()) {
      const foundSettings = ReactivityProvider.findOne(ReactivityProvider.types.Settings);
      if (foundSettings && foundSettings.showLiveChat && !initializedLiveChat) {
        initializedLiveChat = true;
        LiveChat.prepare(window, window.nudgespot || []);
        window.nudgespot.init('748ae792d632f6c5e14ad610e53ef745');
      }
      SessionManager.set(SessionManager.strSessionApplicationLanguage, foundSettings.language || 'en');
      TAPi18n.setLanguage(SessionManager.get(SessionManager.strSessionApplicationLanguage));
    }
  });
});