diff options
| author | Luc Donnet | 2017-10-30 11:45:07 +0100 | 
|---|---|---|
| committer | GitHub | 2017-10-30 11:45:07 +0100 | 
| commit | cb7e16653eb1dcb71fb46c84d7c1f3ea8aafd69a (patch) | |
| tree | b9e3993c435c63517366c1ce11b9d3a9efa5b793 | |
| parent | 76d1787b32e28e4dbb3664e2bad99366781fdcd2 (diff) | |
| parent | d68f820ee402cd94d9f5fd4405f49436c4847c4b (diff) | |
| download | chouette-core-cb7e16653eb1dcb71fb46c84d7c1f3ea8aafd69a.tar.bz2 | |
Merge pull request #104 from af83/4726-breadcrumb
4726 breadcrumb
131 files changed, 420 insertions, 625 deletions
| @@ -93,7 +93,7 @@ gem 'RedCloth', '~> 4.3.0'  gem 'simple_form', '~> 3.1.0'  gem 'font-awesome-sass', '~> 4.7'  gem 'will_paginate-bootstrap' -gem 'breadcrumbs_on_rails' +gem 'gretel'  # Format Output  gem 'json' diff --git a/Gemfile.lock b/Gemfile.lock index 3acc27613..48a8b638a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -105,7 +105,6 @@ GEM        rack (>= 0.9.0)      binding_of_caller (0.7.2)        debug_inspector (>= 0.0.1) -    breadcrumbs_on_rails (3.0.1)      builder (3.2.3)      bundler-audit (0.5.0)        bundler (~> 1.2) @@ -245,6 +244,8 @@ GEM      globalid (0.3.7)        activesupport (>= 4.1.0)      google-analytics-rails (1.1.0) +    gretel (3.0.9) +      rails (>= 3.1.0)      has_scope (0.7.0)        actionpack (>= 4.1, < 5.1)        activesupport (>= 4.1, < 5.1) @@ -568,7 +569,6 @@ DEPENDENCIES    awesome_print    better_errors    binding_of_caller -  breadcrumbs_on_rails    bundler-audit    calendar_helper (= 0.2.5)    capistrano (= 2.13.5) @@ -604,6 +604,7 @@ DEPENDENCIES    georuby (= 2.3.0)    georuby-ext (= 0.0.5)    google-analytics-rails +  gretel    has_array_of!    hstore_accessor (~> 1.1)    htmlbeautifier diff --git a/app/controllers/access_links_controller.rb b/app/controllers/access_links_controller.rb index 6f1ad8bfd..936b8ea5e 100644 --- a/app/controllers/access_links_controller.rb +++ b/app/controllers/access_links_controller.rb @@ -21,9 +21,7 @@ class AccessLinksController < ChouetteController      @access_point = Chouette::AccessPoint.find(params[:access_point_id])      #@access_link = Chouette::AccessLink.find(params[:id])      @stop_area = @access_link.stop_area -    show! do |format| -      format.html {build_breadcrumb :show} -    end +    show!    end    def new @@ -41,9 +39,7 @@ class AccessLinksController < ChouetteController        data[:name] = name      end      @access_link = Chouette::AccessLink.new(data.permit!) -    new! do -      build_breadcrumb :new -    end +    new!    end    def create @@ -59,9 +55,7 @@ class AccessLinksController < ChouetteController      @access_link = Chouette::AccessLink.find(params[:id])      @stop_area = @access_link.stop_area      @orientation = @access_link.link_orientation_type -    edit! do -      build_breadcrumb :edit -    end +    edit!    end    def update @@ -69,9 +63,7 @@ class AccessLinksController < ChouetteController      @access_link = Chouette::AccessLink.find(params[:id])      @stop_area = @access_link.stop_area      @orientation = @access_link.link_orientation_type -    update! do |success, failure| -      build_breadcrumb :edit -    end +    update!    end    protected diff --git a/app/controllers/access_points_controller.rb b/app/controllers/access_points_controller.rb index d43880c0b..477875cc9 100644 --- a/app/controllers/access_points_controller.rb +++ b/app/controllers/access_points_controller.rb @@ -6,7 +6,6 @@ class AccessPointsController < ChouetteController    end    respond_to :html, :kml, :xml, :json -    include PolicyChecker    def index @@ -32,7 +31,6 @@ class AccessPointsController < ChouetteController          }        end -      format.html {build_breadcrumb :show}      end    end @@ -40,9 +38,7 @@ class AccessPointsController < ChouetteController    def edit      access_point.position ||= access_point.default_position      map.editable = true -    edit! do -      build_breadcrumb :edit -    end +    edit!    end diff --git a/app/controllers/api_keys_controller.rb b/app/controllers/api_keys_controller.rb index 7ae8d4732..eebad5e7b 100644 --- a/app/controllers/api_keys_controller.rb +++ b/app/controllers/api_keys_controller.rb @@ -1,4 +1,4 @@ -class ApiKeysController < BreadcrumbController +class ApiKeysController < InheritedResources::Base    defaults resource_class: Api::V1::ApiKey    include PolicyChecker diff --git a/app/controllers/breadcrumb_controller.rb b/app/controllers/breadcrumb_controller.rb deleted file mode 100644 index cb639fdb8..000000000 --- a/app/controllers/breadcrumb_controller.rb +++ /dev/null @@ -1,41 +0,0 @@ -class BreadcrumbController < InheritedResources::Base -  include Pundit -  include BreadcrumbHelper - -  def show -    show! do -      build_breadcrumb :show -    end -  end - -  def index -    index! do -      build_breadcrumb :index -    end -  end - -  def edit -    edit! do -      build_breadcrumb :edit -    end -  end - -  def update -    update! do |success, failure| -      build_breadcrumb :edit -    end -  end - -  def new -    new! do -      build_breadcrumb :new -    end -  end - -  def create -    create! do |success, failure| -      build_breadcrumb :new -    end -  end - -end diff --git a/app/controllers/calendars_controller.rb b/app/controllers/calendars_controller.rb index 1c342c718..e9ee7579a 100644 --- a/app/controllers/calendars_controller.rb +++ b/app/controllers/calendars_controller.rb @@ -1,4 +1,4 @@ -class CalendarsController < BreadcrumbController +class CalendarsController < InheritedResources::Base    include PolicyChecker    defaults resource_class: Calendar    before_action :ransack_contains_date, only: [:index] @@ -8,16 +8,12 @@ class CalendarsController < BreadcrumbController    def index      index! do        @calendars = ModelDecorator.decorate(@calendars, with: CalendarDecorator) - -      build_breadcrumb :index      end    end    def show      show! do        @calendar = @calendar.decorate - -      build_breadcrumb :show      end    end diff --git a/app/controllers/chouette_controller.rb b/app/controllers/chouette_controller.rb index dc9ab4fa5..1313aa7cc 100644 --- a/app/controllers/chouette_controller.rb +++ b/app/controllers/chouette_controller.rb @@ -1,6 +1,5 @@ -class ChouetteController < BreadcrumbController +class ChouetteController < InheritedResources::Base    include ApplicationHelper -  include BreadcrumbHelper    include ReferentialSupport  end diff --git a/app/controllers/companies_controller.rb b/app/controllers/companies_controller.rb index cf27c39cf..bc5bedd7f 100644 --- a/app/controllers/companies_controller.rb +++ b/app/controllers/companies_controller.rb @@ -1,4 +1,4 @@ -class CompaniesController < BreadcrumbController +class CompaniesController < InheritedResources::Base    include ApplicationHelper    include PolicyChecker    defaults :resource_class => Chouette::Company @@ -22,8 +22,6 @@ class CompaniesController < BreadcrumbController        format.json {          @companies = decorate_companies(@companies)        } - -      build_breadcrumb :index      end    end diff --git a/app/controllers/compliance_check_sets_controller.rb b/app/controllers/compliance_check_sets_controller.rb index fce8dcc56..95dcfbf05 100644 --- a/app/controllers/compliance_check_sets_controller.rb +++ b/app/controllers/compliance_check_sets_controller.rb @@ -1,4 +1,4 @@ -class ComplianceCheckSetsController < BreadcrumbController +class ComplianceCheckSetsController < InheritedResources::Base    defaults resource_class: ComplianceCheckSet    include RansackDateFilter    before_action only: [:index] { set_date_time_params("created_at", DateTime) } @@ -18,4 +18,4 @@ class ComplianceCheckSetsController < BreadcrumbController        }      end    end -end
\ No newline at end of file +end diff --git a/app/controllers/compliance_control_blocks_controller.rb b/app/controllers/compliance_control_blocks_controller.rb index 2dd69a865..996f8a464 100644 --- a/app/controllers/compliance_control_blocks_controller.rb +++ b/app/controllers/compliance_control_blocks_controller.rb @@ -1,4 +1,4 @@ -class ComplianceControlBlocksController < BreadcrumbController +class ComplianceControlBlocksController < InheritedResources::Base    defaults resource_class: ComplianceControlBlock    belongs_to :compliance_control_set    actions :all, :except => [:show, :index] @@ -9,4 +9,4 @@ class ComplianceControlBlocksController < BreadcrumbController      params.require(:compliance_control_block).permit(:transport_mode, :transport_submode)    end -end
\ No newline at end of file +end diff --git a/app/controllers/compliance_control_sets_controller.rb b/app/controllers/compliance_control_sets_controller.rb index e5c2e19dd..570204065 100644 --- a/app/controllers/compliance_control_sets_controller.rb +++ b/app/controllers/compliance_control_sets_controller.rb @@ -1,4 +1,4 @@ -class ComplianceControlSetsController < BreadcrumbController +class ComplianceControlSetsController < InheritedResources::Base    defaults resource_class: ComplianceControlSet    include RansackDateFilter    before_action only: [:index] { set_date_time_params("updated_at", DateTime) } diff --git a/app/controllers/compliance_controls_controller.rb b/app/controllers/compliance_controls_controller.rb index 0a9c7d52b..bd4a33ff4 100644 --- a/app/controllers/compliance_controls_controller.rb +++ b/app/controllers/compliance_controls_controller.rb @@ -1,4 +1,4 @@ -class ComplianceControlsController < BreadcrumbController +class ComplianceControlsController < InheritedResources::Base    defaults resource_class: ComplianceControl    belongs_to :compliance_control_set    actions :all, :except => [:show, :index] diff --git a/app/controllers/concerns/policy_checker.rb b/app/controllers/concerns/policy_checker.rb index 65a4428e2..d84263f2c 100644 --- a/app/controllers/concerns/policy_checker.rb +++ b/app/controllers/concerns/policy_checker.rb @@ -1,4 +1,5 @@  module PolicyChecker +  include Pundit    extend ActiveSupport::Concern    included do diff --git a/app/controllers/connection_links_controller.rb b/app/controllers/connection_links_controller.rb index 403f0ed9e..b56450291 100644 --- a/app/controllers/connection_links_controller.rb +++ b/app/controllers/connection_links_controller.rb @@ -18,23 +18,19 @@ class ConnectionLinksController < ChouetteController          if collection.out_of_bounds?            redirect_to params.merge(:page => 1)          end -        build_breadcrumb :index        }      end    end    def show      @map = ConnectionLinkMap.new(resource).with_helpers(self) -    show! do -        build_breadcrumb :show -    end +    show!    end    def select_areas      @connection_link = connection_link      @departure = connection_link.departure      @arrival = connection_link.arrival -    build_breadcrumb :show    end    protected diff --git a/app/controllers/dashboards_controller.rb b/app/controllers/dashboards_controller.rb index 2585dafca..1c7876c58 100644 --- a/app/controllers/dashboards_controller.rb +++ b/app/controllers/dashboards_controller.rb @@ -3,7 +3,7 @@  # this controller will use a custom partial like  # custom/dashboards/_dashboard.html.slim for Custom::Dashboard  # -class DashboardsController < BreadcrumbController +class DashboardsController < InheritedResources::Base    respond_to :html, only: [:show]    def show diff --git a/app/controllers/exports_controller.rb b/app/controllers/exports_controller.rb index 2cfa0b6fa..ad88c6dae 100644 --- a/app/controllers/exports_controller.rb +++ b/app/controllers/exports_controller.rb @@ -3,16 +3,14 @@ require 'open-uri'  class ExportsController < ChouetteController    defaults :resource_class => Export -   +    respond_to :html, :only => [:show, :index, :destroy, :exported_file]    respond_to :js, :only => [:index]    belongs_to :referential    def index      begin -      index! do  -        build_breadcrumb :index -      end +      index!      rescue Ievkit::Error, Faraday::Error => error        logger.error("Iev failure : #{error.message}")        flash[:error] = t(error.locale_for_error) @@ -22,9 +20,7 @@ class ExportsController < ChouetteController    def show      begin -      show! do  -        build_breadcrumb :show -      end +      show!      rescue Ievkit::Error, Faraday::Error => error        logger.error("Iev failure : #{error.message}")        flash[:error] = t(error.locale_for_error) @@ -32,7 +28,7 @@ class ExportsController < ChouetteController      end    end -  def destroy     +  def destroy      begin        destroy!      rescue Ievkit::Error, Faraday::Error => error @@ -57,11 +53,11 @@ class ExportsController < ChouetteController    end    protected -   +    def export_service      ExportService.new(@referential)    end -   +    def resource      @export ||= export_service.find( params[:id] )      @line_items = @export.report.line_items diff --git a/app/controllers/group_of_lines_controller.rb b/app/controllers/group_of_lines_controller.rb index 5cadd40d3..1a59d39f7 100644 --- a/app/controllers/group_of_lines_controller.rb +++ b/app/controllers/group_of_lines_controller.rb @@ -1,4 +1,4 @@ -class GroupOfLinesController < BreadcrumbController +class GroupOfLinesController < InheritedResources::Base    include ApplicationHelper    include PolicyChecker    defaults :resource_class => Chouette::GroupOfLine @@ -13,9 +13,7 @@ class GroupOfLinesController < BreadcrumbController    def show      @map = GroupOfLineMap.new(resource).with_helpers(self)      @lines = resource.lines.order(:name) -    show! do -      build_breadcrumb :show -    end +    show!    end    def index @@ -24,7 +22,6 @@ class GroupOfLinesController < BreadcrumbController          if collection.out_of_bounds?            redirect_to params.merge(:page => 1)          end -        build_breadcrumb :index        }      end    end diff --git a/app/controllers/import_messages_controller.rb b/app/controllers/import_messages_controller.rb index 4ad398cbb..c3c6b46b5 100644 --- a/app/controllers/import_messages_controller.rb +++ b/app/controllers/import_messages_controller.rb @@ -1,4 +1,4 @@ -class ImportMessagesController < BreadcrumbController +class ImportMessagesController < InheritedResources::Base    defaults resource_class: ImportMessage, collection_name: 'import_messages', instance_name: 'import_message'    respond_to :csv    belongs_to :import, :parent_class => Import do diff --git a/app/controllers/import_resources_controller.rb b/app/controllers/import_resources_controller.rb index ac3dd042e..3e52233f2 100644 --- a/app/controllers/import_resources_controller.rb +++ b/app/controllers/import_resources_controller.rb @@ -1,4 +1,4 @@ -class ImportResourcesController < BreadcrumbController +class ImportResourcesController < InheritedResources::Base    defaults resource_class: ImportResource, collection_name: 'import_resources', instance_name: 'import_resource'    respond_to :html    belongs_to :import @@ -8,8 +8,6 @@ class ImportResourcesController < BreadcrumbController        format.html {          @import_resources = decorate_import_resources(@import_resources)        } - -      build_breadcrumb :index      end    end diff --git a/app/controllers/imports_controller.rb b/app/controllers/imports_controller.rb index 3c52dc935..6c9d81d82 100644 --- a/app/controllers/imports_controller.rb +++ b/app/controllers/imports_controller.rb @@ -1,4 +1,4 @@ -class ImportsController < BreadcrumbController +class ImportsController < InheritedResources::Base    include PolicyChecker    include RansackDateFilter    before_action only: [:index] { set_date_time_params("started_at", DateTime) } @@ -13,8 +13,6 @@ class ImportsController < BreadcrumbController        @import = @import.decorate(context: {          workbench: @workbench        }) - -      build_breadcrumb :show      end    end @@ -24,17 +22,8 @@ class ImportsController < BreadcrumbController          if collection.out_of_bounds?            redirect_to params.merge(:page => 1)          end -          @imports = decorate_imports(@imports)        } - -      build_breadcrumb :index -    end -  end - -  def new -    new! do -      build_breadcrumb :new      end    end diff --git a/app/controllers/journey_patterns_collections_controller.rb b/app/controllers/journey_patterns_collections_controller.rb index e8924b7ad..546158fa8 100644 --- a/app/controllers/journey_patterns_collections_controller.rb +++ b/app/controllers/journey_patterns_collections_controller.rb @@ -45,7 +45,6 @@ class JourneyPatternsCollectionsController < ChouetteController        }      end      @stop_points_list = @stop_points_list.sort_by {|a| a[:position] } -    build_breadcrumb :index    end    def user_permissions diff --git a/app/controllers/journey_patterns_controller.rb b/app/controllers/journey_patterns_controller.rb index f4ae55b4e..a72e7da7f 100644 --- a/app/controllers/journey_patterns_controller.rb +++ b/app/controllers/journey_patterns_controller.rb @@ -30,9 +30,7 @@ class JourneyPatternsController < ChouetteController    def show      @map = JourneyPatternMap.new(journey_pattern).with_helpers(self)      @stop_points = journey_pattern.stop_points.paginate(:page => params[:page]) -    show! do -      build_breadcrumb :show -    end +    show!    end    def new_vehicle_journey diff --git a/app/controllers/line_footnotes_controller.rb b/app/controllers/line_footnotes_controller.rb index 581c921e8..2d4d10064 100644 --- a/app/controllers/line_footnotes_controller.rb +++ b/app/controllers/line_footnotes_controller.rb @@ -5,12 +5,6 @@ class LineFootnotesController < ChouetteController    before_action :authorize_resource, only: [:destroy_footnote, :edit_footnote, :show_footnote, :update_footnote]    before_action :authorize_resource_class, only: [:create_footnote, :index_footnote, :new_footnote] -  def edit -    edit! do -      build_breadcrumb :edit -    end -  end -    def update      update! do |success, failure|        success.html { redirect_to referential_line_footnotes_path(@referential, @line) , notice: t('notice.footnotes.updated') } diff --git a/app/controllers/line_referentials_controller.rb b/app/controllers/line_referentials_controller.rb index fc4ab3cf5..f70ddef41 100644 --- a/app/controllers/line_referentials_controller.rb +++ b/app/controllers/line_referentials_controller.rb @@ -1,4 +1,4 @@ -class LineReferentialsController < BreadcrumbController +class LineReferentialsController < InheritedResources::Base    defaults :resource_class => LineReferential diff --git a/app/controllers/lines_controller.rb b/app/controllers/lines_controller.rb index 4b6448ce8..cf2908500 100644 --- a/app/controllers/lines_controller.rb +++ b/app/controllers/lines_controller.rb @@ -1,4 +1,4 @@ -class LinesController < BreadcrumbController +class LinesController < InheritedResources::Base    include ApplicationHelper    include PolicyChecker    defaults :resource_class => Chouette::Line @@ -26,7 +26,6 @@ class LinesController < BreadcrumbController          if collection.out_of_bounds?            redirect_to params.merge(:page => 1)          end -        build_breadcrumb :index        }      end    end @@ -38,8 +37,6 @@ class LinesController < BreadcrumbController          line_referential: @line_referential,          current_organisation: current_organisation        }) - -      build_breadcrumb :show      end    end diff --git a/app/controllers/networks_controller.rb b/app/controllers/networks_controller.rb index 5dae1ba3f..98c840777 100644 --- a/app/controllers/networks_controller.rb +++ b/app/controllers/networks_controller.rb @@ -1,4 +1,4 @@ -class NetworksController < BreadcrumbController +class NetworksController < InheritedResources::Base    include ApplicationHelper    include PolicyChecker    defaults :resource_class => Chouette::Network @@ -17,8 +17,6 @@ class NetworksController < BreadcrumbController        @network = @network.decorate(context: {          line_referential: line_referential        }) - -      build_breadcrumb :show      end    end @@ -43,8 +41,6 @@ class NetworksController < BreadcrumbController        format.js {          @networks = decorate_networks(@networks)        } - -      build_breadcrumb :index      end    end diff --git a/app/controllers/organisations_controller.rb b/app/controllers/organisations_controller.rb index 51a325586..d80541800 100644 --- a/app/controllers/organisations_controller.rb +++ b/app/controllers/organisations_controller.rb @@ -1,4 +1,4 @@ -class OrganisationsController < BreadcrumbController +class OrganisationsController < InheritedResources::Base    defaults :resource_class => Organisation    respond_to :html, :only => [:edit, :show, :update] @@ -18,6 +18,6 @@ class OrganisationsController < BreadcrumbController    def organisation_params      params.require(:organisation).permit(:name)    end -   +  end diff --git a/app/controllers/referential_companies_controller.rb b/app/controllers/referential_companies_controller.rb index 482f74ea0..fdbd83dc9 100644 --- a/app/controllers/referential_companies_controller.rb +++ b/app/controllers/referential_companies_controller.rb @@ -20,8 +20,6 @@ class ReferentialCompaniesController < ChouetteController        format.js {          @companies = decorate_companies(@companies)        } - -      build_breadcrumb :index      end    end diff --git a/app/controllers/referential_group_of_lines_controller.rb b/app/controllers/referential_group_of_lines_controller.rb index 73520d00a..d88daab84 100644 --- a/app/controllers/referential_group_of_lines_controller.rb +++ b/app/controllers/referential_group_of_lines_controller.rb @@ -12,9 +12,7 @@ class ReferentialGroupOfLinesController < ChouetteController    def show      @map = GroupOfLineMap.new(resource).with_helpers(self)      @lines = resource.lines.order(:name) -    show! do -      build_breadcrumb :show -    end +    show!    end    def index @@ -23,7 +21,6 @@ class ReferentialGroupOfLinesController < ChouetteController          if collection.out_of_bounds?            redirect_to params.merge(:page => 1)          end -        build_breadcrumb :index        }      end    end diff --git a/app/controllers/referential_lines_controller.rb b/app/controllers/referential_lines_controller.rb index ec0bbbb18..b9f8c0050 100644 --- a/app/controllers/referential_lines_controller.rb +++ b/app/controllers/referential_lines_controller.rb @@ -44,8 +44,6 @@ class ReferentialLinesController < ChouetteController            current_organisation: current_organisation          }        ) - -      build_breadcrumb :show      end    end diff --git a/app/controllers/referential_networks_controller.rb b/app/controllers/referential_networks_controller.rb index ee2db8008..2131b8e57 100644 --- a/app/controllers/referential_networks_controller.rb +++ b/app/controllers/referential_networks_controller.rb @@ -18,8 +18,6 @@ class ReferentialNetworksController < ChouetteController            referential: referential          }        ) - -      build_breadcrumb :show      end    end @@ -36,8 +34,6 @@ class ReferentialNetworksController < ChouetteController        format.js {          @networks = decorate_networks(@networks)        } - -      build_breadcrumb :index      end    end diff --git a/app/controllers/referential_stop_areas_controller.rb b/app/controllers/referential_stop_areas_controller.rb index 7519418e7..78dcd6dd9 100644 --- a/app/controllers/referential_stop_areas_controller.rb +++ b/app/controllers/referential_stop_areas_controller.rb @@ -14,31 +14,26 @@ class ReferentialStopAreasController  < ChouetteController    def select_parent      @stop_area = stop_area      @parent = stop_area.parent -    build_breadcrumb :edit    end    def add_children      @stop_area = stop_area      @children = stop_area.children -    build_breadcrumb :edit    end    def add_routing_lines      @stop_area = stop_area      @lines = stop_area.routing_lines -    build_breadcrumb :edit    end    def add_routing_stops      @stop_area = stop_area -    build_breadcrumb :edit    end    def access_links      @stop_area = stop_area      @generic_access_links = stop_area.generic_access_link_matrix      @detail_access_links = stop_area.detail_access_link_matrix -    build_breadcrumb :edit    end    def index @@ -49,7 +44,6 @@ class ReferentialStopAreasController  < ChouetteController          if collection.out_of_bounds?            redirect_to params.merge(:page => 1)          end -        build_breadcrumb :index        }      end    end @@ -57,9 +51,7 @@ class ReferentialStopAreasController  < ChouetteController    def new      @map = StopAreaMap.new( Chouette::StopArea.new).with_helpers(self)      @map.editable = true -    new! do -      build_breadcrumb :show -    end +    new!    end    def create @@ -81,8 +73,6 @@ class ReferentialStopAreasController  < ChouetteController        end        @stop_area = @stop_area.decorate - -      build_breadcrumb :show      end    end @@ -90,7 +80,6 @@ class ReferentialStopAreasController  < ChouetteController      edit! do        stop_area.position ||= stop_area.default_position        map.editable = true -      build_breadcrumb :edit     end    end diff --git a/app/controllers/referentials_controller.rb b/app/controllers/referentials_controller.rb index c8984076a..6b479e938 100644 --- a/app/controllers/referentials_controller.rb +++ b/app/controllers/referentials_controller.rb @@ -1,4 +1,4 @@ -class ReferentialsController < BreadcrumbController +class ReferentialsController < InheritedResources::Base    defaults :resource_class => Referential    include PolicyChecker @@ -18,8 +18,6 @@ class ReferentialsController < BreadcrumbController        if !!@referential.created_from_id          format.html { redirect_to workbench_path(@referential.workbench) } -      else -        build_breadcrumb :new        end      end    end @@ -45,7 +43,6 @@ class ReferentialsController < BreadcrumbController                 :time_tables_count => resource.time_tables.count,                 :referential_id => resource.id}        } -      format.html { build_breadcrumb :show}      end    end diff --git a/app/controllers/route_sections_controller.rb b/app/controllers/route_sections_controller.rb index c1aaf732e..03d6cf176 100644 --- a/app/controllers/route_sections_controller.rb +++ b/app/controllers/route_sections_controller.rb @@ -8,14 +8,9 @@ class RouteSectionsController < ChouetteController    belongs_to :referential    before_action :save_return_to_path, only: [:edit, :create_to_edit] -  before_action ->(controller) { build_breadcrumb controller.action_name }    helper_method :search -  def index -    index! -  end -    def new      @stop_areas = referential.stop_areas.with_geometry.order :name      new! diff --git a/app/controllers/routes_controller.rb b/app/controllers/routes_controller.rb index 78daffb30..93f30f4d5 100644 --- a/app/controllers/routes_controller.rb +++ b/app/controllers/routes_controller.rb @@ -19,7 +19,6 @@ class RoutesController < ChouetteController    def edit_boarding_alighting      @route = route -    build_breadcrumb :edit    end    def save_boarding_alighting @@ -51,8 +50,6 @@ class RoutesController < ChouetteController          @route_sp,          with: StopPointDecorator        ) - -      build_breadcrumb :show      end    end diff --git a/app/controllers/routing_constraint_zones_controller.rb b/app/controllers/routing_constraint_zones_controller.rb index 78cd0e209..6c3da5980 100644 --- a/app/controllers/routing_constraint_zones_controller.rb +++ b/app/controllers/routing_constraint_zones_controller.rb @@ -20,8 +20,6 @@ class RoutingConstraintZonesController < ChouetteController            line: parent          }        ) - -      build_breadcrumb :index      end    end @@ -31,8 +29,6 @@ class RoutingConstraintZonesController < ChouetteController          referential: referential,          line: parent        }) - -      build_breadcrumb :show      end    end diff --git a/app/controllers/rule_parameter_sets_controller.rb b/app/controllers/rule_parameter_sets_controller.rb index 6a23407d0..de4863a08 100644 --- a/app/controllers/rule_parameter_sets_controller.rb +++ b/app/controllers/rule_parameter_sets_controller.rb @@ -1,15 +1,13 @@ -class RuleParameterSetsController < BreadcrumbController +class RuleParameterSetsController < InheritedResources::Base    defaults :resource_class => RuleParameterSet    respond_to :html    respond_to :js, :only => [ :mode ]    def new      @rule_parameter_set = RuleParameterSet.default( current_organisation) -    new! do -      build_breadcrumb :new -    end +    new!    end -   +    def destroy      if current_organisation.rule_parameter_sets.count == 1        flash[:alert] = t('rule_parameter_sets.destroy.last_rps_protected') diff --git a/app/controllers/stop_area_referentials_controller.rb b/app/controllers/stop_area_referentials_controller.rb index 5c87be43d..e2815e5fb 100644 --- a/app/controllers/stop_area_referentials_controller.rb +++ b/app/controllers/stop_area_referentials_controller.rb @@ -1,4 +1,4 @@ -class StopAreaReferentialsController < BreadcrumbController +class StopAreaReferentialsController < InheritedResources::Base    defaults :resource_class => StopAreaReferential    def sync diff --git a/app/controllers/stop_areas_controller.rb b/app/controllers/stop_areas_controller.rb index cdb7c59ab..0c9f3067a 100644 --- a/app/controllers/stop_areas_controller.rb +++ b/app/controllers/stop_areas_controller.rb @@ -1,5 +1,5 @@  # -*- coding: utf-8 -*- -class StopAreasController < BreadcrumbController +class StopAreasController < InheritedResources::Base    include ApplicationHelper    defaults :resource_class => Chouette::StopArea @@ -22,32 +22,27 @@ class StopAreasController < BreadcrumbController    def select_parent      @stop_area = stop_area      @parent = stop_area.parent -    build_breadcrumb :edit    end    def add_children      authorize stop_area      @stop_area = stop_area      @children = stop_area.children -    build_breadcrumb :edit    end    def add_routing_lines      @stop_area = stop_area      @lines = stop_area.routing_lines -    build_breadcrumb :edit    end    def add_routing_stops      @stop_area = stop_area -    build_breadcrumb :edit    end    def access_links      @stop_area = stop_area      @generic_access_links = stop_area.generic_access_link_matrix      @detail_access_links = stop_area.detail_access_link_matrix -    build_breadcrumb :edit    end    def index @@ -64,8 +59,6 @@ class StopAreasController < BreadcrumbController            @stop_areas,            with: StopAreaDecorator          ) - -        build_breadcrumb :index        }      end    end @@ -74,9 +67,7 @@ class StopAreasController < BreadcrumbController      authorize resource_class      @map = StopAreaMap.new( Chouette::StopArea.new).with_helpers(self)      @map.editable = true -    new! do -      build_breadcrumb :show -    end +    new!    end    def create @@ -99,8 +90,6 @@ class StopAreasController < BreadcrumbController        end        @stop_area = @stop_area.decorate - -      build_breadcrumb :show      end    end @@ -109,7 +98,6 @@ class StopAreasController < BreadcrumbController      edit! do        stop_area.position ||= stop_area.default_position        map.editable = true -      build_breadcrumb :edit     end    end diff --git a/app/controllers/time_tables_controller.rb b/app/controllers/time_tables_controller.rb index af74f635f..0c1769ad7 100644 --- a/app/controllers/time_tables_controller.rb +++ b/app/controllers/time_tables_controller.rb @@ -19,7 +19,6 @@ class TimeTablesController < ChouetteController        @time_table = @time_table.decorate(context: {          referential: @referential        }) -      build_breadcrumb :show      end    end @@ -30,9 +29,7 @@ class TimeTablesController < ChouetteController    def new      @autocomplete_items = ActsAsTaggableOn::Tag.all -    new! do -      build_breadcrumb :new -    end +    new!    end    def create @@ -66,7 +63,6 @@ class TimeTablesController < ChouetteController    def edit      edit! do -      build_breadcrumb :edit        @autocomplete_items = ActsAsTaggableOn::Tag.all      end    end @@ -89,8 +85,6 @@ class TimeTablesController < ChouetteController          end          @time_tables = decorate_time_tables(@time_tables) - -        build_breadcrumb :index        }        format.js { @@ -101,8 +95,6 @@ class TimeTablesController < ChouetteController    def duplicate      @time_table = Chouette::TimeTable.find params[:id] -    # prepare breadcrumb before prepare data for new timetable -    build_breadcrumb :edit      @time_table = @time_table.duplicate      render :new    end 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/controllers/users_controller.rb b/app/controllers/users_controller.rb index 23ce3ef0a..2452a2796 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,4 +1,4 @@ -class UsersController < BreadcrumbController +class UsersController < InheritedResources::Base    defaults :resource_class => User diff --git a/app/controllers/vehicle_journey_imports_controller.rb b/app/controllers/vehicle_journey_imports_controller.rb index 2e2a3a718..58f8816aa 100644 --- a/app/controllers/vehicle_journey_imports_controller.rb +++ b/app/controllers/vehicle_journey_imports_controller.rb @@ -12,9 +12,7 @@ class VehicleJourneyImportsController < ChouetteController    def new      @vehicle_journey_import = VehicleJourneyImport.new(:route => route) -    new! do -      build_breadcrumb :new -    end +    new!    end    def create diff --git a/app/controllers/vehicle_journeys_controller.rb b/app/controllers/vehicle_journeys_controller.rb index 70cca15ed..050f2f219 100644 --- a/app/controllers/vehicle_journeys_controller.rb +++ b/app/controllers/vehicle_journeys_controller.rb @@ -76,7 +76,6 @@ class VehicleJourneysController < ChouetteController        if collection.out_of_bounds?          redirect_to params.merge(:page => 1)        end -      build_breadcrumb :index      end    end diff --git a/app/controllers/workbenches_controller.rb b/app/controllers/workbenches_controller.rb index e271007d6..9b4f0d6c4 100644 --- a/app/controllers/workbenches_controller.rb +++ b/app/controllers/workbenches_controller.rb @@ -1,4 +1,4 @@ -class WorkbenchesController < BreadcrumbController +class WorkbenchesController < InheritedResources::Base    before_action :query_params, only: [:show]    include RansackDateFilter    before_action only: [:show] { set_date_time_params("validity_period", Date) } @@ -25,9 +25,7 @@ class WorkbenchesController < BreadcrumbController          current_workbench_id: params[:id]        }      ) -    show! do -      build_breadcrumb :show -    end +    show!    end    def delete_referentials diff --git a/app/helpers/breadcrumb_helper.rb b/app/helpers/breadcrumb_helper.rb deleted file mode 100644 index da1f270ab..000000000 --- a/app/helpers/breadcrumb_helper.rb +++ /dev/null @@ -1,310 +0,0 @@ -# coding: utf-8 -module BreadcrumbHelper - -  def build_breadcrumb(action) -    action = action.to_sym -    case resource_class.to_s -    when "Chouette::Network" -      network_breadcrumb action -    when "Chouette::Company" -      company_breadcrumb action -    when "Chouette::GroupOfLine" -      group_of_line_breadcrumb action -    when "Chouette::Line" -      line_breadcrumb action -    when "Chouette::Route" -      route_breadcrumb action -    when "Chouette::JourneyPattern" -      journey_pattern_breadcrumb action -    when "Chouette::VehicleJourney" -      vehicle_journey_breadcrumb action -    when "Chouette::VehicleJourneyFrequency" -      vehicle_journey_frequency_breadcrumb action -    when "VehicleJourneyImport" -      vehicle_journey_import_breadcrumb action -    when "Chouette::StopArea" -      stop_area_breadcrumb action -    when "Chouette::AccessPoint" -      access_point_breadcrumb action -    when "Chouette::AccessLink" -      access_link_breadcrumb action -    when "Chouette::ConnectionLink" -      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 'Chouette::RoutingConstraintZone' -      routing_constraint_zone_breadcrumb action -    when 'Calendar' -      calendar_breadcrumb action -    when "StopAreaCopy" -      stop_area_copy_breadcrumb action -    when "Import" -      import_breadcrumb action -    when "Export" -      export_breadcrumb action -    when "ComplianceCheck" -      compliance_check_breadcrumb action -    when "ComplianceCheckTask" -      compliance_check_task_breadcrumb action -    when "ComplianceControlSets" -      compliance_control_sets_breadcrumb action -    when "RuleParameterSet" -      rule_parameter_breadcrumb action -    when "User" -      user_breadcrumb action -    when "Referential" -      referential_breadcrumb action -    when "LineReferential" -      line_referential_breadcrumb action -    when "Organisation" -      organisation_breadcrumb action -    when "Api::V1::ApiKey" -      referential_breadcrumb -    when "Workbench" -      workbench_breadcrumb action -    else -      Rails.logger.info "---------" -      Rails.logger.info ">>>>>>> "+resource_class.to_s+" unmapped" -      Rails.logger.info "---------" -      organisation_breadcrumb :index -    end -  end - -  def calendar_breadcrumb(action) -    add_breadcrumb I18n.t('breadcrumbs.root'), root_path -    add_breadcrumb I18n.t('calendars.index.title'), calendars_path -    add_breadcrumb @calendar.name if %i(show edit).include? action -  end - -  def workbench_breadcrumb(action) -    add_breadcrumb I18n.t("breadcrumbs.root"), root_path -    add_breadcrumb breadcrumb_label(@workbench), workbench_path(@workbench), :title => breadcrumb_tooltip(@workbench) -  end - -  def network_breadcrumb(action) -    if @line_referential -      line_referential_breadcrumb -      add_breadcrumb Chouette::Network.model_name.human(:count => 2).capitalize, line_referential_networks_path(@line_referential) unless action == :index -      add_breadcrumb breadcrumb_label(@network), line_referential_network_path(@line_referential, @network),:title => breadcrumb_tooltip(@network) if action == :edit -    else -      referential_breadcrumb -      add_breadcrumb Chouette::Network.model_name.human(:count => 2).capitalize, referential_networks_path(@referential) unless action == :index -      add_breadcrumb breadcrumb_label(@network), referential_network_path(@referential, @network),:title => breadcrumb_tooltip(@network) if action == :edit -    end -  end - -  def group_of_line_breadcrumb(action) -    if @line_referential -      line_referential_breadcrumb -      add_breadcrumb Chouette::GroupOfLine.model_name.human(:count => 2).capitalize, line_referential_group_of_lines_path(@line_referential) unless action == :index -      add_breadcrumb breadcrumb_label(@group_of_line), line_referential_group_of_line_path(@line_referential, @group_of_line),:title => breadcrumb_tooltip(@group_of_line) if action == :edit -    else -      referential_breadcrumb -      add_breadcrumb Chouette::GroupOfLine.model_name.human(:count => 2).capitalize, referential_group_of_lines_path(@referential) unless action == :index -      add_breadcrumb breadcrumb_label(@group_of_line), referential_group_of_line_path(@referential, @group_of_line),:title => breadcrumb_tooltip(@group_of_line) if action == :edit -    end -  end - -  def stop_area_breadcrumb(action) -    referential_breadcrumb -    add_breadcrumb Chouette::StopArea.model_name.human(:count => 2).capitalize, stop_area_referential_stop_areas_path(@stop_area.stop_area_referential) unless action == :index -    add_breadcrumb breadcrumb_label(@stop_area), stop_area_referential_stop_area_path(@stop_area.stop_area_referential, @stop_area),:title => breadcrumb_tooltip(@stop_area) if action == :edit -  end - -  def stop_area_copy_breadcrumb(action) -    stop_area_breadcrumb :edit -  end - -  def access_point_breadcrumb(action) -    stop_area_breadcrumb :edit -    add_breadcrumb breadcrumb_label(@access_point), referential_stop_area_access_point_path(@referential, @access_point.stop_area,@access_point),:title => breadcrumb_tooltip(@access_point) if action == :edit -  end - -  def access_link_breadcrumb(action) -    access_point_breadcrumb :edit -    add_breadcrumb Chouette::AccessLink.model_name.human(:count => 2).capitalize.capitalize, access_links_referential_stop_area_path(@referential, @stop_area) -    add_breadcrumb breadcrumb_label(@access_link), referential_access_point_access_link_path(@referential, @access_point,@access_link),:title => breadcrumb_tooltip(@access_link) if action == :edit -  end - -  def connection_link_breadcrumb(action) -    referential_breadcrumb -    add_breadcrumb Chouette::ConnectionLink.model_name.human.pluralize.capitalize, referential_connection_links_path(@referential) unless action == :index -    add_breadcrumb breadcrumb_label(@connection_link), referential_connection_link_path(@referential, @connection_link),:title => breadcrumb_tooltip(@connection_link) if action == :edit -  end - -  def time_table_breadcrumb(action) -    referential_breadcrumb -    add_breadcrumb Chouette::TimeTable.model_name.human(:count => 2).capitalize, referential_time_tables_path(@referential) unless action == :index -    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).capitalize, referential_timebands_path(@referential) unless action == :index -    add_breadcrumb breadcrumb_label(@timeband), referential_timeband_path(@referential, @timeband),:title => breadcrumb_tooltip(@timeband) if action == :edit -  end - -  def line_breadcrumb(action) -    if @line_referential -      line_referential_breadcrumb -      add_breadcrumb Chouette::Line.model_name.human(:count => 2).capitalize, line_referential_lines_path(@line_referential) unless action == :index -      add_breadcrumb breadcrumb_label(@line), line_referential_line_path(@line_referential, @line),:title => breadcrumb_tooltip(@line) if action == :edit -    else -      referential_breadcrumb -      add_breadcrumb breadcrumb_label(@line), referential_line_path(@referential, @line),:title => breadcrumb_tooltip(@line) if action == :edit -    end -  end - -  def route_breadcrumb(action) -    line_breadcrumb :edit -    add_breadcrumb breadcrumb_label(@route), referential_line_route_path(@referential, @line,@route),:title => breadcrumb_tooltip(@route) if action == :edit -  end - -  def routing_constraint_zone_breadcrumb(action) -    line_breadcrumb :edit -    add_breadcrumb Chouette::RoutingConstraintZone.model_name.human.pluralize(:fr), referential_line_routing_constraint_zones_path(@referential, @line) unless action == :index -    add_breadcrumb breadcrumb_label(@routing_constraint_zone), referential_line_routing_constraint_zone_path(@referential, @line, @routing_constraint_zone), title: breadcrumb_tooltip(@routing_constraint_zone) if %i(show edit).include? action -  end - -  def journey_pattern_breadcrumb(action) -    route_breadcrumb :edit -    add_breadcrumb breadcrumb_label(@journey_pattern), referential_line_route_journey_pattern_path(@referential, @line,@route,@journey_pattern),:title => breadcrumb_tooltip(@journey_pattern) if action == :edit -  end - -  def vehicle_journey_breadcrumb(action) -    route_breadcrumb :edit -    add_breadcrumb I18n.t("breadcrumbs.vehicle_journeys"), referential_line_route_vehicle_journeys_path(@referential, @line,@route) unless action == :index -    add_breadcrumb breadcrumb_label(@vehicle_journey), referential_line_route_vehicle_journey_path(@referential, @line,@route,@vehicle_journey),:title => breadcrumb_tooltip(@vehicle_journey) if action == :edit -  end - -   def vehicle_journey_frequency_breadcrumb(action) -     route_breadcrumb :edit -     add_breadcrumb I18n.t("breadcrumbs.vehicle_journey_frequencies"), referential_line_route_vehicle_journey_frequencies_path(@referential, @line, @route) unless action == :index -     add_breadcrumb breadcrumb_label(@vehicle_journey_frequency), referential_line_route_vehicle_journey_frequency_path(@referential, @line,@route, @vehicle_journey_frequency),:title => breadcrumb_tooltip(@vehicle_journey_frequency) if action == :edit -   end - -  def vehicle_journey_import_breadcrumb (action) -    route_breadcrumb :edit -  end - -  def line_referential_breadcrumb(action = :edit) -    organisation_breadcrumb -    if @line_referential -      add_breadcrumb breadcrumb_label(@line_referential), line_referential_path(@line_referential), :title => breadcrumb_tooltip(@line_referential) if action == :edit || action == :show || action == :update -    end -  end - -  def company_breadcrumb (action) -    if @line_referential -      line_referential_breadcrumb -      add_breadcrumb Chouette::Company.model_name.human(:count => 2).capitalize, line_referential_companies_path(@line_referential) unless action == :index -      add_breadcrumb breadcrumb_label(@company), line_referential_company_path(@line_referential, @company),:title => breadcrumb_tooltip(@company) if action == :edit -    else -      referential_breadcrumb -      add_breadcrumb Chouette::Company.model_name.human(:count => 2).capitalize, referential_companies_path(@referential) unless action == :index -      add_breadcrumb breadcrumb_label(@company), referential_company_path(@referential, @company),:title => breadcrumb_tooltip(@company) if action == :edit -    end -  end - -  def import_breadcrumb (action) -    add_breadcrumb I18n.t("breadcrumbs.root"), root_path -    add_breadcrumb breadcrumb_label(@workbench), workbench_path(@workbench), :title => breadcrumb_tooltip(@workbench) -    add_breadcrumb I18n.t("breadcrumbs.imports"), workbench_imports_path(@workbench) - -  end - -  def export_breadcrumb (action) -    referential_breadcrumb -    add_breadcrumb Referential.human_attribute_name("exports"), referential_exports_path(@referential) unless action == :index -  end - -  def compliance_check_breadcrumb (action) -    referential_breadcrumb -    add_breadcrumb Referential.human_attribute_name("compliance_checks"), referential_compliance_checks_path(@referential) unless action == :index -    add_breadcrumb @compliance_check.name, referential_compliance_check_path(@referential, @compliance_check.id) if @compliance_check -    add_breadcrumb t("compliance_checks.rule_parameter_set"), rule_parameter_set_referential_compliance_check_path(@referential, @rule_parameter_set.compliance_check.id) if action == :rule_parameter_set -  end - -  def compliance_check_task_breadcrumb (action) -    referential_breadcrumb -    add_breadcrumb Referential.human_attribute_name("compliance_check_tasks"), referential_compliance_check_tasks_path(@referential) unless action == :index -    add_breadcrumb breadcrumb_label(@compliance_check_task), referential_compliance_check_task_path(@referential, @compliance_check_task),:title => breadcrumb_tooltip(@compliance_check_task) if action == :edit -  end - -  def compliance_control_sets_breadcrumb (action) -    add_breadcrumb I18n.t("breadcrumbs.root"), root_path -    #add_breadcrumb breadcrumb_label(@workbench), workbench_path(@workbench), :title => breadcrumb_tooltip(@workbench) -  end - -  def rule_parameter_breadcrumb (action) -    organisation_breadcrumb -    add_breadcrumb Referential.human_attribute_name("rule_parameter_sets"), organisation_path unless action == :index -    add_breadcrumb breadcrumb_label(@rule_parameter_set), organisation_rule_parameter_set_path(@rule_parameter_set),:title => breadcrumb_tooltip(@rule_parameter_set) if action == :edit -  end - -  def referential_breadcrumb (action = :edit) -    organisation_breadcrumb -    if @referential -      if workbench = @referential.workbench -        add_breadcrumb breadcrumb_label(workbench), workbench_path(workbench), :title => breadcrumb_tooltip(workbench) -      end - -      add_breadcrumb breadcrumb_label(@referential), referential_path(@referential),:title => breadcrumb_tooltip(@referential) if action == :edit || action == :show || action == :update -    end -  end - -  def organisation_breadcrumb (action = :index) -    add_breadcrumb I18n.t("breadcrumbs.root"), root_path -    add_breadcrumb breadcrumb_label(@organisation), organisation_path,:title => breadcrumb_tooltip(@organisation) unless action == :index -  end - -  def user_breadcrumb (action) -    organisation_breadcrumb -    add_breadcrumb I18n.t("breadcrumbs.users"), organisation_path unless action == :index -    add_breadcrumb breadcrumb_label(@user), organisation_user_path(@user),:title => breadcrumb_tooltip(@user) if action == :edit -  end - -  def breadcrumb_label(obj) -    label = breadcrumb_name(obj) -    if label.blank? -      label = obj.class.model_name.human+" "+obj.id.to_s -    end - -    if label.length > 20 -      label[0..16]+"..." -    else -      label -    end -  end - -  def breadcrumb_tooltip(obj) -    label = breadcrumb_name(obj) -    if label.blank? -      label = obj.class.model_name.human+" ("+obj.id.to_s+")" -    else -      label = obj.class.model_name.human+" : "+label -    end -    label -  end - -  def breadcrumb_name(obj) -    label = "" -    if obj.respond_to?('name') -      label = obj.name -    elsif obj.respond_to?('comment') -      label = obj.comment -    end -    label -  end - -end diff --git a/app/views/calendars/edit.html.slim b/app/views/calendars/edit.html.slim index 426f27881..3463bd05c 100644 --- a/app/views/calendars/edit.html.slim +++ b/app/views/calendars/edit.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :calendar, @calendar  / PageHeader  = pageheader 'modele-calendrier',               t('.title', calendar: @calendar.name), diff --git a/app/views/calendars/index.html.slim b/app/views/calendars/index.html.slim index d3168fa3d..a95d54428 100644 --- a/app/views/calendars/index.html.slim +++ b/app/views/calendars/index.html.slim @@ -1,5 +1,5 @@ +- breadcrumb :calendars  / PageHeader -  - header_params = ['modele-calendrier',                     t('.title'),                     ''] diff --git a/app/views/calendars/new.html.slim b/app/views/calendars/new.html.slim index 2cb6f8061..146173d35 100644 --- a/app/views/calendars/new.html.slim +++ b/app/views/calendars/new.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :calendars  / PageHeader  = pageheader 'modele-calendrier',               t('.title'), diff --git a/app/views/calendars/show.html.slim b/app/views/calendars/show.html.slim index eda4ef97c..b2ace0ccc 100644 --- a/app/views/calendars/show.html.slim +++ b/app/views/calendars/show.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :calendar, @calendar  / PageHeader  = pageheader 'modele-calendrier',               @calendar.name, diff --git a/app/views/companies/index.html.slim b/app/views/companies/index.html.slim index dad905c60..ba061f505 100644 --- a/app/views/companies/index.html.slim +++ b/app/views/companies/index.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :companies, @line_referential  / PageHeader  = pageheader 'transporteur',               t('companies.index.title'), diff --git a/app/views/companies/show.html.slim b/app/views/companies/show.html.slim index 4fb437115..668226938 100644 --- a/app/views/companies/show.html.slim +++ b/app/views/companies/show.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :company, @company  / PageHeader  = pageheader 'transporteur',               @company.name, diff --git a/app/views/compliance_check_sets/index.html.slim b/app/views/compliance_check_sets/index.html.slim index 38c4babcf..4ca5a2ee7 100644 --- a/app/views/compliance_check_sets/index.html.slim +++ b/app/views/compliance_check_sets/index.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :compliance_check_sets, @workbench  / PageHeader  - header_params = ['jeux-de-donnees',          t('compliance_check_sets.index.title'), diff --git a/app/views/compliance_check_sets/show.html.slim b/app/views/compliance_check_sets/show.html.slim index 4e965947d..eefa5363f 100644 --- a/app/views/compliance_check_sets/show.html.slim +++ b/app/views/compliance_check_sets/show.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :compliance_check_set, @workbench, @compliance_check_set  / PageHeader  = pageheader 'jeux-de-donnees',                @compliance_check_set.referential.name @@ -8,4 +9,4 @@        .col-lg-6.col-md-6.col-sm-12.col-xs-12          = definition_list t('metadatas'),              ComplianceCheckSet.human_attribute_name(:id) => @compliance_check_set.referential.id, -            ComplianceCheckSet.human_attribute_name(:name) => @compliance_check_set.referential.name
\ No newline at end of file +            ComplianceCheckSet.human_attribute_name(:name) => @compliance_check_set.referential.name diff --git a/app/views/compliance_control_sets/edit.html.slim b/app/views/compliance_control_sets/edit.html.slim index 649154b91..dbe537c93 100644 --- a/app/views/compliance_control_sets/edit.html.slim +++ b/app/views/compliance_control_sets/edit.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :compliance_control_set, @compliance_control_set  / PageHeader  = pageheader 'jeux-de-controle',               t('compliance_control_sets.edit.title', name: @compliance_control_set.name) diff --git a/app/views/compliance_control_sets/index.html.slim b/app/views/compliance_control_sets/index.html.slim index 1120ed186..02d40c813 100644 --- a/app/views/compliance_control_sets/index.html.slim +++ b/app/views/compliance_control_sets/index.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :compliance_control_sets  / PageHeader  - header_params = ['jeux-de-controle',          t('compliance_control_sets.index.title'), @@ -53,4 +54,4 @@            = replacement_msg t('compliance_control_sets.search_no_results') -= javascript_pack_tag 'date_filters'
\ No newline at end of file += javascript_pack_tag 'date_filters' diff --git a/app/views/compliance_control_sets/new.html.slim b/app/views/compliance_control_sets/new.html.slim index 35654b4d6..d543a6395 100644 --- a/app/views/compliance_control_sets/new.html.slim +++ b/app/views/compliance_control_sets/new.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :compliance_control_sets  / PageHeader  = pageheader 'jeux-de-controle',          t('compliance_control_sets.index.new') diff --git a/app/views/compliance_control_sets/show.html.slim b/app/views/compliance_control_sets/show.html.slim index f45b0227a..cf236feb8 100644 --- a/app/views/compliance_control_sets/show.html.slim +++ b/app/views/compliance_control_sets/show.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :compliance_control_set, @compliance_control_set  / PageHeader  = pageheader 'jeux-de-controle',                t('compliance_control_sets.show.title', name: @compliance_control_set.name), diff --git a/app/views/compliance_controls/new.html.slim b/app/views/compliance_controls/new.html.slim index 181f49a15..fe32e14ee 100644 --- a/app/views/compliance_controls/new.html.slim +++ b/app/views/compliance_controls/new.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :compliance_control_set, parent  / PageHeader  - header_params = ['jeux-de-controle',          t('compliance_controls.new.title'), diff --git a/app/views/compliance_controls/select_type.html.slim b/app/views/compliance_controls/select_type.html.slim index 98cc5a943..ec1c360cb 100644 --- a/app/views/compliance_controls/select_type.html.slim +++ b/app/views/compliance_controls/select_type.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :compliance_control_set, parent  / PageHeader  - header_params = ['jeux-de-controle',          t('compliance_controls.select_type.title'), diff --git a/app/views/compliance_controls/show.html.slim b/app/views/compliance_controls/show.html.slim index 12a28cd4b..44d52a9f1 100644 --- a/app/views/compliance_controls/show.html.slim +++ b/app/views/compliance_controls/show.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :compliance_control, @compliance_control  / PageHeader  = pageheader 'jeux-de-controle',          t('compliance_controls.show.title'), diff --git a/app/views/group_of_lines/edit.html.slim b/app/views/group_of_lines/edit.html.slim index 75d530b08..ef7a405d3 100644 --- a/app/views/group_of_lines/edit.html.slim +++ b/app/views/group_of_lines/edit.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :group_of_line, @group_of_line  = title_tag t('group_of_lines.edit.title', :group_of_line => @group_of_line.name) -= render 'form'
\ No newline at end of file += render 'form' diff --git a/app/views/group_of_lines/index.html.slim b/app/views/group_of_lines/index.html.slim index 69b1cd0d6..28f3ab264 100644 --- a/app/views/group_of_lines/index.html.slim +++ b/app/views/group_of_lines/index.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :group_of_lines, @line_referential  = title_tag t('group_of_lines.index.title')  = search_form_for @q, :url => line_referential_group_of_lines_path(@line_referential), remote: true, :html => {:method => :get, class: "form-inline", :id => "search", role: "form"} do |f| diff --git a/app/views/group_of_lines/new.html.slim b/app/views/group_of_lines/new.html.slim index 36b5d6b4e..395c2b3e7 100644 --- a/app/views/group_of_lines/new.html.slim +++ b/app/views/group_of_lines/new.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :group_of_lines, @line_referential  = title_tag t('group_of_lines.new.title') -== render 'form'
\ No newline at end of file +== render 'form' diff --git a/app/views/group_of_lines/show.html.slim b/app/views/group_of_lines/show.html.slim index b934cb1ef..de215bfa0 100644 --- a/app/views/group_of_lines/show.html.slim +++ b/app/views/group_of_lines/show.html.slim @@ -1,3 +1,5 @@ +- breadcrumb :group_of_line, @group_of_line +  = title_tag t('group_of_lines.show.title', :group_of_line => @group_of_line.name )  .group_of_line_show diff --git a/app/views/imports/index.html.slim b/app/views/imports/index.html.slim index cd236ef36..35cd666b1 100644 --- a/app/views/imports/index.html.slim +++ b/app/views/imports/index.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :imports, @workbench  / PageHeader  = pageheader 'importer',               t('.title'), diff --git a/app/views/imports/new.html.slim b/app/views/imports/new.html.slim index 5d5df0857..b74d8eaf2 100644 --- a/app/views/imports/new.html.slim +++ b/app/views/imports/new.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :imports, @workbench  / PageHeader  = pageheader 'importer',                t('.title') diff --git a/app/views/imports/show.html.slim b/app/views/imports/show.html.slim index 5f5974d69..69ee44f9f 100644 --- a/app/views/imports/show.html.slim +++ b/app/views/imports/show.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :import, @workbench, @import  / PageHeader  = pageheader 'importer',               @import.name, diff --git a/app/views/journey_patterns_collections/show.html.slim b/app/views/journey_patterns_collections/show.html.slim index 8c0950536..7c62b69ee 100644 --- a/app/views/journey_patterns_collections/show.html.slim +++ b/app/views/journey_patterns_collections/show.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :journey_patterns, @referential, @route  / pageheader  = pageheader 'mission',               "Missions de #{@route.try(:stop_points).first.try(:stop_area).name} vers #{@route.try(:stop_points).last.try(:stop_area).name}", @@ -5,8 +6,8 @@               ''  - @journey_patterns.each do |jp|    - jp.errors.each do |error_message| -    = error_message    -     +    = error_message +  / PageContent  .page_content    .container-fluid diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim index 1bc9de136..8c731007d 100644 --- a/app/views/layouts/application.html.slim +++ b/app/views/layouts/application.html.slim @@ -13,15 +13,10 @@ html lang=I18n.locale      = javascript_pack_tag 'application'      = javascript_include_tag 'application' -     -    body      = render 'layouts/navigation/main_nav' -          = render 'layouts/flash_messages', flash: flash -          = yield -      #sidebar        = yield :sidebar diff --git a/app/views/layouts/navigation/_breadcrumb.html.slim b/app/views/layouts/navigation/_breadcrumb.html.slim index a101098fe..403ed6702 100644 --- a/app/views/layouts/navigation/_breadcrumb.html.slim +++ b/app/views/layouts/navigation/_breadcrumb.html.slim @@ -1,2 +1 @@ -- if @breadcrumbs.present? -  = render_breadcrumbs builder: BootstrapBreadcrumbsBuilder, tag: :li, separator: '' +== breadcrumbs diff --git a/app/views/line_footnotes/show.html.slim b/app/views/line_footnotes/show.html.slim index 8138c1383..0ed1d2958 100644 --- a/app/views/line_footnotes/show.html.slim +++ b/app/views/line_footnotes/show.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :line_footnotes, @referential, @line  / PageHeader  = pageheader 'ligne',               "Notes sur la ligne #{@line.name}", @@ -22,4 +23,4 @@        - else          = replacement_msg 'Aucune note ne correspond à votre recherche' -       + diff --git a/app/views/line_referentials/show.html.slim b/app/views/line_referentials/show.html.slim index d2527f360..b98e9d5bb 100644 --- a/app/views/line_referentials/show.html.slim +++ b/app/views/line_referentials/show.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :line_referential, @line_referential  / PageHeader  = pageheader 'synchro-ilico',               t('.title'), diff --git a/app/views/lines/index.html.slim b/app/views/lines/index.html.slim index 87c3a69e7..7e3e1cc85 100644 --- a/app/views/lines/index.html.slim +++ b/app/views/lines/index.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :lines, @line_referential  / PageHeader  = pageheader 'ligne',               t('lines.index.title'), diff --git a/app/views/lines/new.html.slim b/app/views/lines/new.html.slim index 56da24d7c..f09a4b4aa 100644 --- a/app/views/lines/new.html.slim +++ b/app/views/lines/new.html.slim @@ -1,3 +1,5 @@ +- breadcrumb :lines, @line_referential +  = title_tag t('lines.new.title') -= render 'form'
\ No newline at end of file += render 'form' diff --git a/app/views/lines/show.html.slim b/app/views/lines/show.html.slim index b16b6472a..d8f236ecc 100644 --- a/app/views/lines/show.html.slim +++ b/app/views/lines/show.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :line, @line  / PageHeader  = pageheader 'ligne',               @line.name, diff --git a/app/views/networks/edit.html.slim b/app/views/networks/edit.html.slim index d4e088937..2d511e15d 100644 --- a/app/views/networks/edit.html.slim +++ b/app/views/networks/edit.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :network, @network  = title_tag t('networks.edit.title', network: @network.name) -= render 'form'
\ No newline at end of file += render 'form' diff --git a/app/views/networks/index.html.slim b/app/views/networks/index.html.slim index 235bdebda..e498ea35f 100644 --- a/app/views/networks/index.html.slim +++ b/app/views/networks/index.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :networks, @line_referential  / PageHeader  = pageheader 'reseau',               t('networks.index.title'), diff --git a/app/views/networks/new.html.slim b/app/views/networks/new.html.slim index 7071ded33..cf04ab03f 100644 --- a/app/views/networks/new.html.slim +++ b/app/views/networks/new.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :networks, @line_referential  = title_tag t('networks.new.title') -= render 'form'
\ No newline at end of file += render 'form' diff --git a/app/views/networks/show.html.slim b/app/views/networks/show.html.slim index d237351c4..9b2a0dbf8 100644 --- a/app/views/networks/show.html.slim +++ b/app/views/networks/show.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :network, @network  / PageHeader  = pageheader 'reseau',               @network.name, diff --git a/app/views/organisations/edit.html.slim b/app/views/organisations/edit.html.slim index a78d59f3d..0d81b26e3 100644 --- a/app/views/organisations/edit.html.slim +++ b/app/views/organisations/edit.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :organisation, @organisation  = title_tag t('.title')  = semantic_form_for @organisation, :url => organisation_path do |form| @@ -7,4 +8,4 @@    = form.actions do      = form.action :submit, as: :button -    = form.action :cancel, as: :link
\ No newline at end of file +    = form.action :cancel, as: :link diff --git a/app/views/organisations/show.html.slim b/app/views/organisations/show.html.slim index bf9f464dd..89e3b2870 100644 --- a/app/views/organisations/show.html.slim +++ b/app/views/organisations/show.html.slim @@ -1,3 +1,5 @@ +- breadcrumb :organisation, @organisation +  = title_tag @organisation.name  .summary diff --git a/app/views/referential_companies/index.html.slim b/app/views/referential_companies/index.html.slim index e5b7ce24a..9f5cd5d62 100644 --- a/app/views/referential_companies/index.html.slim +++ b/app/views/referential_companies/index.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :referential_companies, @referential  / PageHeader  = pageheader 'transporteur',               t('companies.index.title'), diff --git a/app/views/referential_companies/new.html.slim b/app/views/referential_companies/new.html.slim index 1acb1786f..1c7fc7297 100644 --- a/app/views/referential_companies/new.html.slim +++ b/app/views/referential_companies/new.html.slim @@ -1,2 +1,3 @@ +- breadcrumb :referential_companies, @referential  = title_tag t('companies.new.title') -= render 'form'
\ No newline at end of file += render 'form' diff --git a/app/views/referential_companies/show.html.slim b/app/views/referential_companies/show.html.slim index 1d71c778a..0dbc3cdd0 100644 --- a/app/views/referential_companies/show.html.slim +++ b/app/views/referential_companies/show.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :referential_company, @referential, @company  / PageHeader  = pageheader 'transporteur',               @company.name, diff --git a/app/views/referential_group_of_lines/index.html.slim b/app/views/referential_group_of_lines/index.html.slim index 9fa3eb381..e782db090 100644 --- a/app/views/referential_group_of_lines/index.html.slim +++ b/app/views/referential_group_of_lines/index.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :referential_group_of_lines, @referential  = title_tag t('group_of_lines.index.title')  = search_form_for @q, :url => referential_group_of_lines_path(@referential), remote: true, :html => {:method => :get, class: "form-inline", :id => "search", role: "form"} do |f| diff --git a/app/views/referential_group_of_lines/new.html.slim b/app/views/referential_group_of_lines/new.html.slim index 36b5d6b4e..8807bc402 100644 --- a/app/views/referential_group_of_lines/new.html.slim +++ b/app/views/referential_group_of_lines/new.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :referential_group_of_lines, @referential  = title_tag t('group_of_lines.new.title') -== render 'form'
\ No newline at end of file +== render 'form' diff --git a/app/views/referential_group_of_lines/show.html.slim b/app/views/referential_group_of_lines/show.html.slim index a0635f158..504af0187 100644 --- a/app/views/referential_group_of_lines/show.html.slim +++ b/app/views/referential_group_of_lines/show.html.slim @@ -1,8 +1,9 @@ +- breadcrumb :referential_group_of_line, @referential, @group_of_line  = title_tag t('group_of_lines.show.title', :group_of_line => @group_of_line.name )  .group_of_line_show    = @map.to_html -   +    .summary      p        label = "#{@group_of_line.human_attribute_name('registration_number')} : " @@ -13,10 +14,10 @@        = @group_of_line.comment    p.after_map -   +    h3.group_of_line_lines = t('.lines')    .lines_detail -    == render partial: "lines_detail"  +    == render partial: "lines_detail"  - content_for :sidebar do    ul.actions @@ -28,4 +29,4 @@        = link_to  t('group_of_lines.actions.destroy'), referential_group_of_line_path(@referential, @group_of_line), :method => :delete, :data => {:confirm =>  t('group_of_lines.actions.destroy_confirm')} , class: 'remove'      br -  = creation_tag(@group_of_line)
\ No newline at end of file +  = creation_tag(@group_of_line) diff --git a/app/views/referential_lines/edit.html.slim b/app/views/referential_lines/edit.html.slim index 0036d023b..8c51715ba 100644 --- a/app/views/referential_lines/edit.html.slim +++ b/app/views/referential_lines/edit.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :referential_line, @line, @referential  = title_tag t('lines.edit.title', line: @line.name) -= render 'form'
\ No newline at end of file += render 'form' diff --git a/app/views/referential_lines/show.html.slim b/app/views/referential_lines/show.html.slim index df3c285ee..0ef548e89 100644 --- a/app/views/referential_lines/show.html.slim +++ b/app/views/referential_lines/show.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :referential_line, @referential, @line  / PageHeader  = pageheader 'ligne',              t('lines.index.line', line: @line.name), diff --git a/app/views/referential_networks/edit.html.slim b/app/views/referential_networks/edit.html.slim index d4e088937..dded4b176 100644 --- a/app/views/referential_networks/edit.html.slim +++ b/app/views/referential_networks/edit.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :referential_network, @referential, @network  = title_tag t('networks.edit.title', network: @network.name) -= render 'form'
\ No newline at end of file += render 'form' diff --git a/app/views/referential_networks/index.html.slim b/app/views/referential_networks/index.html.slim index ca67eca8b..57d3e7f1f 100644 --- a/app/views/referential_networks/index.html.slim +++ b/app/views/referential_networks/index.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :referential_networks, @referential  / PageHeader  = pageheader 'reseau',               t('networks.index.title'), @@ -39,7 +40,7 @@              ],              links: [:show],              cls: 'table has-search' -       +            = new_pagination @networks, 'pull-right'      - unless @networks.any? diff --git a/app/views/referential_networks/new.html.slim b/app/views/referential_networks/new.html.slim index 7071ded33..4a737d9f7 100644 --- a/app/views/referential_networks/new.html.slim +++ b/app/views/referential_networks/new.html.slim @@ -1,3 +1,5 @@ +- breadcrumb :referential_networks, @referential +  = title_tag t('networks.new.title') -= render 'form'
\ No newline at end of file += render 'form' diff --git a/app/views/referential_networks/show.html.slim b/app/views/referential_networks/show.html.slim index d7095561e..eab0cd51a 100644 --- a/app/views/referential_networks/show.html.slim +++ b/app/views/referential_networks/show.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :referential_network, @referential, @network  / PageHeader  = pageheader 'reseau',               @network.name, diff --git a/app/views/referential_stop_areas/edit.html.slim b/app/views/referential_stop_areas/edit.html.slim index a999ab715..fc7220095 100644 --- a/app/views/referential_stop_areas/edit.html.slim +++ b/app/views/referential_stop_areas/edit.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :referential_stop_area, @referential, @stop_area  = title_tag t('stop_areas.edit.title', stop_area: @stop_area.name) -= render 'form'
\ No newline at end of file += render 'form' diff --git a/app/views/referential_stop_areas/index.html.slim b/app/views/referential_stop_areas/index.html.slim index 7bf39eabd..718cbb472 100644 --- a/app/views/referential_stop_areas/index.html.slim +++ b/app/views/referential_stop_areas/index.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :referential_stop_areas, @referential  = title_tag t('stop_areas.index.title')  = search_form_for @q, :url => referential_stop_areas_path(@referential), remote: true, :html => {:method => :get, class: "form-inline", :id => "search", role: "form"} do |f| diff --git a/app/views/referential_stop_areas/new.html.slim b/app/views/referential_stop_areas/new.html.slim index 54fd59422..87ba9b657 100644 --- a/app/views/referential_stop_areas/new.html.slim +++ b/app/views/referential_stop_areas/new.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :referential_stop_areas, @referential  = title_tag  t('stop_areas.new.title') -= render 'form'
\ No newline at end of file += render 'form' diff --git a/app/views/referential_stop_areas/show.html.slim b/app/views/referential_stop_areas/show.html.slim index fa383c82d..b9a1c9899 100644 --- a/app/views/referential_stop_areas/show.html.slim +++ b/app/views/referential_stop_areas/show.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :referential_stop_area, @referential, @stop_area  / PageHeader  = pageheader 'arret',               @stop_area.name, diff --git a/app/views/referentials/show.html.slim b/app/views/referentials/show.html.slim index 26ce0acbb..b03fb9f53 100644 --- a/app/views/referentials/show.html.slim +++ b/app/views/referentials/show.html.slim @@ -1,3 +1,4 @@ +- breadcrumb @referential  / PageHeader  = pageheader 'jeux-de-donnees',               @referential.name, diff --git a/app/views/route_sections/index.html.slim b/app/views/route_sections/index.html.slim index 2d36be67a..c459af73c 100644 --- a/app/views/route_sections/index.html.slim +++ b/app/views/route_sections/index.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :referential_route_sections, @referential  = title_tag t('.title')  = form_for search, url: referential_route_sections_path(@referential), method: :get, class: 'form-inline' do |form| @@ -45,4 +46,4 @@ table.table.table-hover.table-striped            = link_to t('.actions.destroy'), referential_route_section_path(@referential, route_section), method: :delete, data: { confirm: t('route_sections.actions.destroy_confirm') }, class: 'remove'  .pagination -  = will_paginate @route_sections, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer
\ No newline at end of file +  = will_paginate @route_sections, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer diff --git a/app/views/route_sections/new.html.slim b/app/views/route_sections/new.html.slim index a41db0254..79f4cda2b 100644 --- a/app/views/route_sections/new.html.slim +++ b/app/views/route_sections/new.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :referential_route_sections, @referential  = title_tag t('route_sections.new.title') -== render 'form'
\ No newline at end of file +== render 'form' diff --git a/app/views/route_sections/show.html.slim b/app/views/route_sections/show.html.slim index f02f7de80..afd0ed0d6 100644 --- a/app/views/route_sections/show.html.slim +++ b/app/views/route_sections/show.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :referential_route_section, @referential, @route_section  = title_tag t('.title')  .route_section @@ -23,4 +24,4 @@      li        = link_to t('route_sections.actions.destroy'), referential_route_section_path(@referential, @route_section), :method => :delete, :data => {:confirm =>  t('route_sections.actions.destroy_confirm')}, class: 'remove' -  = creation_tag(@route_section)
\ No newline at end of file +  = creation_tag(@route_section) diff --git a/app/views/routes/edit.html.slim b/app/views/routes/edit.html.slim index 850588aef..a69c5aeff 100644 --- a/app/views/routes/edit.html.slim +++ b/app/views/routes/edit.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :route, @referential, @route  / PageHeader  = pageheader 'itineraire',               @route.name, diff --git a/app/views/routes/new.html.slim b/app/views/routes/new.html.slim index a68f8ae4e..3a8ceb963 100644 --- a/app/views/routes/new.html.slim +++ b/app/views/routes/new.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :referential_line, @referential, @line  / PageHeader  = pageheader 'itineraire',               t('routes.new.title'), diff --git a/app/views/routes/show.html.slim b/app/views/routes/show.html.slim index 6bd3451cd..1411a5502 100644 --- a/app/views/routes/show.html.slim +++ b/app/views/routes/show.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :route, @referential, @route  / PageHeader  = pageheader 'itineraire',          t('routes.index.title', route: @route.name), @@ -78,4 +79,4 @@  = javascript_tag do    | window.route = "#{URI.escape(route_json_for_edit(@route))}" -= javascript_pack_tag 'routes/show.js'
\ No newline at end of file += javascript_pack_tag 'routes/show.js' diff --git a/app/views/routing_constraint_zones/edit.html.slim b/app/views/routing_constraint_zones/edit.html.slim index 2c23344df..c9b9b0c41 100644 --- a/app/views/routing_constraint_zones/edit.html.slim +++ b/app/views/routing_constraint_zones/edit.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :routing_constraint_zone, @referential, @line, @routing_constraint_zone  / PageHeader  = pageheader 'itl',               t('.title', routing_constraint_zone: @routing_constraint_zone.name), diff --git a/app/views/routing_constraint_zones/index.html.slim b/app/views/routing_constraint_zones/index.html.slim index 4e2534b6a..ddad7723e 100644 --- a/app/views/routing_constraint_zones/index.html.slim +++ b/app/views/routing_constraint_zones/index.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :routing_constraint_zones, @referential, @line  / PageHeader  = pageheader 'itl',               t('routing_constraint_zones.index.title'), diff --git a/app/views/routing_constraint_zones/new.html.slim b/app/views/routing_constraint_zones/new.html.slim index 1ed65335f..d15de13a4 100644 --- a/app/views/routing_constraint_zones/new.html.slim +++ b/app/views/routing_constraint_zones/new.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :routing_constraint_zones, @referential, @line  / PageHeader  = pageheader 'itl',               t('.title') diff --git a/app/views/routing_constraint_zones/show.html.slim b/app/views/routing_constraint_zones/show.html.slim index dbd8464a0..d0c0619c3 100644 --- a/app/views/routing_constraint_zones/show.html.slim +++ b/app/views/routing_constraint_zones/show.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :routing_constraint_zone, @referential, @line, @routing_constraint_zone  / PageHeader  = pageheader 'itl',               @routing_constraint_zone.name, diff --git a/app/views/shared/_breadcrumb.html.slim b/app/views/shared/_breadcrumb.html.slim index a101098fe..403ed6702 100644 --- a/app/views/shared/_breadcrumb.html.slim +++ b/app/views/shared/_breadcrumb.html.slim @@ -1,2 +1 @@ -- if @breadcrumbs.present? -  = render_breadcrumbs builder: BootstrapBreadcrumbsBuilder, tag: :li, separator: '' +== breadcrumbs diff --git a/app/views/stop_area_referentials/show.html.slim b/app/views/stop_area_referentials/show.html.slim index dc90def50..896ce756e 100644 --- a/app/views/stop_area_referentials/show.html.slim +++ b/app/views/stop_area_referentials/show.html.slim @@ -1,10 +1,11 @@ +- breadcrumb :stop_area_referential, @stop_area_referential  / PageHeader  = pageheader 'synchro-icar',               t('.title'),               'Lorem ipsum dolor sit amet',               t('last_update', time: l(@stop_area_referential.updated_at, format: :short)),               link_to(t('actions.sync'), sync_stop_area_referential_path(@stop_area_referential), method: :post, class: 'btn btn-default') do -  +    .row.mb-md      .col-lg-12.text-right        = link_to stop_area_referential_stop_areas_path(@stop_area_referential), class: 'btn btn-primary' do diff --git a/app/views/stop_areas/edit.html.slim b/app/views/stop_areas/edit.html.slim index 170b6bd20..8005f5a08 100644 --- a/app/views/stop_areas/edit.html.slim +++ b/app/views/stop_areas/edit.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :stop_area, @stop_area_referential, @stop_area  = title_tag t('stop_areas.edit.title', stop_area: @stop_area.name ) -== render 'form'
\ No newline at end of file +== render 'form' diff --git a/app/views/stop_areas/index.html.slim b/app/views/stop_areas/index.html.slim index 95b9b1b0e..4e880f7a3 100644 --- a/app/views/stop_areas/index.html.slim +++ b/app/views/stop_areas/index.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :stop_areas, @stop_area_referential  / PageHeader  = pageheader 'arret',               t('stop_areas.index.title'), diff --git a/app/views/stop_areas/new.html.slim b/app/views/stop_areas/new.html.slim index bdbd97571..e0c5b7a61 100644 --- a/app/views/stop_areas/new.html.slim +++ b/app/views/stop_areas/new.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :stop_areas, @stop_area_referential  = title_tag t('stop_areas.new.title') -== render 'form'
\ No newline at end of file +== render 'form' diff --git a/app/views/stop_areas/show.html.slim b/app/views/stop_areas/show.html.slim index dce5bdbad..bc9cc2ac0 100644 --- a/app/views/stop_areas/show.html.slim +++ b/app/views/stop_areas/show.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :stop_area, @stop_area_referential, @stop_area  / PageHeader  = pageheader 'arret',               @stop_area.name, diff --git a/app/views/time_tables/edit.html.slim b/app/views/time_tables/edit.html.slim index bf7573c71..a1ebb2c72 100644 --- a/app/views/time_tables/edit.html.slim +++ b/app/views/time_tables/edit.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :time_table, @referential, @time_table  / PageHeader  = pageheader 'calendrier-application',               @time_table.comment, diff --git a/app/views/time_tables/index.html.slim b/app/views/time_tables/index.html.slim index c71a214f1..b0f4e84c5 100644 --- a/app/views/time_tables/index.html.slim +++ b/app/views/time_tables/index.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :time_tables, @referential  / PageHeader  = pageheader 'calendrier-application',               t('time_tables.index.title'), diff --git a/app/views/time_tables/new.html.slim b/app/views/time_tables/new.html.slim index 8a6930b9c..c8c2658ba 100644 --- a/app/views/time_tables/new.html.slim +++ b/app/views/time_tables/new.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :time_tables, @referential  / PageHeader  = pageheader 'calendrier-application',               t("time_tables.#{params[:action]}.title"), diff --git a/app/views/time_tables/show.html.slim b/app/views/time_tables/show.html.slim index 021b55058..85de7f8ec 100644 --- a/app/views/time_tables/show.html.slim +++ b/app/views/time_tables/show.html.slim @@ -1,5 +1,5 @@  - require 'calendar_helper' - +- breadcrumb :time_table, @referential, @time_table  / PageHeader  = pageheader 'calendrier-application', 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/app/views/vehicle_journeys/edit.html.slim b/app/views/vehicle_journeys/edit.html.slim index 8b3dbcf51..6276b2635 100644 --- a/app/views/vehicle_journeys/edit.html.slim +++ b/app/views/vehicle_journeys/edit.html.slim @@ -1,3 +1,3 @@  = title_tag edit_vehicle_title(@vehicle_journey) -== render 'form', vehicle_journey: @vehicle_journey, form_url: referential_line_route_vehicle_journey_path(@referential, @line, @route, @vehicle_journey)
\ No newline at end of file +== render 'form', vehicle_journey: @vehicle_journey, form_url: referential_line_route_vehicle_journey_path(@referential, @line, @route, @vehicle_journey) diff --git a/app/views/vehicle_journeys/index.html.slim b/app/views/vehicle_journeys/index.html.slim index f88afc398..2046ecca6 100644 --- a/app/views/vehicle_journeys/index.html.slim +++ b/app/views/vehicle_journeys/index.html.slim @@ -1,3 +1,4 @@ +- breadcrumb :vehicle_journeys, @referential, @route  / PageHeader  = pageheader 'horaires-des-courses',               t('vehicle_journeys.index.title', route: @route.name ), diff --git a/app/views/workbenches/show.html.slim b/app/views/workbenches/show.html.slim index 32a933cc2..66eedb68d 100644 --- a/app/views/workbenches/show.html.slim +++ b/app/views/workbenches/show.html.slim @@ -1,9 +1,9 @@ +- breadcrumb @workbench  / PageHeader  = pageheader 'jeux-de-donnees',               t('referentials.index.title'),               '',               '' do -    / Below is secundary actions & optional contents (filters, ...)    .row.mb-sm      .col-lg-12.text-right @@ -78,4 +78,4 @@  = javascript_tag do    | window.I18n = #{(I18n.backend.send(:translations).to_json).html_safe}; -= javascript_pack_tag 'date_filters'
\ No newline at end of file += javascript_pack_tag 'date_filters' diff --git a/config/breadcrumbs.rb b/config/breadcrumbs.rb new file mode 100644 index 000000000..f2021a65b --- /dev/null +++ b/config/breadcrumbs.rb @@ -0,0 +1,249 @@ +crumb :root do +  link I18n.t('layouts.home'), root_path +end + +crumb :workbench do |workbench| +  link workbench.name, workbench_path(workbench) +end + +crumb :referential do |referential| +  link referential.name, referential_path(referential) +  parent :workbench, referential.workbench +end + +crumb :referential_companies do |referential| +  link I18n.t('companies.index.title'), referential_companies_path(referential) +  parent :referential, referential +end + +crumb :referential_company do |referential, company| +  link company.name, referential_company_path(referential, company) +  parent :referential_companies, referential +end + +crumb :referential_networks do |referential| +  link I18n.t('networks.index.title'), referential_networks_path +  parent :referential, referential +end + +crumb :referential_network do |referential, network| +  link  network.name, referential_network_path(referential, network) +  parent :referential_networks, referential +end + +crumb :referential_group_of_lines do |referential| +  link I18n.t('group_of_lines.index.title'), referential_networks_path(referential) +  parent :referential, referential +end + +crumb :referential_group_of_line do |referential, group_of_line| +  link  group_of_line.name, referential_group_of_line_path(referential, group_of_line) +  parent :referential_group_of_lines, referential +end + +crumb :referential_route_sections do |referential| +  link I18n.t('route_sections.index.title'), referential_route_sections_path(referential) +  parent :referential, referential +end + +crumb :referential_route_section do |referential, route_section| +  link  route_section.departure.name, referential_route_section_path(referential, route_section) +  parent :referential_route_sections, referential +end + + +crumb :time_tables do |referential| +  link I18n.t('time_tables.index.title'), referential_time_tables_path(referential) +  parent :referential, referential +end + +crumb :time_table do |referential, time_table| +  link time_table.comment, referential_time_table_path(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 +end + +crumb :compliance_check_set do |workbench, compliance_check_set| +  link compliance_check_set.name, workbench_compliance_check_set_path(workbench, compliance_check_set) +  parent :compliance_check_sets, workbench +end + +crumb :imports do |workbench| +  link I18n.t('imports.index.title'), workbench_imports_path(workbench) +  parent :workbench, workbench +end + +crumb :import do |workbench, import| +  link import.name, workbench_import_path(workbench, import) +  parent :imports, workbench +end + +crumb :organisation do |organisation| +  link organisation.name, organisation_path(organisation) +end + +crumb :compliance_control_sets do +  link I18n.t('compliance_control_sets.index.title'), compliance_control_sets_path +end + +crumb :compliance_control_set do |compliance_control_set| +  link compliance_control_set.name, compliance_control_set_path(compliance_control_set) +  parent :compliance_control_sets +end + +crumb :compliance_control do |compliance_control| +  link compliance_control.name, compliance_control_set_compliance_control_path(compliance_control.compliance_control_set, compliance_control) +  parent :compliance_control_set, compliance_control.compliance_control_set +end + +crumb :stop_area_referential do |stop_area_referential| +  link I18n.t('stop_area_referentials.show.title'), stop_area_referential_path(stop_area_referential) +end + +crumb :stop_areas do |stop_area_referential| +  link I18n.t('stop_areas.index.title'), stop_area_referential_stop_areas_path(stop_area_referential) +  parent :stop_area_referential, stop_area_referential +end + +crumb :stop_area do |stop_area_referential, stop_area| +  link stop_area.name, stop_area_referential_stop_area_path(stop_area_referential, stop_area) +  parent :stop_areas, stop_area_referential +end + +crumb :line_referential do |line_referential| +  link I18n.t('line_referentials.show.title'), line_referential_path(line_referential) +end + +crumb :companies do |line_referential| +  link I18n.t('companies.index.title'), line_referential_companies_path(line_referential) +  parent :line_referential, line_referential +end + +crumb :company do |company| +  link company.name, line_referential_company_path(company.line_referential, company) +  parent :companies, company.line_referential +end + +crumb :networks do |line_referential| +  link I18n.t('networks.index.title'), line_referential_networks_path(line_referential) +  parent :line_referential, line_referential +end + +crumb :network do |network| +  link network.name, line_referential_network_path(network.line_referential, network) +  parent :networks, network.line_referential +end + +crumb :group_of_lines do |line_referential| +  link I18n.t('group_of_lines.index.title'), line_referential_group_of_lines_path(line_referential) +  parent :line_referential, line_referential +end + +crumb :group_of_line do |group_of_line| +  link group_of_line.name, line_referential_group_of_line_path(group_of_line.line_referential, group_of_line) +  parent :group_of_lines, group_of_line.line_referential +end + +crumb :lines do |line_referential| +  link I18n.t('lines.index.title'), line_referential_lines_path +  parent :line_referential, line_referential +end + +crumb :line do |line| +  link line.name, line_referential_line_path(line.line_referential, line) +  parent :lines, line.line_referential +end + +crumb :calendars do +  link I18n.t('calendars.index.title'), calendars_path +end + +crumb :calendar do |calendar| +  link calendar.name, calendar_path(calendar) +  parent :calendars +end + +crumb :referential_line do |referential, line| +  link line.name, referential_line_path(referential, line) +  parent :referential, referential +end + +crumb :line_footnotes do |referential, line| +  link line.name, referential_line_footnotes_path(referential, line) +  parent :referential_line, referential, line +end + +crumb :routing_constraint_zones do |referential, line| +  link I18n.t('routing_constraint_zones.index.title'), referential_line_routing_constraint_zones_path(referential, line) +  parent :referential_line, referential, line +end + +crumb :routing_constraint_zone do |referential, line, routing_constraint_zone| +  link routing_constraint_zone.name, referential_line_routing_constraint_zone_path(referential, line, routing_constraint_zone) +  parent :routing_constraint_zones, referential, line +end + +crumb :route do |referential, route| +  link I18n.t('routes.index.title', route: route.name), referential_line_route_path(referential, route.line, route) +  parent :referential_line, referential, route.line +end + +crumb :journey_patterns do |referential, route| +  link I18n.t('journey_patterns.index.title'), referential_line_route_journey_patterns_collection_path(referential, route.line, route) +  parent :route, referential, route +end + +crumb :referential_stop_areas do |referential| +  link I18n.t('stop_areas.index.title'), referential_stop_areas_path(referential) +  parent :referential, referential +end + +crumb :referential_stop_area do |referential, stop_area| +  link stop_area.name, referential_stop_area_path(referential, stop_area) +  parent :referential_stop_areas, referential +end + +crumb :vehicle_journeys do |referential, route| +  link I18n.t('vehicle_journeys.index.title', route: route.name), referential_line_route_vehicle_journeys_path(referential, route.line, route) +  parent :route, referential, route +end + +# crumb :compliance_controls do|compliance_control_sets| +#   link +#   parent :compliance_control_sets, compliance_control_sets +# end + +# crumb :project do |project| +#   link project.name, project_path(project) +#   parent :projects +# end + +# crumb :project_issues do |project| +#   link "Issues", project_issues_path(project) +#   parent :project, project +# end + +# crumb :issue do |issue| +#   link issue.title, issue_path(issue) +#   parent :project_issues, issue.project +# end + +# If you want to split your breadcrumbs configuration over multiple files, you +# can create a folder named `config/breadcrumbs` and put your configuration +# files there. All *.rb files (e.g. `frontend.rb` or `products.rb`) in that +# folder are loaded and reloaded automatically when you change them, just like +# this file (`config/breadcrumbs.rb`). diff --git a/config/locales/breadcrumbs.en.yml b/config/locales/breadcrumbs.en.yml deleted file mode 100644 index 6fec15b85..000000000 --- a/config/locales/breadcrumbs.en.yml +++ /dev/null @@ -1,7 +0,0 @@ -en: -  breadcrumbs: -    vehicle_journeys: "Passing times" -    vehicle_journey_frequencies: "Times bands" -    referentials: "Home" -    users: "Users" -    imports: Imports diff --git a/config/locales/breadcrumbs.fr.yml b/config/locales/breadcrumbs.fr.yml deleted file mode 100644 index 725549f14..000000000 --- a/config/locales/breadcrumbs.fr.yml +++ /dev/null @@ -1,7 +0,0 @@ -fr: -  breadcrumbs: -    vehicle_journeys: "Horaires" -    vehicle_journey_frequencies: "Créneaux horaires" -    root: "Accueil" -    users: "Utilisateurs" -    imports: Imports diff --git a/lib/bootstrap_breadcrumbs_builder.rb b/lib/bootstrap_breadcrumbs_builder.rb deleted file mode 100644 index daa154bdf..000000000 --- a/lib/bootstrap_breadcrumbs_builder.rb +++ /dev/null @@ -1,31 +0,0 @@ -# bootstrap builder for breadcrumbs_on_rails gem -class BootstrapBreadcrumbsBuilder < BreadcrumbsOnRails::Breadcrumbs::Builder -  def render -    @context.content_tag(:ul, class: 'breadcrumb') do -      @elements.collect do |element| -        render_element(element) -      end.join.html_safe -    end -  end - -  def render_element(element) -    active = element.path.nil? || @context.current_page?(compute_path(element)) -    # Bootstrap use '/' divider by default but you can customize it: -    # divider = @context.content_tag(:span, '/'.html_safe, class: 'divider') unless active - -    @context.content_tag(:li, :class => ('active' if active)) do -      content = if element.path.nil? -        compute_name(element) -      else -        @context.link_to_unless_current(compute_name(element), compute_path(element), element.options) -      end - -      # content + (divider || '') -      content -    end -  end -end - - -# Usage: -# = render_breadcrumbs(builder: BootstrapBreadcrumbsBuilder)
\ No newline at end of file | 
