diff options
Diffstat (limited to 'app/helpers')
| -rw-r--r-- | app/helpers/breadcrumb_helper.rb | 11 | ||||
| -rw-r--r-- | app/helpers/route_section_selectors_helper.rb | 23 |
2 files changed, 33 insertions, 1 deletions
diff --git a/app/helpers/breadcrumb_helper.rb b/app/helpers/breadcrumb_helper.rb index 52da8b887..69494321b 100644 --- a/app/helpers/breadcrumb_helper.rb +++ b/app/helpers/breadcrumb_helper.rb @@ -1,6 +1,7 @@ module BreadcrumbHelper - def build_breadcrumb(action) + def build_breadcrumb(action) + action = action.to_sym case resource_class.to_s when "Chouette::Network" network_breadcrumb action @@ -30,6 +31,8 @@ module BreadcrumbHelper connection_link_breadcrumb action when "Chouette::TimeTable" time_table_breadcrumb action + when "Chouette::RouteSection" + route_section_breadcrumb action when "Chouette::Timeband" timeband_breadcrumb action when "StopAreaCopy" @@ -106,6 +109,12 @@ module BreadcrumbHelper add_breadcrumb breadcrumb_label(@time_table), referential_time_table_path(@referential, @time_table),:title => breadcrumb_tooltip(@time_table) if action == :edit end + def route_section_breadcrumb(action) + referential_breadcrumb + add_breadcrumb Chouette::RouteSection.model_name.human.pluralize, referential_route_sections_path(@referential) + add_breadcrumb breadcrumb_label(resource), referential_route_section_path(@referential, resource),:title => breadcrumb_tooltip(resource) if action.in?([:show, :edit]) + end + def timeband_breadcrumb(action) referential_breadcrumb add_breadcrumb Chouette::Timeband.model_name.human(:count => 2), referential_timebands_path(@referential) unless action == :index diff --git a/app/helpers/route_section_selectors_helper.rb b/app/helpers/route_section_selectors_helper.rb new file mode 100644 index 000000000..1be30066b --- /dev/null +++ b/app/helpers/route_section_selectors_helper.rb @@ -0,0 +1,23 @@ +module RouteSectionSelectorsHelper + + def link_to_edit_route_section(route_section) + classes = [ 'edit-route-section' ] + link ='#' + + if route_section.present? + return_to = edit_referential_line_route_journey_pattern_route_sections_selector_path(@referential, @line, @route, @journey_pattern) + link = edit_referential_route_section_path(@referential, route_section, return_to: return_to) + else + classes << 'disabled' + end + + link_to "Edit", link, class: classes, title: t('route_sections_selectors.edit.route_section.edit') + end + + def link_to_create_route_section(departure, arrival) + return_to = edit_referential_line_route_journey_pattern_route_sections_selector_path(@referential, @line, @route, @journey_pattern) + link_to t('route_sections_selectors.edit.route_section.new'), + create_to_edit_referential_route_sections_path(@referential, route_section: {departure_id:departure.id, arrival_id: arrival.id}, return_to: return_to) + end + +end |
