From f2593e299db59552ee47400622cd9cc77cc3a8d1 Mon Sep 17 00:00:00 2001 From: Xinhui Date: Wed, 25 Oct 2017 14:42:23 +0200 Subject: Breadcrumb for timebands --- app/controllers/timebands_controller.rb | 7 ------- app/views/timebands/edit.html.slim | 3 ++- app/views/timebands/index.html.slim | 1 + app/views/timebands/new.html.slim | 3 ++- app/views/timebands/show.html.slim | 5 +++-- config/breadcrumbs.rb | 10 ++++++++++ 6 files changed, 18 insertions(+), 11 deletions(-) diff --git a/app/controllers/timebands_controller.rb b/app/controllers/timebands_controller.rb index 446255cac..765557193 100644 --- a/app/controllers/timebands_controller.rb +++ b/app/controllers/timebands_controller.rb @@ -6,14 +6,7 @@ class TimebandsController < ChouetteController belongs_to :referential - def new - new! do - build_breadcrumb :new - end - end - private - def timeband_params params.require(:timeband).permit( :name, :start_time, :end_time ) end diff --git a/app/views/timebands/edit.html.slim b/app/views/timebands/edit.html.slim index af62ae8db..c70de82ef 100644 --- a/app/views/timebands/edit.html.slim +++ b/app/views/timebands/edit.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :timeband, @referential, @timeband = title_tag t('timebands.edit.title', timeband: @timeband.name) -= render 'form' \ No newline at end of file += render 'form' diff --git a/app/views/timebands/index.html.slim b/app/views/timebands/index.html.slim index c81c0a670..6dcf348f9 100644 --- a/app/views/timebands/index.html.slim +++ b/app/views/timebands/index.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :timebands, @referential = title_tag t('timebands.index.title') - if @timebands.any? diff --git a/app/views/timebands/new.html.slim b/app/views/timebands/new.html.slim index 90aa1bd2e..d9fc27823 100644 --- a/app/views/timebands/new.html.slim +++ b/app/views/timebands/new.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :timebands, @referential = title_tag t('timebands.new.title') -== render 'form' \ No newline at end of file +== render 'form' diff --git a/app/views/timebands/show.html.slim b/app/views/timebands/show.html.slim index 100457226..d45611c56 100644 --- a/app/views/timebands/show.html.slim +++ b/app/views/timebands/show.html.slim @@ -1,8 +1,9 @@ +- breadcrumb :timeband, @referential, @timeband = title_tag t( 'timebands.show.title', timeband: @timeband.name ) .summary p label = "#{@timeband.name} : " = "#{l(@timeband.start_time, format: :hour)} - #{l(@timeband.end_time, format: :hour)}" - -== render 'sidebar' \ No newline at end of file + +== render 'sidebar' diff --git a/config/breadcrumbs.rb b/config/breadcrumbs.rb index 438c8affd..e4bf8bbad 100644 --- a/config/breadcrumbs.rb +++ b/config/breadcrumbs.rb @@ -62,6 +62,16 @@ crumb :time_table do |referential, time_table| parent :time_tables, referential end +crumb :timebands do |referential| + link I18n.t('timebands.index.title'), referential_timebands_path(referential) + parent :referential, referential +end + +crumb :timeband do |referential, timeband| + link timeband.name, referential_timeband_path(referential, timeband) + parent :timebands, referential +end + crumb :compliance_check_sets do |workbench| link I18n.t('compliance_check_sets.index.title'), workbench_compliance_check_sets_path(workbench) parent :workbench, workbench -- cgit v1.2.3