From da2c0a2f82321c50d17d4d3c09f4f68c4b776fbd Mon Sep 17 00:00:00 2001 From: eagletmt Date: Wed, 31 Oct 2012 20:06:33 +0900 Subject: [PATCH] Move navbar to shared partial --- CutenServer/app/views/home/index.html.haml | 18 +----------------- CutenServer/app/views/shared/_navbar.html.haml | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 17 deletions(-) create mode 100644 CutenServer/app/views/shared/_navbar.html.haml diff --git a/CutenServer/app/views/home/index.html.haml b/CutenServer/app/views/home/index.html.haml index f51aa2f..a79e70a 100644 --- a/CutenServer/app/views/home/index.html.haml +++ b/CutenServer/app/views/home/index.html.haml @@ -1,20 +1,4 @@ -.navbar - .navbar-inner - .container - %span.brand CUTEn - %ul.nav - %li.active - %a{:href => '#'} Home - - if user_signed_in? - %li= link_to I18n.t('home.profile'), :controller => :users, :action => :profile - %li= link_to I18n.t('home.achievement'), :controller => :achievements, :action => :index - - elsif teacher_signed_in? - %li= link_to I18n.t('home.profile'), :controller => :teachers, :action => :profile - %li= link_to I18n.t('home.achievement'), :controller => :achievements, :action => :index - - if user_signed_in? - = link_to I18n.t('devise.sign_out'), destroy_user_session_path, :class => 'signout-btn' - - elsif teacher_signed_in? - = link_to I18n.t('devise.sign_out'), destroy_user_session_path, :class => 'signout-btn' += render :partial => 'shared/navbar' - if notice %div#notice= notice diff --git a/CutenServer/app/views/shared/_navbar.html.haml b/CutenServer/app/views/shared/_navbar.html.haml new file mode 100644 index 0000000..0f0324a --- /dev/null +++ b/CutenServer/app/views/shared/_navbar.html.haml @@ -0,0 +1,17 @@ +.navbar + .navbar-inner + .container + %span.brand CUTEn + %ul.nav + %li.active + %a{:href => '#'} Home + - if user_signed_in? + %li= link_to I18n.t('home.profile'), :controller => :users, :action => :profile + %li= link_to I18n.t('home.achievement'), :controller => :achievements, :action => :index + - elsif teacher_signed_in? + %li= link_to I18n.t('home.profile'), :controller => :teachers, :action => :profile + %li= link_to I18n.t('home.achievement'), :controller => :achievements, :action => :index + - if user_signed_in? + = link_to I18n.t('devise.sign_out'), destroy_user_session_path, :class => 'signout-btn' + - elsif teacher_signed_in? + = link_to I18n.t('devise.sign_out'), destroy_user_session_path, :class => 'signout-btn' -- 2.11.0