From ea981aa0c90e8b1add5b0b7961d9cfb768596195 Mon Sep 17 00:00:00 2001 From: Andrew Radev Date: Wed, 29 Apr 2015 12:00:17 +0200 Subject: [PATCH] Fixes to conference creation process --- app/controllers/management/conferences_controller.rb | 8 ++++++-- app/views/layouts/management/_navigation.html.slim | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/controllers/management/conferences_controller.rb b/app/controllers/management/conferences_controller.rb index c111310..1d2feb9 100644 --- a/app/controllers/management/conferences_controller.rb +++ b/app/controllers/management/conferences_controller.rb @@ -11,8 +11,12 @@ module Management def create @conference = Conference.new conference_params - @conference.save - render :new + + if @conference.save + redirect_to [:management, @conference] + else + render :new + end end def update diff --git a/app/views/layouts/management/_navigation.html.slim b/app/views/layouts/management/_navigation.html.slim index 8f37787..80afd39 100644 --- a/app/views/layouts/management/_navigation.html.slim +++ b/app/views/layouts/management/_navigation.html.slim @@ -22,7 +22,9 @@ nav.navbar.navbar-static-top.navbar-inverse role="navigation" li class="#{'active' if controller_name == 'sessions'}" = link_to management_users_path do => icon 'user', User.model_name.human(count: 2).mb_chars.capitalize, class: 'fa-fw' - - if @conference.present? + + -# TODO Instead of this, provide a generic `yield :navigation`? + - if @conference.present? and @conference.persisted? li class="#{'active' if controller_name == 'events'}" = link_to management_conference_events_path(@conference) do => icon 'file-text', Event.model_name.human(count: 2).mb_chars.capitalize, class: 'fa-fw' @@ -32,6 +34,7 @@ nav.navbar.navbar-static-top.navbar-inverse role="navigation" li class="#{'active' if controller_name == 'volunteerships'}" = link_to '#' do => icon 'hand-o-up', t('activerecord.models.volunteership', count: 2).mb_chars.capitalize, class: 'fa-fw' + ul.nav.navbar-nav.navbar-right li.dropdown = link_to '#', class: 'dropdown-toggle', data: {toggle: 'dropdown'} do