From c86c99167dfb0e1324f15f0b45493fc85a717429 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sun, 20 Jul 2014 23:50:03 +0200 Subject: [PATCH] Added controller method to show/hide navigation. --- .../app/controllers/_application_controller.js.coffee | 11 +++++++++++ .../javascripts/app/controllers/login.js.coffee | 2 ++ .../app/controllers/reset_password.js.coffee | 2 ++ .../javascripts/app/controllers/signup.js.coffee | 2 ++ 4 files changed, 17 insertions(+) diff --git a/app/assets/javascripts/app/controllers/_application_controller.js.coffee b/app/assets/javascripts/app/controllers/_application_controller.js.coffee index d2f16260f..3e6313fc3 100644 --- a/app/assets/javascripts/app/controllers/_application_controller.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller.js.coffee @@ -95,6 +95,16 @@ class App.Controller extends Spine.Controller navupdate: (url) -> App.Event.trigger 'navupdate', url + # show navigation + navShow: -> + return if $('#navigation').is(':visible') + $('#navigation').attr('style', 'display: flex!important') + + # hide navigation + navHide: -> + return if !$('#navigation').is(':visible') + $('#navigation').attr('style', 'display: none!important') + scrollTo: ( x = 0, y = 0, delay = 0 ) -> a = -> window.scrollTo( x, y ) @@ -460,6 +470,7 @@ class App.ControllerContent extends App.Controller super $('.content').hide() $('#content').show() + @navShow() class App.ControllerModal extends App.Controller className: 'modal fade', diff --git a/app/assets/javascripts/app/controllers/login.js.coffee b/app/assets/javascripts/app/controllers/login.js.coffee index 35b73cd50..0b9daf8d5 100644 --- a/app/assets/javascripts/app/controllers/login.js.coffee +++ b/app/assets/javascripts/app/controllers/login.js.coffee @@ -10,6 +10,8 @@ class Index extends App.ControllerContent @navigate '#' return + @navHide() + @title 'Sign in' @render() @navupdate '#login' diff --git a/app/assets/javascripts/app/controllers/reset_password.js.coffee b/app/assets/javascripts/app/controllers/reset_password.js.coffee index 475ee66df..77ce03857 100644 --- a/app/assets/javascripts/app/controllers/reset_password.js.coffee +++ b/app/assets/javascripts/app/controllers/reset_password.js.coffee @@ -12,6 +12,8 @@ class Index extends App.ControllerContent @navigate '#' return + @navHide() + # set title @title 'Reset Password' @navupdate '#reset_password' diff --git a/app/assets/javascripts/app/controllers/signup.js.coffee b/app/assets/javascripts/app/controllers/signup.js.coffee index 0f0cd248e..15054e6ab 100644 --- a/app/assets/javascripts/app/controllers/signup.js.coffee +++ b/app/assets/javascripts/app/controllers/signup.js.coffee @@ -12,6 +12,8 @@ class Index extends App.ControllerContent @navigate '#' return + @navHide() + # set title @title 'Sign up' @navupdate '#signup'