diff options
| author | Luc Donnet | 2017-11-30 21:58:52 +0100 |
|---|---|---|
| committer | Luc Donnet | 2017-11-30 21:58:52 +0100 |
| commit | 69a6bd72fecad790edab7e51e7d6df5ac1c7abba (patch) | |
| tree | dc11c5b787d6f9059c36cc9be56e2b1fcb1c64b0 | |
| parent | 3f5ac4764b859f97f776df565599e312b4584a03 (diff) | |
| parent | 887a5985c6aba4ae65fbdd7c0c40f30186a778f2 (diff) | |
| download | chouette-core-69a6bd72fecad790edab7e51e7d6df5ac1c7abba.tar.bz2 | |
Merge branch 'master' into 5093-fix_import_policy
238 files changed, 599 insertions, 857 deletions
@@ -33,6 +33,9 @@ gem 'spring', group: :development # ActiveRecord associations on top of PostgreSQL arrays gem 'has_array_of', af83: 'has_array_of' +# Track changes to your models' data. Good for auditing or versioning. +gem 'paper_trail' + gem 'rails-observers' # Use SeedBank for spliting seeds diff --git a/Gemfile.lock b/Gemfile.lock index 9262eeb74..f9682dff1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -321,6 +321,10 @@ GEM mini_portile2 (~> 2.3.0) open4 (1.3.4) orm_adapter (0.5.0) + paper_trail (4.1.0) + activerecord (>= 3.0, < 6.0) + activesupport (>= 3.0, < 6.0) + request_store (~> 1.1) parser (2.4.0.0) ast (~> 2.2) pg (0.20.0) @@ -621,6 +625,7 @@ DEPENDENCIES map_layers (= 0.0.4) mimemagic newrelic_rpm + paper_trail pg phantomjs poltergeist diff --git a/app/assets/stylesheets/components/_device.sass b/app/assets/stylesheets/components/_device.sass new file mode 100644 index 000000000..0e773c29c --- /dev/null +++ b/app/assets/stylesheets/components/_device.sass @@ -0,0 +1,9 @@ +#sessions_new + li + list-style: none + .login + .checkbox + width: 100% + .panel-body + padding-left: 35px !important + padding-right: 35px !important
\ No newline at end of file diff --git a/app/assets/stylesheets/typography/_sboiv.sass b/app/assets/stylesheets/typography/_sboiv.sass index e37f89f2d..1345fbac6 100644 --- a/app/assets/stylesheets/typography/_sboiv.sass +++ b/app/assets/stylesheets/typography/_sboiv.sass @@ -62,25 +62,25 @@ .sb-ZDEP:before content: '\e906' -.sb-transporteur:before +.sb-company:before content: '\e907' .sb-trace:before content: '\e908' -.sb-tableau-de-bord:before +.sb-dashboard:before content: '\e909' -.sb-synchro-ilico:before +.sb-line_referential:before content: '\e90a' -.sb-synchro-icar:before +.sb-stop_area_referential:before content: '\e90b' -.sb-reseau:before +.sb-network:before content: '\e90c' -.sb-rapport-de-controle:before +.sb-compliance-check-set:before content: '\e90d' .sb-OAT:before @@ -89,7 +89,7 @@ .sb-OAS:before content: '\e90f' -.sb-modele-calendrier:before +.sb-calendar:before content: '\e910' .sb-mission:before @@ -104,28 +104,28 @@ .sb-LDA:before content: '\e914' -.sb-jeux-de-donnees:before +.sb-referential:before content: '\e915' -.sb-jeux-de-controle:before +.sb-compliance_control_set:before content: '\e916' -.sb-itl:before +.sb-routing_constraint_zone:before content: '\e917' -.sb-itineraire:before +.sb-route:before content: '\e918' -.sb-importer:before +.sb-import:before content: '\e919' -.sb-horaires-des-courses:before +.sb-vehicle_journey:before content: '\e91a' -.sb-calendrier-application:before +.sb-time_table:before content: '\e91b' -.sb-arret:before +.sb-stop_area:before content: '\e91c' .sb-Acces:before @@ -143,5 +143,5 @@ .sb-update-vj:before content: '\e900' -.sb-ligne:before +.sb-line:before content: '\e91e' diff --git a/app/controllers/access_links_controller.rb b/app/controllers/access_links_controller.rb index 936b8ea5e..19b3eb742 100644 --- a/app/controllers/access_links_controller.rb +++ b/app/controllers/access_links_controller.rb @@ -1,4 +1,5 @@ class AccessLinksController < ChouetteController + include ReferentialSupport defaults :resource_class => Chouette::AccessLink belongs_to :referential do @@ -83,7 +84,7 @@ class AccessLinksController < ChouetteController private def access_link_params - params.require(:access_link).permit(:access_link_type,:access_point_id, :stop_area_id, :objectid, :object_version, :creator_id, :name, :comment, :link_distance, :link_type, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration, :mobility_restricted_traveller_duration, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs, :link_orientation, :link_orientation_type, :stop_area ) + params.require(:access_link).permit(:access_link_type,:access_point_id, :stop_area_id, :objectid, :object_version, :name, :comment, :link_distance, :link_type, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration, :mobility_restricted_traveller_duration, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs, :link_orientation, :link_orientation_type, :stop_area ) end end diff --git a/app/controllers/access_points_controller.rb b/app/controllers/access_points_controller.rb index 477875cc9..112a13a86 100644 --- a/app/controllers/access_points_controller.rb +++ b/app/controllers/access_points_controller.rb @@ -1,4 +1,5 @@ class AccessPointsController < ChouetteController + include ReferentialSupport defaults :resource_class => Chouette::AccessPoint belongs_to :referential do @@ -63,7 +64,7 @@ class AccessPointsController < ChouetteController private def access_point_params - params.require(:access_point).permit( :objectid, :object_version, :creator_id, :name, :comment, :longitude, :latitude, :long_lat_type, :country_code, :street_name, :zip_code, :city_name, :openning_time, :closing_time, :access_type, :access_point_type, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :stop_area_id, :coordinates ) + params.require(:access_point).permit( :objectid, :object_version, :name, :comment, :longitude, :latitude, :long_lat_type, :country_code, :street_name, :zip_code, :city_name, :openning_time, :closing_time, :access_type, :access_point_type, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :stop_area_id, :coordinates ) end end diff --git a/app/controllers/api_keys_controller.rb b/app/controllers/api_keys_controller.rb index eebad5e7b..9706c5961 100644 --- a/app/controllers/api_keys_controller.rb +++ b/app/controllers/api_keys_controller.rb @@ -1,4 +1,4 @@ -class ApiKeysController < InheritedResources::Base +class ApiKeysController < ChouetteController defaults resource_class: Api::V1::ApiKey include PolicyChecker diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 6a9f6942f..97f5548ae 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,5 +1,7 @@ class ApplicationController < ActionController::Base + include PaperTrailSupport include Pundit + rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized # TODO : Delete hack to authorize Cross Request for js and json get request from javascript diff --git a/app/controllers/autocomplete_stop_areas_controller.rb b/app/controllers/autocomplete_stop_areas_controller.rb index e35a545ae..233012028 100644 --- a/app/controllers/autocomplete_stop_areas_controller.rb +++ b/app/controllers/autocomplete_stop_areas_controller.rb @@ -1,4 +1,4 @@ -class AutocompleteStopAreasController < InheritedResources::Base +class AutocompleteStopAreasController < ChouetteController respond_to :json, :only => [:index, :children, :parent, :physicals] include ReferentialSupport diff --git a/app/controllers/autocomplete_time_tables_controller.rb b/app/controllers/autocomplete_time_tables_controller.rb index f65f5b9f6..0a9f51ced 100644 --- a/app/controllers/autocomplete_time_tables_controller.rb +++ b/app/controllers/autocomplete_time_tables_controller.rb @@ -1,4 +1,4 @@ -class AutocompleteTimeTablesController < InheritedResources::Base +class AutocompleteTimeTablesController < ChouetteController respond_to :json, :only => [:index] before_action :switch_referential diff --git a/app/controllers/autocomplete_timebands_controller.rb b/app/controllers/autocomplete_timebands_controller.rb index 4922e214c..af041c33e 100644 --- a/app/controllers/autocomplete_timebands_controller.rb +++ b/app/controllers/autocomplete_timebands_controller.rb @@ -1,4 +1,4 @@ -class AutocompleteTimebandsController < InheritedResources::Base +class AutocompleteTimebandsController < ChouetteController respond_to :json, :only => [:index] include ReferentialSupport diff --git a/app/controllers/calendars_controller.rb b/app/controllers/calendars_controller.rb index e9ee7579a..2ed10a111 100644 --- a/app/controllers/calendars_controller.rb +++ b/app/controllers/calendars_controller.rb @@ -1,4 +1,4 @@ -class CalendarsController < InheritedResources::Base +class CalendarsController < ChouetteController include PolicyChecker defaults resource_class: Calendar before_action :ransack_contains_date, only: [:index] diff --git a/app/controllers/chouette_controller.rb b/app/controllers/chouette_controller.rb index 1313aa7cc..3e4f3af27 100644 --- a/app/controllers/chouette_controller.rb +++ b/app/controllers/chouette_controller.rb @@ -1,5 +1,4 @@ class ChouetteController < InheritedResources::Base - + include PaperTrailSupport include ApplicationHelper - include ReferentialSupport end diff --git a/app/controllers/clean_ups_controller.rb b/app/controllers/clean_ups_controller.rb index b9ff225b3..ec28aa0fc 100644 --- a/app/controllers/clean_ups_controller.rb +++ b/app/controllers/clean_ups_controller.rb @@ -1,4 +1,5 @@ class CleanUpsController < ChouetteController + include ReferentialSupport respond_to :html, :only => [:create] belongs_to :referential diff --git a/app/controllers/companies_controller.rb b/app/controllers/companies_controller.rb index bc5bedd7f..931d846c5 100644 --- a/app/controllers/companies_controller.rb +++ b/app/controllers/companies_controller.rb @@ -1,4 +1,4 @@ -class CompaniesController < InheritedResources::Base +class CompaniesController < ChouetteController include ApplicationHelper include PolicyChecker defaults :resource_class => Chouette::Company @@ -62,7 +62,7 @@ class CompaniesController < InheritedResources::Base helper_method :current_referential def company_params - params.require(:company).permit( :objectid, :object_version, :creator_id, :name, :short_name, :organizational_unit, :operating_department_name, :code, :phone, :fax, :email, :registration_number, :url, :time_zone ) + params.require(:company).permit( :objectid, :object_version, :name, :short_name, :organizational_unit, :operating_department_name, :code, :phone, :fax, :email, :registration_number, :url, :time_zone ) end private diff --git a/app/controllers/compliance_check_sets_controller.rb b/app/controllers/compliance_check_sets_controller.rb index 776275d52..03b920030 100644 --- a/app/controllers/compliance_check_sets_controller.rb +++ b/app/controllers/compliance_check_sets_controller.rb @@ -1,4 +1,4 @@ -class ComplianceCheckSetsController < InheritedResources::Base +class ComplianceCheckSetsController < ChouetteController defaults resource_class: ComplianceCheckSet include RansackDateFilter before_action only: [:index] { set_date_time_params("created_at", DateTime) } @@ -28,10 +28,10 @@ class ComplianceCheckSetsController < InheritedResources::Base end def executed - show! do |format| + show! do |format| # But now nobody is aware anymore that `format.html` passes a parameter into the block format.html { executed_for_html } - end + end end diff --git a/app/controllers/compliance_control_blocks_controller.rb b/app/controllers/compliance_control_blocks_controller.rb index f53a1e04a..9eee8dfaf 100644 --- a/app/controllers/compliance_control_blocks_controller.rb +++ b/app/controllers/compliance_control_blocks_controller.rb @@ -1,4 +1,4 @@ -class ComplianceControlBlocksController < InheritedResources::Base +class ComplianceControlBlocksController < ChouetteController include PolicyChecker defaults resource_class: ComplianceControlBlock belongs_to :compliance_control_set diff --git a/app/controllers/compliance_control_sets_controller.rb b/app/controllers/compliance_control_sets_controller.rb index 83a345c6f..2d3d03ad0 100644 --- a/app/controllers/compliance_control_sets_controller.rb +++ b/app/controllers/compliance_control_sets_controller.rb @@ -1,4 +1,4 @@ -class ComplianceControlSetsController < InheritedResources::Base +class ComplianceControlSetsController < ChouetteController include PolicyChecker defaults resource_class: ComplianceControlSet include RansackDateFilter diff --git a/app/controllers/compliance_controls_controller.rb b/app/controllers/compliance_controls_controller.rb index 5a9c0b671..dfbecaa71 100644 --- a/app/controllers/compliance_controls_controller.rb +++ b/app/controllers/compliance_controls_controller.rb @@ -1,4 +1,4 @@ -class ComplianceControlsController < InheritedResources::Base +class ComplianceControlsController < ChouetteController include PolicyChecker defaults resource_class: ComplianceControl belongs_to :compliance_control_set diff --git a/app/controllers/concerns/paper_trail_support.rb b/app/controllers/concerns/paper_trail_support.rb new file mode 100644 index 000000000..4b0b1a7c7 --- /dev/null +++ b/app/controllers/concerns/paper_trail_support.rb @@ -0,0 +1,11 @@ +module PaperTrailSupport + extend ActiveSupport::Concern + + included do + before_action :set_paper_trail_whodunnit + + def user_for_paper_trail + current_user ? current_user.name : '' + end + end +end diff --git a/app/controllers/connection_link_areas_controller.rb b/app/controllers/connection_link_areas_controller.rb index eceb1b0fc..981a7639e 100644 --- a/app/controllers/connection_link_areas_controller.rb +++ b/app/controllers/connection_link_areas_controller.rb @@ -1,16 +1,17 @@ class ConnectionLinkAreasController < ChouetteController + include ReferentialSupport respond_to :json, :only => :index def index - respond_to do |format| - format.json { render :json => areas_maps } - end + respond_to do |format| + format.json { render :json => areas_maps } + end end def areas_maps areas.collect do |area| - { :id => area.id.to_s, + { :id => area.id.to_s, :name => area.name, :country_code => area.country_code, :zip_code => area.zip_code || "", @@ -20,8 +21,8 @@ class ConnectionLinkAreasController < ChouetteController end end - def areas - referential.connection_links.find(params[:connection_link_id]).possible_areas.select{ |p| p.name =~ /#{params[:q]}/i } + def areas + referential.connection_links.find(params[:connection_link_id]).possible_areas.select{ |p| p.name =~ /#{params[:q]}/i } end end diff --git a/app/controllers/connection_links_controller.rb b/app/controllers/connection_links_controller.rb index b56450291..f14868776 100644 --- a/app/controllers/connection_links_controller.rb +++ b/app/controllers/connection_links_controller.rb @@ -1,4 +1,5 @@ class ConnectionLinksController < ChouetteController + include ReferentialSupport defaults :resource_class => Chouette::ConnectionLink belongs_to :referential do @@ -53,7 +54,7 @@ class ConnectionLinksController < ChouetteController private def connection_link_params - params.require(:connection_link).permit( :connection_link_type,:departure_id, :arrival_id, :objectid, :object_version, :creator_id, :name, :comment, :link_distance, :link_type, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration, :mobility_restricted_traveller_duration, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs ) + params.require(:connection_link).permit( :connection_link_type,:departure_id, :arrival_id, :objectid, :object_version, :name, :comment, :link_distance, :link_type, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration, :mobility_restricted_traveller_duration, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs ) end end diff --git a/app/controllers/dashboards_controller.rb b/app/controllers/dashboards_controller.rb index 1c7876c58..c90d0c296 100644 --- a/app/controllers/dashboards_controller.rb +++ b/app/controllers/dashboards_controller.rb @@ -3,8 +3,9 @@ # this controller will use a custom partial like # custom/dashboards/_dashboard.html.slim for Custom::Dashboard # -class DashboardsController < InheritedResources::Base +class DashboardsController < ChouetteController respond_to :html, only: [:show] + defaults :resource_class => Dashboard def show @dashboard = Dashboard.create self diff --git a/app/controllers/export_tasks_controller.rb b/app/controllers/export_tasks_controller.rb index 2b30a5605..b889c1882 100644 --- a/app/controllers/export_tasks_controller.rb +++ b/app/controllers/export_tasks_controller.rb @@ -1,6 +1,7 @@ class ExportTasksController < ChouetteController + include ReferentialSupport defaults :resource_class => ExportTask - + respond_to :html, :only => [:new, :create] respond_to :js, :only => [:new, :create] belongs_to :referential @@ -15,10 +16,10 @@ class ExportTasksController < ChouetteController redirect_to referential_path(@referential) end end - + def create @available_exports = available_exports - begin + begin create! do |success, failure| success.html { redirect_to referential_exports_path(@referential) } end @@ -62,7 +63,7 @@ class ExportTasksController < ChouetteController end end - def build_resource + def build_resource @export_task ||= if params[:export_task].present? export_task_parameters = params[:export_task] case export_task_parameters[:data_format] @@ -80,7 +81,7 @@ class ExportTasksController < ChouetteController else NeptuneExport.new end - + end - + end diff --git a/app/controllers/exports_controller.rb b/app/controllers/exports_controller.rb index ad88c6dae..ccc163e34 100644 --- a/app/controllers/exports_controller.rb +++ b/app/controllers/exports_controller.rb @@ -2,6 +2,7 @@ require 'will_paginate/array' require 'open-uri' class ExportsController < ChouetteController + include ReferentialSupport defaults :resource_class => Export respond_to :html, :only => [:show, :index, :destroy, :exported_file] diff --git a/app/controllers/group_of_lines_controller.rb b/app/controllers/group_of_lines_controller.rb index 1a59d39f7..5762108dc 100644 --- a/app/controllers/group_of_lines_controller.rb +++ b/app/controllers/group_of_lines_controller.rb @@ -1,4 +1,4 @@ -class GroupOfLinesController < InheritedResources::Base +class GroupOfLinesController < ChouetteController include ApplicationHelper include PolicyChecker defaults :resource_class => Chouette::GroupOfLine @@ -73,7 +73,7 @@ class GroupOfLinesController < InheritedResources::Base private def group_of_line_params - params.require(:group_of_line).permit( :objectid, :object_version, :creator_id, :name, :comment, :lines, :registration_number, :line_tokens) + params.require(:group_of_line).permit( :objectid, :object_version, :name, :comment, :lines, :registration_number, :line_tokens) end end diff --git a/app/controllers/import_messages_controller.rb b/app/controllers/import_messages_controller.rb index c3c6b46b5..6546b25f8 100644 --- a/app/controllers/import_messages_controller.rb +++ b/app/controllers/import_messages_controller.rb @@ -1,4 +1,4 @@ -class ImportMessagesController < InheritedResources::Base +class ImportMessagesController < ChouetteController 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 3e52233f2..c83721310 100644 --- a/app/controllers/import_resources_controller.rb +++ b/app/controllers/import_resources_controller.rb @@ -1,4 +1,4 @@ -class ImportResourcesController < InheritedResources::Base +class ImportResourcesController < ChouetteController defaults resource_class: ImportResource, collection_name: 'import_resources', instance_name: 'import_resource' respond_to :html belongs_to :import diff --git a/app/controllers/import_tasks_controller.rb b/app/controllers/import_tasks_controller.rb index cb377ec5a..1a349087d 100644 --- a/app/controllers/import_tasks_controller.rb +++ b/app/controllers/import_tasks_controller.rb @@ -1,6 +1,7 @@ class ImportTasksController < ChouetteController + include ReferentialSupport defaults :resource_class => ImportTask - + respond_to :html, :only => [:new, :create] respond_to :js, :only => [:new, :create] belongs_to :referential @@ -15,10 +16,10 @@ class ImportTasksController < ChouetteController redirect_to referential_path(@referential) end end - + def create @available_imports = available_imports - begin + begin create! do |success, failure| success.html { redirect_to referential_imports_path(@referential) } end @@ -33,14 +34,14 @@ class ImportTasksController < ChouetteController def available_imports import_task_parameters = params[:import_task] - + if import_task_parameters.present? @available_imports = [ import_task_parameters[:data_format] == "neptune" ? build_resource : NeptuneImport.new(:referential_id => @referential.id ), import_task_parameters[:data_format] == "netex" ? build_resource : NetexImport.new(:referential_id => @referential.id ), import_task_parameters[:data_format] == "gtfs" ? build_resource : GtfsImport.new(:referential_id => @referential.id ) ] - else + else @available_imports = [ NeptuneImport.new(:referential_id => @referential.id ), NetexImport.new(:referential_id => @referential.id ), @@ -48,7 +49,7 @@ class ImportTasksController < ChouetteController ] end end - + def build_resource @import_task ||= if params[:import_task].present? import_task_parameters = params[:import_task] @@ -64,5 +65,5 @@ class ImportTasksController < ChouetteController @import_task = NeptuneImport.new end end - + end diff --git a/app/controllers/imports_controller.rb b/app/controllers/imports_controller.rb index 6c9d81d82..5e23a1795 100644 --- a/app/controllers/imports_controller.rb +++ b/app/controllers/imports_controller.rb @@ -1,4 +1,4 @@ -class ImportsController < InheritedResources::Base +class ImportsController < ChouetteController include PolicyChecker include RansackDateFilter before_action only: [:index] { set_date_time_params("started_at", DateTime) } diff --git a/app/controllers/journey_pattern_stop_points_controller.rb b/app/controllers/journey_pattern_stop_points_controller.rb index c4fc9b08f..65e41af3b 100644 --- a/app/controllers/journey_pattern_stop_points_controller.rb +++ b/app/controllers/journey_pattern_stop_points_controller.rb @@ -1,4 +1,5 @@ class JourneyPatternStopPointsController < ChouetteController + include ReferentialSupport defaults :resource_class => Chouette::JourneyPattern respond_to :html diff --git a/app/controllers/journey_patterns_collections_controller.rb b/app/controllers/journey_patterns_collections_controller.rb index 546158fa8..736fb1441 100644 --- a/app/controllers/journey_patterns_collections_controller.rb +++ b/app/controllers/journey_patterns_collections_controller.rb @@ -1,4 +1,5 @@ class JourneyPatternsCollectionsController < ChouetteController + include ReferentialSupport defaults :resource_class => Chouette::JourneyPattern before_action :user_permissions, only: :show diff --git a/app/controllers/journey_patterns_controller.rb b/app/controllers/journey_patterns_controller.rb index a72e7da7f..881ab6630 100644 --- a/app/controllers/journey_patterns_controller.rb +++ b/app/controllers/journey_patterns_controller.rb @@ -1,4 +1,5 @@ class JourneyPatternsController < ChouetteController + include ReferentialSupport defaults :resource_class => Chouette::JourneyPattern respond_to :html @@ -54,7 +55,7 @@ class JourneyPatternsController < ChouetteController private def journey_pattern_params - params.require(:journey_pattern).permit(:route_id, :objectid, :object_version, :creator_id, :name, :comment, :registration_number, :published_name, :departure_stop_point_id, :arrival_stop_point_id, {:stop_point_ids => []}) + params.require(:journey_pattern).permit(:route_id, :objectid, :object_version, :name, :comment, :registration_number, :published_name, :departure_stop_point_id, :arrival_stop_point_id, {:stop_point_ids => []}) end end diff --git a/app/controllers/line_footnotes_controller.rb b/app/controllers/line_footnotes_controller.rb index 2d4d10064..1fe677a39 100644 --- a/app/controllers/line_footnotes_controller.rb +++ b/app/controllers/line_footnotes_controller.rb @@ -1,4 +1,5 @@ class LineFootnotesController < ChouetteController + include ReferentialSupport defaults resource_class: Chouette::Line, collection_name: 'lines', instance_name: 'line' belongs_to :referential diff --git a/app/controllers/line_referentials_controller.rb b/app/controllers/line_referentials_controller.rb index f70ddef41..39c2cdb89 100644 --- a/app/controllers/line_referentials_controller.rb +++ b/app/controllers/line_referentials_controller.rb @@ -1,4 +1,4 @@ -class LineReferentialsController < InheritedResources::Base +class LineReferentialsController < ChouetteController defaults :resource_class => LineReferential diff --git a/app/controllers/lines_controller.rb b/app/controllers/lines_controller.rb index cf2908500..2f0ef1542 100644 --- a/app/controllers/lines_controller.rb +++ b/app/controllers/lines_controller.rb @@ -1,4 +1,4 @@ -class LinesController < InheritedResources::Base +class LinesController < ChouetteController include ApplicationHelper include PolicyChecker defaults :resource_class => Chouette::Line @@ -119,7 +119,6 @@ class LinesController < InheritedResources::Base :company_id, :objectid, :object_version, - :creator_id, :name, :number, :published_name, diff --git a/app/controllers/networks_controller.rb b/app/controllers/networks_controller.rb index 9d5e1bf0d..494d1e69f 100644 --- a/app/controllers/networks_controller.rb +++ b/app/controllers/networks_controller.rb @@ -1,4 +1,4 @@ -class NetworksController < InheritedResources::Base +class NetworksController < ChouetteController include ApplicationHelper include PolicyChecker defaults :resource_class => Chouette::Network @@ -72,7 +72,7 @@ class NetworksController < InheritedResources::Base helper_method :current_referential def network_params - params.require(:network).permit(:objectid, :object_version, :creator_id, :version_date, :description, :name, :registration_number, :source_name, :source_type_name, :source_identifier, :comment ) + params.require(:network).permit(:objectid, :object_version, :version_date, :description, :name, :registration_number, :source_name, :source_type_name, :source_identifier, :comment ) end private diff --git a/app/controllers/organisations_controller.rb b/app/controllers/organisations_controller.rb index d80541800..fa521faaf 100644 --- a/app/controllers/organisations_controller.rb +++ b/app/controllers/organisations_controller.rb @@ -1,4 +1,4 @@ -class OrganisationsController < InheritedResources::Base +class OrganisationsController < ChouetteController defaults :resource_class => Organisation respond_to :html, :only => [:edit, :show, :update] diff --git a/app/controllers/referential_companies_controller.rb b/app/controllers/referential_companies_controller.rb index fdbd83dc9..ca1ff67db 100644 --- a/app/controllers/referential_companies_controller.rb +++ b/app/controllers/referential_companies_controller.rb @@ -1,4 +1,5 @@ class ReferentialCompaniesController < ChouetteController + include ReferentialSupport defaults :resource_class => Chouette::Company, :collection_name => 'companies', :instance_name => 'company' respond_to :html respond_to :xml @@ -55,7 +56,7 @@ class ReferentialCompaniesController < ChouetteController end def company_params - params.require(:company).permit( :objectid, :object_version, :creator_id, :name, :short_name, :organizational_unit, :operating_department_name, :code, :phone, :fax, :email, :registration_number, :url, :time_zone ) + params.require(:company).permit( :objectid, :object_version, :name, :short_name, :organizational_unit, :operating_department_name, :code, :phone, :fax, :email, :registration_number, :url, :time_zone ) end private diff --git a/app/controllers/referential_group_of_lines_controller.rb b/app/controllers/referential_group_of_lines_controller.rb index d88daab84..1294fc5d5 100644 --- a/app/controllers/referential_group_of_lines_controller.rb +++ b/app/controllers/referential_group_of_lines_controller.rb @@ -1,4 +1,5 @@ class ReferentialGroupOfLinesController < ChouetteController + include ReferentialSupport defaults :resource_class => Chouette::GroupOfLine, :collection_name => 'group_of_lines', :instance_name => 'group_of_line' respond_to :html @@ -68,7 +69,7 @@ class ReferentialGroupOfLinesController < ChouetteController private def group_of_line_params - params.require(:group_of_line).permit( :objectid, :object_version, :creator_id, :name, :comment, :lines, :registration_number, :line_tokens) + params.require(:group_of_line).permit( :objectid, :object_version, :name, :comment, :lines, :registration_number, :line_tokens) end end diff --git a/app/controllers/referential_lines_controller.rb b/app/controllers/referential_lines_controller.rb index b9f8c0050..9e8f5c512 100644 --- a/app/controllers/referential_lines_controller.rb +++ b/app/controllers/referential_lines_controller.rb @@ -1,4 +1,5 @@ class ReferentialLinesController < ChouetteController + include ReferentialSupport include PolicyChecker defaults :resource_class => Chouette::Line, :collection_name => 'lines', :instance_name => 'line' @@ -127,7 +128,6 @@ class ReferentialLinesController < ChouetteController :company_id, :objectid, :object_version, - :creator_id, :name, :number, :published_name, :transport_mode, diff --git a/app/controllers/referential_networks_controller.rb b/app/controllers/referential_networks_controller.rb index 2131b8e57..b2d83f953 100644 --- a/app/controllers/referential_networks_controller.rb +++ b/app/controllers/referential_networks_controller.rb @@ -1,4 +1,5 @@ class ReferentialNetworksController < ChouetteController + include ReferentialSupport defaults :resource_class => Chouette::Network, :collection_name => 'networks', :instance_name => 'network' respond_to :html respond_to :xml @@ -64,7 +65,7 @@ class ReferentialNetworksController < ChouetteController end def network_params - params.require(:network).permit(:objectid, :object_version, :creator_id, :version_date, :description, :name, :registration_number, :source_name, :source_type_name, :source_identifier, :comment ) + params.require(:network).permit(:objectid, :object_version, :version_date, :description, :name, :registration_number, :source_name, :source_type_name, :source_identifier, :comment ) end private diff --git a/app/controllers/referential_stop_areas_controller.rb b/app/controllers/referential_stop_areas_controller.rb index 78dcd6dd9..0ed330180 100644 --- a/app/controllers/referential_stop_areas_controller.rb +++ b/app/controllers/referential_stop_areas_controller.rb @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- class ReferentialStopAreasController < ChouetteController + include ReferentialSupport defaults :resource_class => Chouette::StopArea, :collection_name => 'stop_areas', :instance_name => 'stop_area' belongs_to :referential do @@ -144,7 +145,7 @@ class ReferentialStopAreasController < ChouetteController end def stop_area_params - params.require(:stop_area).permit( :routing_stop_ids, :routing_line_ids, :children_ids, :stop_area_type, :parent_id, :objectid, :object_version, :creator_id, :name, :comment, :area_type, :registration_number, :nearest_topic_name, :fare_code, :longitude, :latitude, :long_lat_type, :country_code, :street_name, :zip_code, :city_name, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs, :coordinates, :url, :time_zone ) + params.require(:stop_area).permit( :routing_stop_ids, :routing_line_ids, :children_ids, :stop_area_type, :parent_id, :objectid, :object_version, :name, :comment, :area_type, :registration_number, :nearest_topic_name, :fare_code, :longitude, :latitude, :long_lat_type, :country_code, :street_name, :zip_code, :city_name, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs, :coordinates, :url, :time_zone ) end end diff --git a/app/controllers/referentials_controller.rb b/app/controllers/referentials_controller.rb index b63741ef6..ee1236912 100644 --- a/app/controllers/referentials_controller.rb +++ b/app/controllers/referentials_controller.rb @@ -1,4 +1,4 @@ -class ReferentialsController < InheritedResources::Base +class ReferentialsController < ChouetteController defaults :resource_class => Referential include PolicyChecker diff --git a/app/controllers/route_stop_points_controller.rb b/app/controllers/route_stop_points_controller.rb index 730bd08a9..36e1cbc4f 100644 --- a/app/controllers/route_stop_points_controller.rb +++ b/app/controllers/route_stop_points_controller.rb @@ -1,4 +1,5 @@ class RouteStopPointsController < ChouetteController + include ReferentialSupport defaults resource_class: Chouette::StopPoint actions :index respond_to :json, only: :index diff --git a/app/controllers/routes_controller.rb b/app/controllers/routes_controller.rb index 1a6c82484..79f49143a 100644 --- a/app/controllers/routes_controller.rb +++ b/app/controllers/routes_controller.rb @@ -1,4 +1,5 @@ class RoutesController < ChouetteController + include ReferentialSupport include PolicyChecker defaults :resource_class => Chouette::Route @@ -110,7 +111,6 @@ class RoutesController < ChouetteController :line_id, :objectid, :object_version, - :creator_id, :name, :comment, :opposite_route_id, diff --git a/app/controllers/routing_constraint_zones_controller.rb b/app/controllers/routing_constraint_zones_controller.rb index 6c3da5980..a72b288b8 100644 --- a/app/controllers/routing_constraint_zones_controller.rb +++ b/app/controllers/routing_constraint_zones_controller.rb @@ -1,4 +1,5 @@ class RoutingConstraintZonesController < ChouetteController + include ReferentialSupport include PolicyChecker defaults resource_class: Chouette::RoutingConstraintZone @@ -96,7 +97,6 @@ class RoutingConstraintZonesController < ChouetteController :route_id, :objectid, :object_version, - :creator_id ) end diff --git a/app/controllers/stop_area_copies_controller.rb b/app/controllers/stop_area_copies_controller.rb index fb429595e..992a2bb08 100644 --- a/app/controllers/stop_area_copies_controller.rb +++ b/app/controllers/stop_area_copies_controller.rb @@ -1,13 +1,14 @@ class StopAreaCopiesController < ChouetteController + include ReferentialSupport defaults :resource_class => StopAreaCopy belongs_to :referential do - belongs_to :stop_area, :parent_class => Chouette::StopArea + belongs_to :stop_area, :parent_class => Chouette::StopArea end - + actions :new, :create respond_to :html, :only => :new - - def new + + def new @stop_area_copy = StopAreaCopy.new(:hierarchy => params[:hierarchy], :source => parent) new! do build_breadcrumb :new @@ -25,6 +26,6 @@ class StopAreaCopiesController < ChouetteController end end - protected + protected end diff --git a/app/controllers/stop_area_referentials_controller.rb b/app/controllers/stop_area_referentials_controller.rb index e2815e5fb..85541230d 100644 --- a/app/controllers/stop_area_referentials_controller.rb +++ b/app/controllers/stop_area_referentials_controller.rb @@ -1,4 +1,4 @@ -class StopAreaReferentialsController < InheritedResources::Base +class StopAreaReferentialsController < ChouetteController defaults :resource_class => StopAreaReferential def sync diff --git a/app/controllers/stop_area_routing_lines_controller.rb b/app/controllers/stop_area_routing_lines_controller.rb index 9ba6fb40c..cba0a369c 100644 --- a/app/controllers/stop_area_routing_lines_controller.rb +++ b/app/controllers/stop_area_routing_lines_controller.rb @@ -1,11 +1,12 @@ class StopAreaRoutingLinesController < ChouetteController + include ReferentialSupport respond_to :json, :only => :index def index - respond_to do |format| - format.json { render :json => routing_lines_maps } - end + respond_to do |format| + format.json { render :json => routing_lines_maps } + end end def routing_lines_maps @@ -14,8 +15,8 @@ class StopAreaRoutingLinesController < ChouetteController end end - def routing_lines - referential.lines.all.select{ |p| p.name =~ /#{params[:q]}/i || p.number =~ /#{params[:q]}/i } + def routing_lines + referential.lines.all.select{ |p| p.name =~ /#{params[:q]}/i || p.number =~ /#{params[:q]}/i } end end diff --git a/app/controllers/stop_areas_controller.rb b/app/controllers/stop_areas_controller.rb index 0357878ec..133518324 100644 --- a/app/controllers/stop_areas_controller.rb +++ b/app/controllers/stop_areas_controller.rb @@ -1,4 +1,4 @@ -class StopAreasController < InheritedResources::Base +class StopAreasController < ChouetteController include ApplicationHelper defaults :resource_class => Chouette::StopArea @@ -171,7 +171,7 @@ class StopAreasController < InheritedResources::Base helper_method :current_referential def stop_area_params - params.require(:stop_area).permit( :routing_stop_ids, :routing_line_ids, :children_ids, :stop_area_type, :parent_id, :objectid, :object_version, :creator_id, :name, :comment, :area_type, :registration_number, :nearest_topic_name, :fare_code, :longitude, :latitude, :long_lat_type, :country_code, :street_name, :zip_code, :city_name, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs, :coordinates, :url, :time_zone ) + params.require(:stop_area).permit( :routing_stop_ids, :routing_line_ids, :children_ids, :stop_area_type, :parent_id, :objectid, :object_version, :name, :comment, :area_type, :registration_number, :nearest_topic_name, :fare_code, :longitude, :latitude, :long_lat_type, :country_code, :street_name, :zip_code, :city_name, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs, :coordinates, :url, :time_zone ) end end diff --git a/app/controllers/time_table_combinations_controller.rb b/app/controllers/time_table_combinations_controller.rb index ba61a2ea4..26cd425b3 100644 --- a/app/controllers/time_table_combinations_controller.rb +++ b/app/controllers/time_table_combinations_controller.rb @@ -1,4 +1,5 @@ class TimeTableCombinationsController < ChouetteController + include ReferentialSupport belongs_to :referential do belongs_to :time_table, :parent_class => Chouette::TimeTable end diff --git a/app/controllers/time_tables_controller.rb b/app/controllers/time_tables_controller.rb index 0c1769ad7..a0fa168f0 100644 --- a/app/controllers/time_tables_controller.rb +++ b/app/controllers/time_tables_controller.rb @@ -1,4 +1,5 @@ class TimeTablesController < ChouetteController + include ReferentialSupport include TimeTablesHelper include RansackDateFilter before_action only: [:index] { set_date_time_params("bounding_dates", Date) } @@ -179,7 +180,6 @@ class TimeTablesController < ChouetteController params.require(:time_table).permit( :objectid, :object_version, - :creator_id, :calendar_id, :version, :comment, :color, :int_day_types, diff --git a/app/controllers/timebands_controller.rb b/app/controllers/timebands_controller.rb index 765557193..937283b0e 100644 --- a/app/controllers/timebands_controller.rb +++ b/app/controllers/timebands_controller.rb @@ -1,4 +1,5 @@ class TimebandsController < ChouetteController + include ReferentialSupport defaults :resource_class => Chouette::Timeband diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 2452a2796..6343320a4 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,4 +1,4 @@ -class UsersController < InheritedResources::Base +class UsersController < ChouetteController defaults :resource_class => User diff --git a/app/controllers/vehicle_journey_exports_controller.rb b/app/controllers/vehicle_journey_exports_controller.rb index 0cc30f23a..2ce47e51f 100644 --- a/app/controllers/vehicle_journey_exports_controller.rb +++ b/app/controllers/vehicle_journey_exports_controller.rb @@ -1,22 +1,23 @@ class VehicleJourneyExportsController < ChouetteController + include ReferentialSupport belongs_to :referential do belongs_to :line, :parent_class => Chouette::Line do belongs_to :route, :parent_class => Chouette::Route end end - + respond_to :csv, :only => [:index] respond_to :zip, :only => [:index] #respond_to :xls, :only => [:index] def index - index! do |format| + index! do |format| format.csv { send_data VehicleJourneyExport.new(:route => route, :vehicle_journeys => vehicle_journeys).to_csv(:col_sep => ";") , :filename => t("vehicle_journey_exports.new.basename")+"_#{route.id}.csv" } format.zip do begin temp_file = Tempfile.new("vehicle_journey_export") VehicleJourneyExport.new(:route => route, :vehicle_journeys => vehicle_journeys).to_zip(temp_file,:col_sep => ";") - send_data File.read(temp_file.path), :filename => t("vehicle_journey_exports.new.basename")+"_#{route.id}.zip" + send_data File.read(temp_file.path), :filename => t("vehicle_journey_exports.new.basename")+"_#{route.id}.zip" ensure temp_file.close temp_file.unlink @@ -25,15 +26,15 @@ class VehicleJourneyExportsController < ChouetteController #format.xls end end - + protected - - + + alias_method :route, :parent - + def collection @vehicle_journeys ||= route.vehicle_journeys.includes(:vehicle_journey_at_stops).order("vehicle_journey_at_stops.departure_time") end alias_method :vehicle_journeys, :collection - + end diff --git a/app/controllers/vehicle_journey_imports_controller.rb b/app/controllers/vehicle_journey_imports_controller.rb index 58f8816aa..aec90f7ec 100644 --- a/app/controllers/vehicle_journey_imports_controller.rb +++ b/app/controllers/vehicle_journey_imports_controller.rb @@ -1,4 +1,5 @@ class VehicleJourneyImportsController < ChouetteController + include ReferentialSupport defaults :resource_class => VehicleJourneyImport belongs_to :referential do diff --git a/app/controllers/vehicle_journeys_collections_controller.rb b/app/controllers/vehicle_journeys_collections_controller.rb index caaa2258e..712bcc154 100644 --- a/app/controllers/vehicle_journeys_collections_controller.rb +++ b/app/controllers/vehicle_journeys_collections_controller.rb @@ -1,4 +1,5 @@ class VehicleJourneysCollectionsController < ChouetteController + include ReferentialSupport respond_to :json belongs_to :referential do belongs_to :line, :parent_class => Chouette::Line do diff --git a/app/controllers/vehicle_journeys_controller.rb b/app/controllers/vehicle_journeys_controller.rb index 050f2f219..c941aeae4 100644 --- a/app/controllers/vehicle_journeys_controller.rb +++ b/app/controllers/vehicle_journeys_controller.rb @@ -1,4 +1,5 @@ class VehicleJourneysController < ChouetteController + include ReferentialSupport defaults :resource_class => Chouette::VehicleJourney before_action :user_permissions, only: :index diff --git a/app/controllers/vehicle_translations_controller.rb b/app/controllers/vehicle_translations_controller.rb index 65a0db7fe..5b6b392ac 100644 --- a/app/controllers/vehicle_translations_controller.rb +++ b/app/controllers/vehicle_translations_controller.rb @@ -1,4 +1,5 @@ class VehicleTranslationsController < ChouetteController + include ReferentialSupport respond_to :js, :only => [:new, :create] belongs_to :referential do diff --git a/app/controllers/workbenches_controller.rb b/app/controllers/workbenches_controller.rb index 9b4f0d6c4..b2dac9e67 100644 --- a/app/controllers/workbenches_controller.rb +++ b/app/controllers/workbenches_controller.rb @@ -1,4 +1,4 @@ -class WorkbenchesController < InheritedResources::Base +class WorkbenchesController < ChouetteController before_action :query_params, only: [:show] include RansackDateFilter before_action only: [:show] { set_date_time_params("validity_period", Date) } diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0a7b0fb75..2ce1de497 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,7 +1,33 @@ + module ApplicationHelper include NewapplicationHelper + def page_header_title(object) + # Unwrap from decorator, we want to know the object model name + object = object.object if object.try(:object) + local = "#{object.model_name.name.underscore.pluralize}.#{params[:action]}.title" + if object.try(:name) + t(local, name: object.name) + else + t(local) + end + end + + def page_header_meta(object) + info = t('last_update', time: l(object.updated_at, format: :short)) + if object.try(:versions) + author = object.versions.try(:last).try(:whodunnit) || t('default_whodunnit') + info = "#{info} #{t('whodunnit', author: author)}" + end + content_tag :div, info.html_safe, class: 'small' + end + + def page_header_content_for(object) + content_for :page_header_title, page_header_title(object) + content_for :page_header_meta, page_header_meta(object) + end + def font_awesome_classic_tag(name) name = "fa-file-text-o" if name == "fa-file-csv-o" name = "fa-file-code-o" if name == "fa-file-xml-o" diff --git a/app/models/api/v1/api_key.rb b/app/models/api/v1/api_key.rb index 767e65f3a..09c6f77ac 100644 --- a/app/models/api/v1/api_key.rb +++ b/app/models/api/v1/api_key.rb @@ -1,6 +1,7 @@ module Api module V1 class ApiKey < ::ActiveRecord::Base + has_paper_trail before_create :generate_access_token belongs_to :referential, :class_name => '::Referential' belongs_to :organisation, :class_name => '::Organisation' diff --git a/app/models/calendar.rb b/app/models/calendar.rb index bb38e74df..b2e73929f 100644 --- a/app/models/calendar.rb +++ b/app/models/calendar.rb @@ -3,7 +3,7 @@ require_relative 'calendar/date_value' require_relative 'calendar/period' class Calendar < ActiveRecord::Base - + has_paper_trail belongs_to :organisation has_many :time_tables diff --git a/app/models/chouette/access_link.rb b/app/models/chouette/access_link.rb index 46fbcb631..4b99ab5ba 100644 --- a/app/models/chouette/access_link.rb +++ b/app/models/chouette/access_link.rb @@ -1,5 +1,6 @@ module Chouette class AccessLink < Chouette::TridentActiveRecord + has_paper_trail include ObjectidSupport # FIXME http://jira.codehaus.org/browse/JRUBY-6358 self.primary_key = "id" @@ -50,11 +51,11 @@ module Chouette def link_key Chouette::AccessLink.build_link_key(access_point,stop_area,link_orientation_type) end - + def self.build_link_key(access_point,stop_area,link_orientation_type) if link_orientation_type == "access_point_to_stop_area" "A_#{access_point.id}-S_#{stop_area.id}" - else + else "S_#{stop_area.id}-A_#{access_point.id}" end end @@ -63,4 +64,4 @@ module Chouette Chouette::Geometry::AccessLinkPresenter.new self end end -end
\ No newline at end of file +end diff --git a/app/models/chouette/access_point.rb b/app/models/chouette/access_point.rb index 7757fdcfb..7428db1ea 100644 --- a/app/models/chouette/access_point.rb +++ b/app/models/chouette/access_point.rb @@ -1,8 +1,10 @@ require 'geokit' require 'geo_ruby' + module Chouette class AccessPoint < Chouette::ActiveRecord + has_paper_trail # FIXME http://jira.codehaus.org/browse/JRUBY-6358 self.primary_key = "id" @@ -167,4 +169,4 @@ module Chouette Chouette::Geometry::AccessPointPresenter.new self end end -end
\ No newline at end of file +end diff --git a/app/models/chouette/company.rb b/app/models/chouette/company.rb index d79e5ff59..12b21e347 100644 --- a/app/models/chouette/company.rb +++ b/app/models/chouette/company.rb @@ -3,6 +3,7 @@ module Chouette include CompanyRestrictions include LineReferentialSupport include ObjectidSupport + has_paper_trail has_many :lines @@ -16,4 +17,4 @@ module Chouette end -end
\ No newline at end of file +end diff --git a/app/models/chouette/connection_link.rb b/app/models/chouette/connection_link.rb index d19b53974..d5ddc606a 100644 --- a/app/models/chouette/connection_link.rb +++ b/app/models/chouette/connection_link.rb @@ -1,5 +1,6 @@ module Chouette class ConnectionLink < Chouette::TridentActiveRecord + has_paper_trail include ObjectidSupport include ConnectionLinkRestrictions # FIXME http://jira.codehaus.org/browse/JRUBY-6358 @@ -47,4 +48,4 @@ module Chouette end end -end
\ No newline at end of file +end diff --git a/app/models/chouette/group_of_line.rb b/app/models/chouette/group_of_line.rb index 3023d23ed..75ee1ce73 100644 --- a/app/models/chouette/group_of_line.rb +++ b/app/models/chouette/group_of_line.rb @@ -1,5 +1,6 @@ module Chouette class GroupOfLine < Chouette::ActiveRecord + has_paper_trail include ObjectidSupport include GroupOfLineRestrictions include LineReferentialSupport @@ -30,4 +31,4 @@ module Chouette end end -end
\ No newline at end of file +end diff --git a/app/models/chouette/journey_pattern.rb b/app/models/chouette/journey_pattern.rb index c1f9fb4f8..a62da6353 100644 --- a/app/models/chouette/journey_pattern.rb +++ b/app/models/chouette/journey_pattern.rb @@ -1,5 +1,6 @@ module Chouette class JourneyPattern < Chouette::TridentActiveRecord + has_paper_trail include ChecksumSupport include JourneyPatternRestrictions include ObjectidSupport diff --git a/app/models/chouette/line.rb b/app/models/chouette/line.rb index afb3e3571..784e3f5b9 100644 --- a/app/models/chouette/line.rb +++ b/app/models/chouette/line.rb @@ -1,5 +1,6 @@ module Chouette class Line < Chouette::ActiveRecord + has_paper_trail include LineRestrictions include LineReferentialSupport include ObjectidSupport diff --git a/app/models/chouette/network.rb b/app/models/chouette/network.rb index f0a79ec13..9b3f2fe29 100644 --- a/app/models/chouette/network.rb +++ b/app/models/chouette/network.rb @@ -1,12 +1,12 @@ module Chouette class Network < Chouette::ActiveRecord + has_paper_trail include NetworkRestrictions include LineReferentialSupport include ObjectidSupport extend Enumerize # FIXME http://jira.codehaus.org/browse/JRUBY-6358 self.primary_key = "id" - has_many :lines attr_accessor :source_type_name diff --git a/app/models/chouette/pt_link.rb b/app/models/chouette/pt_link.rb index 5bf77da02..d14d5f29c 100644 --- a/app/models/chouette/pt_link.rb +++ b/app/models/chouette/pt_link.rb @@ -2,9 +2,9 @@ require 'geokit' module Chouette class PtLink < Chouette::ActiveRecord + has_paper_trail # FIXME http://jira.codehaus.org/browse/JRUBY-6358 self.primary_key = "id" - include Geokit::Mappable def geometry @@ -34,4 +34,4 @@ module Chouette end end end -end
\ No newline at end of file +end diff --git a/app/models/chouette/route.rb b/app/models/chouette/route.rb index 1f4088aa7..5c0ad24a1 100644 --- a/app/models/chouette/route.rb +++ b/app/models/chouette/route.rb @@ -1,5 +1,7 @@ + module Chouette class Route < Chouette::TridentActiveRecord + has_paper_trail include RouteRestrictions include ChecksumSupport include ObjectidSupport @@ -190,4 +192,4 @@ module Chouette end end -end
\ No newline at end of file +end diff --git a/app/models/chouette/routing_constraint_zone.rb b/app/models/chouette/routing_constraint_zone.rb index 70b016a48..fcf47f154 100644 --- a/app/models/chouette/routing_constraint_zone.rb +++ b/app/models/chouette/routing_constraint_zone.rb @@ -1,5 +1,6 @@ module Chouette class RoutingConstraintZone < Chouette::TridentActiveRecord + has_paper_trail include ChecksumSupport include ObjectidSupport @@ -43,4 +44,4 @@ module Chouette route.name end end -end
\ No newline at end of file +end diff --git a/app/models/chouette/stop_area.rb b/app/models/chouette/stop_area.rb index 5d8b5033f..cc7170728 100644 --- a/app/models/chouette/stop_area.rb +++ b/app/models/chouette/stop_area.rb @@ -1,8 +1,8 @@ require 'geokit' require 'geo_ruby' - module Chouette class StopArea < Chouette::ActiveRecord + has_paper_trail include ProjectionFields include StopAreaRestrictions include StopAreaReferentialSupport @@ -325,4 +325,4 @@ module Chouette end end -end
\ No newline at end of file +end diff --git a/app/models/chouette/stop_point.rb b/app/models/chouette/stop_point.rb index f4c9b3800..3b9eaa2f6 100644 --- a/app/models/chouette/stop_point.rb +++ b/app/models/chouette/stop_point.rb @@ -1,6 +1,6 @@ module Chouette class StopPoint < Chouette::TridentActiveRecord - + has_paper_trail def self.policy_class RoutePolicy end @@ -57,4 +57,4 @@ module Chouette Chouette::StopArea.where(:area_type => ['Quay', 'BoardingPosition']) end end -end
\ No newline at end of file +end diff --git a/app/models/chouette/time_table.rb b/app/models/chouette/time_table.rb index 09d3e2244..74c20f061 100644 --- a/app/models/chouette/time_table.rb +++ b/app/models/chouette/time_table.rb @@ -1,11 +1,11 @@ module Chouette class TimeTable < Chouette::TridentActiveRecord + has_paper_trail include ChecksumSupport include TimeTableRestrictions include ObjectidSupport # FIXME http://jira.codehaus.org/browse/JRUBY-6358 self.primary_key = "id" - acts_as_taggable attr_accessor :monday,:tuesday,:wednesday,:thursday,:friday,:saturday,:sunday @@ -570,4 +570,4 @@ module Chouette tt end end -end
\ No newline at end of file +end diff --git a/app/models/chouette/timeband.rb b/app/models/chouette/timeband.rb index 21c81ab1c..6155ffc77 100644 --- a/app/models/chouette/timeband.rb +++ b/app/models/chouette/timeband.rb @@ -9,7 +9,7 @@ module Chouette class Timeband < Chouette::TridentActiveRecord include ObjectidSupport - + has_paper_trail self.primary_key = "id" validates :start_time, :end_time, presence: true @@ -26,4 +26,4 @@ module Chouette "#{self.name} (#{fullname})" if self.name end end -end
\ No newline at end of file +end diff --git a/app/models/chouette/vehicle_journey.rb b/app/models/chouette/vehicle_journey.rb index d7a660287..247c30668 100644 --- a/app/models/chouette/vehicle_journey.rb +++ b/app/models/chouette/vehicle_journey.rb @@ -1,5 +1,6 @@ module Chouette class VehicleJourney < Chouette::TridentActiveRecord + has_paper_trail include ChecksumSupport include VehicleJourneyRestrictions include ObjectidSupport diff --git a/app/models/compliance_check_set.rb b/app/models/compliance_check_set.rb index fa7d72621..d734e5f5a 100644 --- a/app/models/compliance_check_set.rb +++ b/app/models/compliance_check_set.rb @@ -1,5 +1,6 @@ class ComplianceCheckSet < ActiveRecord::Base extend Enumerize + has_paper_trail belongs_to :referential belongs_to :compliance_control_set diff --git a/app/models/compliance_control_set.rb b/app/models/compliance_control_set.rb index deb46f5a1..41076fefc 100644 --- a/app/models/compliance_control_set.rb +++ b/app/models/compliance_control_set.rb @@ -1,4 +1,5 @@ class ComplianceControlSet < ActiveRecord::Base + has_paper_trail belongs_to :organisation has_many :compliance_control_blocks, dependent: :destroy has_many :compliance_controls, dependent: :destroy diff --git a/app/models/concerns/default_attributes_support.rb b/app/models/concerns/default_attributes_support.rb index e85a59160..2ef9149cb 100644 --- a/app/models/concerns/default_attributes_support.rb +++ b/app/models/concerns/default_attributes_support.rb @@ -47,7 +47,6 @@ module DefaultAttributesSupport else self.object_version += 1 end - self.creator_id = 'chouette' end def reset_auto_columns diff --git a/app/models/dashboard.rb b/app/models/dashboard.rb index a53267db5..46c621266 100644 --- a/app/models/dashboard.rb +++ b/app/models/dashboard.rb @@ -11,8 +11,11 @@ class Dashboard @@default_class = self mattr_accessor :default_class - attr_reader :context + def self.model_name + ActiveModel::Name.new Dashboard, Dashboard, "Dashboard" + end + attr_reader :context def initialize(context) @context = context end diff --git a/app/views/api/kml/access_links/index.kml.slim b/app/views/api/kml/access_links/index.kml.slim index 1bcfdacf1..06db8bf9d 100644 --- a/app/views/api/kml/access_links/index.kml.slim +++ b/app/views/api/kml/access_links/index.kml.slim @@ -8,7 +8,7 @@ kml xmlns="http://www.opengis.net/kml/2.2" placemark id="#{access_link.objectid}" name = h(access_link.name) extendeddata - - [ :access_link_type, :objectid, :object_version, :created_at, :updated_at, :creator_id, :name, :comment, :link_distance, :link_type, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration, :mobility_restricted_traveller_duration, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs, :link_orientation].each do |prop| + - [ :access_link_type, :objectid, :object_version, :created_at, :updated_at, :name, :comment, :link_distance, :link_type, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration, :mobility_restricted_traveller_duration, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs, :link_orientation].each do |prop| data name="#{prop.to_s}" value = h(access_link.send( prop)) diff --git a/app/views/api/kml/access_points/index.kml.slim b/app/views/api/kml/access_points/index.kml.slim index 1a162f7ed..c6f6b7797 100644 --- a/app/views/api/kml/access_points/index.kml.slim +++ b/app/views/api/kml/access_points/index.kml.slim @@ -9,7 +9,7 @@ kml xmlns="http://www.opengis.net/kml/2.2" placemark id="#{access_point.objectid}" name = h(access_point.name) extendeddata - - [ :objectid, :object_version, :creator_id, :created_at, :updated_at, :name, :comment, :longitude, :latitude, :long_lat_type, :country_code, :street_name, :openning_time, :closing_time, :access_type, :access_point_type, :mobility_restricted_suitability, :stairs_availability, :lift_availability].each do |prop| + - [ :objectid, :object_version, :created_at, :updated_at, :name, :comment, :longitude, :latitude, :long_lat_type, :country_code, :street_name, :openning_time, :closing_time, :access_type, :access_point_type, :mobility_restricted_suitability, :stairs_availability, :lift_availability].each do |prop| data name="#{prop.to_s}" value = h(access_point.send( prop)) diff --git a/app/views/api/kml/connection_links/index.kml.slim b/app/views/api/kml/connection_links/index.kml.slim index 7305fbc78..0acdeaafe 100644 --- a/app/views/api/kml/connection_links/index.kml.slim +++ b/app/views/api/kml/connection_links/index.kml.slim @@ -8,7 +8,7 @@ kml xmlns="http://www.opengis.net/kml/2.2" placemark id="#{connection_link.objectid}" name = h(connection_link.name) extendeddata - - [ :connection_link_type, :objectid, :object_version, :creator_id, :created_at, :updated_at, :name, :comment, :link_distance, :link_type, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration, :mobility_restricted_traveller_duration, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs].each do |prop| + - [ :connection_link_type, :objectid, :object_version, :created_at, :updated_at, :name, :comment, :link_distance, :link_type, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration, :mobility_restricted_traveller_duration, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs].each do |prop| data name="#{prop.to_s}" value = h(connection_link.send( prop)) diff --git a/app/views/api/kml/journey_patterns/show.kml.slim b/app/views/api/kml/journey_patterns/show.kml.slim index 15fb96daa..347d358cc 100644 --- a/app/views/api/kml/journey_patterns/show.kml.slim +++ b/app/views/api/kml/journey_patterns/show.kml.slim @@ -4,7 +4,7 @@ kml xmlns="http://www.opengis.net/kml/2.2" document name = "#{h(Chouette::JourneyPattern.model_name.human)} : #{h(@journey_pattern.name)}" extendeddata - - [:objectid, :object_version, :creator_id, :created_at, :updated_at, :name, :comment, :registration_number, :published_name].each do |prop| + - [:objectid, :object_version, :created_at, :updated_at, :name, :comment, :registration_number, :published_name].each do |prop| data name="#{prop.to_s}" value = h(@journey_pattern.send( prop)) @@ -17,7 +17,7 @@ kml xmlns="http://www.opengis.net/kml/2.2" placemark id="#{stop_area.objectid}" name = h(stop_area.name) extendeddata - - [ :objectid, :object_version, :creator_id, :name, :comment, :area_type, :registration_number, :nearest_topic_name, :fare_code, :longitude, :latitude, :long_lat_type, :country_code, :street_name, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs].each do |prop| + - [ :objectid, :object_version, :name, :comment, :area_type, :registration_number, :nearest_topic_name, :fare_code, :longitude, :latitude, :long_lat_type, :country_code, :street_name, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs].each do |prop| data name="#{prop.to_s}" value = h(stop_area.send( prop)) diff --git a/app/views/api/kml/lines/show.kml.slim b/app/views/api/kml/lines/show.kml.slim index d1e48323d..1163c98d3 100644 --- a/app/views/api/kml/lines/show.kml.slim +++ b/app/views/api/kml/lines/show.kml.slim @@ -7,7 +7,7 @@ kml xmlns="http://www.opengis.net/kml/2.2" placemark id="#{@line.objectid}" name = h(@line.name) extendeddata - - [ :transport_mode, :objectid, :created_at, :updated_at, :object_version, :creator_id, :name, :number, :published_name, :registration_number, :comment, :mobility_restricted_suitability, :int_user_needs].each do |prop| + - [ :transport_mode, :objectid, :created_at, :updated_at, :object_version, :name, :number, :published_name, :registration_number, :comment, :mobility_restricted_suitability, :int_user_needs].each do |prop| data name="#{prop.to_s}" value = h(@line.send( prop)) diff --git a/app/views/api/kml/routes/show.kml.slim b/app/views/api/kml/routes/show.kml.slim index 8a2843bc0..fdf73754d 100644 --- a/app/views/api/kml/routes/show.kml.slim +++ b/app/views/api/kml/routes/show.kml.slim @@ -6,7 +6,7 @@ kml xmlns="http://www.opengis.net/kml/2.2" placemark id="#{@route.objectid}" name = h(@route.name) extendeddata - - [:direction, :wayback, :objectid, :object_version, :creator_id, :created_at, :updated_at, :name, :comment, :published_name, :number, :direction_text, :wayback_text].each do |prop| + - [:direction, :wayback, :objectid, :object_version, :created_at, :updated_at, :name, :comment, :published_name, :number, :direction_text, :wayback_text].each do |prop| data name="#{prop.to_s}" value = h(@route.send( prop)) diff --git a/app/views/api/kml/stop_areas/index.kml.slim b/app/views/api/kml/stop_areas/index.kml.slim index a08dbf963..284bd3e34 100644 --- a/app/views/api/kml/stop_areas/index.kml.slim +++ b/app/views/api/kml/stop_areas/index.kml.slim @@ -8,7 +8,7 @@ kml xmlns="http://www.opengis.net/kml/2.2" placemark id="#{stop_area.objectid}" name = h(stop_area.name) extendeddata - - [:objectid, :object_version, :creator_id, :created_at, :updated_at, :name, :comment, :area_type, :registration_number, :nearest_topic_name, :fare_code, :longitude, :latitude, :long_lat_type, :country_code, :street_name, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs].each do |prop| + - [:objectid, :object_version, :created_at, :updated_at, :name, :comment, :area_type, :registration_number, :nearest_topic_name, :fare_code, :longitude, :latitude, :long_lat_type, :country_code, :street_name, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs].each do |prop| data name="#{prop.to_s}" value = h(stop_area.send( prop)) diff --git a/app/views/api/v1/compliance_check_sets/validated.rabl b/app/views/api/v1/compliance_check_sets/validated.rabl index 1368a8014..4dfa9e420 100644 --- a/app/views/api/v1/compliance_check_sets/validated.rabl +++ b/app/views/api/v1/compliance_check_sets/validated.rabl @@ -4,7 +4,6 @@ attributes( :id, :referential_id, :name, - :creator, :status, :started_at, :ended_at diff --git a/app/views/api/v1/group_of_lines/short_description.rabl b/app/views/api/v1/group_of_lines/short_description.rabl index 770b334ec..15465874c 100644 --- a/app/views/api/v1/group_of_lines/short_description.rabl +++ b/app/views/api/v1/group_of_lines/short_description.rabl @@ -1,6 +1,6 @@ object @group_of_line extends "api/v1/trident_objects/short_description" -[ :creator_id, :name].each do |attr| +[:name].each do |attr| attributes attr, :unless => lambda { |m| m.send( attr).nil?} end diff --git a/app/views/api/v1/group_of_lines/show.rabl b/app/views/api/v1/group_of_lines/show.rabl index 96e4bfc58..d02247da9 100644 --- a/app/views/api/v1/group_of_lines/show.rabl +++ b/app/views/api/v1/group_of_lines/show.rabl @@ -1,6 +1,6 @@ object @group_of_line extends "api/v1/trident_objects/show" -[ :creator_id, :name].each do |attr| +[:name].each do |attr| attributes attr, :unless => lambda { |m| m.send( attr).nil?} end diff --git a/app/views/api/v1/trident_objects/show.rabl b/app/views/api/v1/trident_objects/show.rabl index e58c0a866..9722594e1 100644 --- a/app/views/api/v1/trident_objects/show.rabl +++ b/app/views/api/v1/trident_objects/show.rabl @@ -1,5 +1,5 @@ attributes :objectid => :object_id -[ :object_version, :created_at, :updated_at, :creator_id].each do |attr| +[ :object_version, :created_at, :updated_at].each do |attr| attributes attr, :unless => lambda { |m| m.send( attr).nil?} end diff --git a/app/views/api_keys/edit.html.slim b/app/views/api_keys/edit.html.slim index 9d7d1fdb7..50808b5a4 100644 --- a/app/views/api_keys/edit.html.slim +++ b/app/views/api_keys/edit.html.slim @@ -1,16 +1,10 @@ -/ PageHeader -= pageheader 'Clé d\'API', - t('api_keys.edit.title'), - 'Lorem ipsum dolor sit amet', - t('last_update', time: l(@api_key.updated_at, format: :short)), - '' - - / Below are secondary actions & optional content (filters, ...) +- page_header_content_for @api_key +- content_for :page_header_content do + - if policy(@api_key).destroy? .row.mb-sm .col-lg-12.text-right - = ( policy(@api_key).destroy? ? link_to(t('actions.destroy'), api_key_path(@api_key), :method => :delete, class: 'btn btn-default') : '' ) + = link_to(t('actions.destroy'), api_key_path(@api_key), :method => :delete, class: 'btn btn-default') -/ PageContent .page_content .container-fluid .row diff --git a/app/views/api_keys/new.html.slim b/app/views/api_keys/new.html.slim index 9acb08a94..2bed9f912 100644 --- a/app/views/api_keys/new.html.slim +++ b/app/views/api_keys/new.html.slim @@ -1,10 +1,3 @@ -/ PageHeader -= pageheader 'Clé d\'API', - t('api_keys.new.title'), - 'Lorem ipsum dolor sit amet', - '' - -/ PageContent .page_content .container-fluid .row diff --git a/app/views/calendars/edit.html.slim b/app/views/calendars/edit.html.slim index 3463bd05c..e806fc94b 100644 --- a/app/views/calendars/edit.html.slim +++ b/app/views/calendars/edit.html.slim @@ -1,11 +1,5 @@ - breadcrumb :calendar, @calendar -/ PageHeader -= pageheader 'modele-calendrier', - t('.title', calendar: @calendar.name), - '', - t('last_update', time: l(@calendar.updated_at, format: :short)) - -/ PageContent +- page_header_content_for @calendar .page_content .container-fluid .row diff --git a/app/views/calendars/index.html.slim b/app/views/calendars/index.html.slim index a95d54428..77478a624 100644 --- a/app/views/calendars/index.html.slim +++ b/app/views/calendars/index.html.slim @@ -1,12 +1,8 @@ - breadcrumb :calendars -/ PageHeader -- header_params = ['modele-calendrier', - t('.title'), - ''] -- header_params << link_to(t('actions.add'), new_calendar_path, class: 'btn btn-default') if policy(Calendar).create? -= pageheader(*header_params) do +- content_for :page_header_actions do + - if policy(Calendar).create? + = link_to(t('actions.add'), new_calendar_path, class: 'btn btn-default') -/ PageContent .page_content .container-fluid - if params[:q].present? or @calendars.any? diff --git a/app/views/calendars/new.html.slim b/app/views/calendars/new.html.slim index 146173d35..ce8b6a036 100644 --- a/app/views/calendars/new.html.slim +++ b/app/views/calendars/new.html.slim @@ -1,11 +1,4 @@ - breadcrumb :calendars -/ PageHeader -= pageheader 'modele-calendrier', - t('.title'), - '', - '' - -/ PageContent .page_content .container-fluid .row diff --git a/app/views/calendars/show.html.slim b/app/views/calendars/show.html.slim index b2ace0ccc..da4afa3e6 100644 --- a/app/views/calendars/show.html.slim +++ b/app/views/calendars/show.html.slim @@ -1,12 +1,6 @@ - breadcrumb :calendar, @calendar -/ PageHeader -= pageheader 'modele-calendrier', - @calendar.name, - '', - t('last_update', time: l(@calendar.updated_at, format: :short)), - (policy(@calendar).edit? ? link_to(t('actions.edit'), edit_calendar_path(@calendar), class: 'btn btn-default') : '') do - - / Below is secondary actions & optional contents (filters, ...) +- page_header_content_for @calendar +- content_for :page_header_content do .row.mb-sm .col-lg-12.text-right - @calendar.action_links.each do |link| @@ -15,8 +9,10 @@ data: link.data, class: 'btn btn-primary' do = link.content +- if policy(@calendar).edit? + - content_for :page_header_actions do + = link_to(t('actions.edit'), edit_calendar_path(@calendar), class: 'btn btn-default') -/ PageContent .page_content .container-fluid .row diff --git a/app/views/companies/edit.html.slim b/app/views/companies/edit.html.slim index a20efeb46..faa88f829 100644 --- a/app/views/companies/edit.html.slim +++ b/app/views/companies/edit.html.slim @@ -1,11 +1,3 @@ - breadcrumb :company, @company -/ PageHeader -= pageheader 'jeux-de-controle', - t('companies.edit.title', company: @company.name) - -/ PageContent -.page_content - .container-fluid - .row - .col-lg-8.col-lg-offset-2.col-md-8.col-md-offset-2.col-sm-10.col-sm-offset-1 - = render 'form' +- page_header_content_for @company += render 'form'
\ No newline at end of file diff --git a/app/views/companies/index.html.slim b/app/views/companies/index.html.slim index 8fcadc370..5d746642f 100644 --- a/app/views/companies/index.html.slim +++ b/app/views/companies/index.html.slim @@ -1,12 +1,8 @@ - breadcrumb :companies, @line_referential -/ PageHeader -= pageheader 'transporteur', - t('companies.index.title'), - 'Lorem ipsum dolor sit amet', - '', - (policy(Chouette::Company).create? ? link_to(t('companies.actions.new'), new_line_referential_company_path(@line_referential), class: 'btn btn-primary') : '') +- content_for :page_header_actions do + - if policy(Chouette::Company).create? + = link_to(t('companies.actions.new'), new_line_referential_company_path(@line_referential), class: 'btn btn-primary') -/ PageContent .page_content .container-fluid - if params[:q].present? or @companies.any? diff --git a/app/views/companies/new.html.slim b/app/views/companies/new.html.slim index d80916ed9..cc085ffe2 100644 --- a/app/views/companies/new.html.slim +++ b/app/views/companies/new.html.slim @@ -1,12 +1,6 @@ - breadcrumb :lines, @line_referential -/ PageHeader -= pageheader 'jeux-de-controle', - t('companies.new.title') - - -/ PageContent .page_content .container-fluid .row .col-lg-8.col-lg-offset-2.col-md-8.col-md-offset-2.col-sm-10.col-sm-offset-1 - = render 'form' + = render 'form'
\ No newline at end of file diff --git a/app/views/companies/show.html.slim b/app/views/companies/show.html.slim index eebb4a57c..0d6b4aae3 100644 --- a/app/views/companies/show.html.slim +++ b/app/views/companies/show.html.slim @@ -1,11 +1,6 @@ - breadcrumb :company, @company -/ PageHeader -= pageheader 'transporteur', - @company.name, - 'Lorem ipsum dolor sit amet', - t('last_update', time: l(@company.updated_at, format: :short)) do - / Below is secundary actions & optional contents (filters, ...) +- content_for :page_header_content do .row .col-lg-12.text-right.mb-sm - if policy(Chouette::Company).create? @@ -16,8 +11,9 @@ = link_to line_referential_company_path(@line_referential, @company), method: :delete, data: {confirm: t('companies.actions.destroy_confirm')}, class: 'btn btn-primary' do span.fa.fa-trash span = t('companies.actions.destroy') +- page_header_content_for @company + -/ PageContent .page_content .container-fluid .row diff --git a/app/views/compliance_check_sets/executed.html.slim b/app/views/compliance_check_sets/executed.html.slim index bb055272d..da8a2a3de 100644 --- a/app/views/compliance_check_sets/executed.html.slim +++ b/app/views/compliance_check_sets/executed.html.slim @@ -1,8 +1,6 @@ - breadcrumb :compliance_check_set, @workbench, @compliance_check_set -/ PageHeader -= pageheader 'jeux-de-donnees', - t('compliance_check_sets.executed.title', name: @compliance_check_set.name) -/ PageContent +- page_header_content_for @compliance_check_set + .page_content .container-fluid .row @@ -47,7 +45,7 @@ sortable: true, cls: 'table has-filter has-search', model: ComplianceCheck - + - @blocks_to_compliance_checks_map.each do |block, compliance_checks| - if compliance_checks.try(:any?) diff --git a/app/views/compliance_check_sets/index.html.slim b/app/views/compliance_check_sets/index.html.slim index 194749104..f5d1bd777 100644 --- a/app/views/compliance_check_sets/index.html.slim +++ b/app/views/compliance_check_sets/index.html.slim @@ -1,15 +1,5 @@ - breadcrumb :compliance_check_sets, @workbench -/ PageHeader -- header_params = ['jeux-de-donnees', - t('compliance_check_sets.index.title'), - ''] -= pageheader(*header_params) do - / Below is secundary actions & optional contents (filters, ...) - .row.mb-sm - .col-lg-12.text-right - -/ PageContent .page_content .container-fluid .row diff --git a/app/views/compliance_control_blocks/edit.html.slim b/app/views/compliance_control_blocks/edit.html.slim index 637bb7311..49aee7705 100644 --- a/app/views/compliance_control_blocks/edit.html.slim +++ b/app/views/compliance_control_blocks/edit.html.slim @@ -1,11 +1,7 @@ -/ PageHeader -= pageheader 'jeux-de-controle', - t('compliance_control_blocks.edit.title', compliance_control_block: @compliance_control_block.id) +- page_header_content_for @compliance_control_block - -/ PageContent .page_content .container-fluid .row .col-lg-8.col-lg-offset-2.col-md-8.col-md-offset-2.col-sm-10.col-sm-offset-1 - = render 'form'
\ No newline at end of file + = render 'form' diff --git a/app/views/compliance_control_blocks/new.html.slim b/app/views/compliance_control_blocks/new.html.slim index 49404c552..7d2551311 100644 --- a/app/views/compliance_control_blocks/new.html.slim +++ b/app/views/compliance_control_blocks/new.html.slim @@ -1,11 +1,5 @@ -/ PageHeader -= pageheader 'jeux-de-controle', - t('compliance_control_blocks.new.title') - - -/ PageContent .page_content .container-fluid .row .col-lg-8.col-lg-offset-2.col-md-8.col-md-offset-2.col-sm-10.col-sm-offset-1 - = render 'form'
\ No newline at end of file + = render 'form' diff --git a/app/views/compliance_control_sets/edit.html.slim b/app/views/compliance_control_sets/edit.html.slim index dbe537c93..fd68f0abb 100644 --- a/app/views/compliance_control_sets/edit.html.slim +++ b/app/views/compliance_control_sets/edit.html.slim @@ -1,9 +1,6 @@ - breadcrumb :compliance_control_set, @compliance_control_set -/ PageHeader -= pageheader 'jeux-de-controle', - t('compliance_control_sets.edit.title', name: @compliance_control_set.name) +- page_header_content_for @compliance_control_set -/ PageContent .page_content .container-fluid .row diff --git a/app/views/compliance_control_sets/index.html.slim b/app/views/compliance_control_sets/index.html.slim index 69bff4725..2a5651280 100644 --- a/app/views/compliance_control_sets/index.html.slim +++ b/app/views/compliance_control_sets/index.html.slim @@ -1,16 +1,8 @@ - breadcrumb :compliance_control_sets -/ PageHeader -- header_params = ['jeux-de-controle', - t('compliance_control_sets.index.title'), - ''] -- header_params << link_to(t('compliance_control_sets.actions.new'), new_compliance_control_set_path, class: 'btn btn-default') if policy(Calendar).create? -= pageheader(*header_params) do +- content_for :page_header_actions do + - if policy(ComplianceControlSet).create? + = link_to(t('compliance_control_sets.actions.new'), new_compliance_control_set_path, class: 'btn btn-default') - / Below is secundary actions & optional contents (filters, ...) - .row.mb-sm - .col-lg-12.text-right - -/ PageContent .page_content .container-fluid .row diff --git a/app/views/compliance_control_sets/new.html.slim b/app/views/compliance_control_sets/new.html.slim index d543a6395..ada0de5bf 100644 --- a/app/views/compliance_control_sets/new.html.slim +++ b/app/views/compliance_control_sets/new.html.slim @@ -1,10 +1,5 @@ - breadcrumb :compliance_control_sets -/ PageHeader -= pageheader 'jeux-de-controle', - t('compliance_control_sets.index.new') - -/ PageContent .page_content .container-fluid .row diff --git a/app/views/compliance_control_sets/show.html.slim b/app/views/compliance_control_sets/show.html.slim index a6e2c192a..2291eda06 100644 --- a/app/views/compliance_control_sets/show.html.slim +++ b/app/views/compliance_control_sets/show.html.slim @@ -1,9 +1,6 @@ - breadcrumb :compliance_control_set, @compliance_control_set -/ PageHeader -= pageheader 'jeux-de-controle', - t('compliance_control_sets.show.title', name: @compliance_control_set.name) - - / Below is secondary actions & optional contents (filters, ...) +- page_header_content_for @compliance_control_set +- content_for :page_header_content do .row.mb-sm .col-lg-12.text-right - @compliance_control_set.action_links.each do |link| @@ -16,7 +13,6 @@ class: 'btn btn-primary' do = link.content -/ PageContent .page_content .container-fluid .row diff --git a/app/views/compliance_controls/edit.html.slim b/app/views/compliance_controls/edit.html.slim index 192e3521f..00456410c 100644 --- a/app/views/compliance_controls/edit.html.slim +++ b/app/views/compliance_controls/edit.html.slim @@ -1,8 +1,5 @@ - breadcrumb :compliance_control, @compliance_control - -= pageheader 'jeux-de-controle', - t('compliance_controls.edit.title') - +- page_header_content_for @compliance_control .page_content .container-fluid diff --git a/app/views/compliance_controls/new.html.slim b/app/views/compliance_controls/new.html.slim index bd2db230b..f7f47fba3 100644 --- a/app/views/compliance_controls/new.html.slim +++ b/app/views/compliance_controls/new.html.slim @@ -1,11 +1,4 @@ - breadcrumb :compliance_control_set, parent -/ PageHeader -- header_params = ['jeux-de-controle', - t('compliance_controls.new.title'), - ''] -= pageheader(*header_params) do - - .page_content .container-fluid .row @@ -14,4 +7,4 @@ = definition_list t('metadatas'), I18n.t('activerecord.attributes.compliance_control.predicate') => @compliance_control.class.predicate, - I18n.t('activerecord.attributes.compliance_control.prerequisite') => @compliance_control.class.prerequisite
\ No newline at end of file + I18n.t('activerecord.attributes.compliance_control.prerequisite') => @compliance_control.class.prerequisite diff --git a/app/views/compliance_controls/select_type.html.slim b/app/views/compliance_controls/select_type.html.slim index ec1c360cb..d1c518ecf 100644 --- a/app/views/compliance_controls/select_type.html.slim +++ b/app/views/compliance_controls/select_type.html.slim @@ -1,11 +1,4 @@ - breadcrumb :compliance_control_set, parent -/ PageHeader -- header_params = ['jeux-de-controle', - t('compliance_controls.select_type.title'), - ''] -= pageheader(*header_params) do - -/ PageContent .page_content .container-fluid .row diff --git a/app/views/compliance_controls/show.html.slim b/app/views/compliance_controls/show.html.slim index f7ec118b0..54b07abf1 100644 --- a/app/views/compliance_controls/show.html.slim +++ b/app/views/compliance_controls/show.html.slim @@ -1,11 +1,9 @@ - breadcrumb :compliance_control, @compliance_control -/ PageHeader -= pageheader 'jeux-de-controle', - t('compliance_controls.show.title'), - '', - link_to(t('actions.edit'), edit_compliance_control_set_compliance_control_path(params[:compliance_control_set_id], params[:id]), class: 'btn btn-default') do +- content_for :page_header_actions do + = link_to(t('actions.edit'), edit_compliance_control_set_compliance_control_path(params[:compliance_control_set_id], params[:id]), class: 'btn btn-default') +- page_header_content_for @compliance_control + -/ PageContent .page_content .container-fluid .row @@ -29,4 +27,4 @@ - if @compliance_control.compliance_control_block = definition_list t('compliance_controls.show.metadatas.compliance_control_block'), I18n.t('activerecord.attributes.compliance_control_blocks.transport_mode') => I18n.t("enumerize.transport_mode.#{@compliance_control.compliance_control_block.transport_mode}"), - I18n.t('activerecord.attributes.compliance_control_blocks.transport_submode') => I18n.t("enumerize.transport_submode.#{@compliance_control.compliance_control_block.transport_submode}")
\ No newline at end of file + I18n.t('activerecord.attributes.compliance_control_blocks.transport_submode') => I18n.t("enumerize.transport_submode.#{@compliance_control.compliance_control_block.transport_submode}") diff --git a/app/views/dashboards/show.html.slim b/app/views/dashboards/show.html.slim index e86af55a6..8df880f89 100644 --- a/app/views/dashboards/show.html.slim +++ b/app/views/dashboards/show.html.slim @@ -1,16 +1,11 @@ - breadcrumb :root -/ PageHeader -= pageheader 'tableau-de-bord', - t('.title', organisation: current_organisation.name) - - / Below is secundary actions & optional contents (filters, ...) +- content_for :page_header_title, t('.title', organisation: current_organisation.name) +- content_for :page_header_content do .row.mb-sm .col-lg-12.text-right - if policy(Api::V1::ApiKey).create? = link_to t('actions.create_api_key'), new_api_key_path, class: 'btn btn-primary' - -/ PageContent .page_content .container-fluid = render partial: @dashboard diff --git a/app/views/errors/forbidden.html.slim b/app/views/errors/forbidden.html.slim index 4ca3a6dbf..23ea67eff 100644 --- a/app/views/errors/forbidden.html.slim +++ b/app/views/errors/forbidden.html.slim @@ -1,7 +1,4 @@ -/ PageHeader -= pageheader 'bug', - 'Erreur 403', - '' +- content_for :page_header_title, 'Erreur 403' .page_content .container-fluid diff --git a/app/views/errors/not_found.html.slim b/app/views/errors/not_found.html.slim index 6348ea1be..8821e9ec3 100644 --- a/app/views/errors/not_found.html.slim +++ b/app/views/errors/not_found.html.slim @@ -1,7 +1,4 @@ -/ PageHeader -= pageheader 'bug', - 'Erreur 404', - '' +- content_for :page_header_title, 'Erreur 404' .page_content .container-fluid @@ -11,11 +8,11 @@ - if I18n.locale == :fr p strong = "Désolé, la page demandée n'existe pas." - + p = "Vous pouvez néanmoins continuer à utiliser l'application IBOO." - + - else p strong = "The page you were looking for doesn't exist." - + p = "You can still continue the use the IBOO application. Thank you for understanding." diff --git a/app/views/errors/server_error.html.slim b/app/views/errors/server_error.html.slim index 09884dc29..189a48760 100644 --- a/app/views/errors/server_error.html.slim +++ b/app/views/errors/server_error.html.slim @@ -1,7 +1,4 @@ -/ PageHeader -= pageheader 'bug', - 'Erreur serveur', - '' +- content_for :page_header_title, 'Erreur serveur' .page_content .container-fluid @@ -11,11 +8,11 @@ - if I18n.locale == :fr p strong = "Désolé, une erreur est survenue." - + p = "Vous pouvez néanmoins continuer à utiliser l'application IBOO." - + - else p strong = "We're sorry, but something went wrong." - + p = "You can still continue the use the IBOO application. Thank you for understanding." diff --git a/app/views/import_resources/index.html.slim b/app/views/import_resources/index.html.slim index 57c83ce82..565dd04e4 100644 --- a/app/views/import_resources/index.html.slim +++ b/app/views/import_resources/index.html.slim @@ -1,11 +1,4 @@ -/ PageHeader -= pageheader 'importer', - t('.title'), - '', - '', - '' -/ PageContent .page_content.import_messages .container-fluid .row diff --git a/app/views/imports/index.html.slim b/app/views/imports/index.html.slim index 35cd666b1..79452bbfc 100644 --- a/app/views/imports/index.html.slim +++ b/app/views/imports/index.html.slim @@ -1,12 +1,7 @@ - breadcrumb :imports, @workbench -/ PageHeader -= pageheader 'importer', - t('.title'), - '', - '', - link_to(t('imports.actions.new'), new_workbench_import_path(workbench_id: @workbench), class: 'btn btn-primary') +- content_for :page_header_actions do + = link_to(t('imports.actions.new'), new_workbench_import_path(workbench_id: @workbench), class: 'btn btn-primary') -/ PageContent .page_content .container-fluid - if params[:q].present? or @imports.any? diff --git a/app/views/imports/new.html.slim b/app/views/imports/new.html.slim index b74d8eaf2..3e35028f7 100644 --- a/app/views/imports/new.html.slim +++ b/app/views/imports/new.html.slim @@ -1,9 +1,5 @@ - breadcrumb :imports, @workbench -/ PageHeader -= pageheader 'importer', - t('.title') -/ PageContent .page_content .container-fluid .row diff --git a/app/views/imports/show.html.slim b/app/views/imports/show.html.slim index 775b09e8b..5e22e03e0 100644 --- a/app/views/imports/show.html.slim +++ b/app/views/imports/show.html.slim @@ -1,11 +1,5 @@ - breadcrumb :import, @workbench, @import -/ PageHeader -= pageheader 'importer', - @import.name, - '', - t('last_update', time: l(@import.updated_at, format: :short)) do - - / Below is secundary actions & optional contents (filters, ...) +- content_for :page_header_content do .row .col-lg-12.text-right.mb-sm - @import.action_links.each do |link| @@ -15,7 +9,8 @@ class: 'btn btn-primary' do = link.content -/ PageContent +- page_header_content_for @import + .page_content .container-fluid .row diff --git a/app/views/journey_patterns_collections/show.html.slim b/app/views/journey_patterns_collections/show.html.slim index 7c62b69ee..d53403ff3 100644 --- a/app/views/journey_patterns_collections/show.html.slim +++ b/app/views/journey_patterns_collections/show.html.slim @@ -1,9 +1,6 @@ - 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}", - 'Lorem ipsum dolor sit amet', - '' +- page_header_content_for @route + - @journey_patterns.each do |jp| - jp.errors.each do |error_message| = error_message diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim index 8c731007d..567e14ef0 100644 --- a/app/views/layouts/application.html.slim +++ b/app/views/layouts/application.html.slim @@ -17,6 +17,7 @@ html lang=I18n.locale body = render 'layouts/navigation/main_nav' = render 'layouts/flash_messages', flash: flash + = render 'layouts/navigation/page_header' = yield #sidebar = yield :sidebar diff --git a/app/views/layouts/navigation/_page_header.html.slim b/app/views/layouts/navigation/_page_header.html.slim new file mode 100644 index 000000000..2548ddd81 --- /dev/null +++ b/app/views/layouts/navigation/_page_header.html.slim @@ -0,0 +1,24 @@ +div.page_header + div.container-fluid + div.row + div.col-lg-9.col-md-8.col-sm-7.col-xs-7 + - if defined?(resource_class) + div.page-icon + span.sb class="sb-#{resource_class.model_name.name.underscore}" + div.page-title + - if content_for? :page_header_title + h1 = yield :page_header_title + - elsif defined?(resource_class) + h1 = t("#{resource_class.model_name.name.underscore.pluralize}.#{params[:action]}.title") + + div.col-lg-3.col-md-4.col-sm-5.col-xs-5.text-right + div.page-meta + - if content_for? :page_header_meta + div.small = yield :page_header_meta + + div.page-action + - if content_for? :page_header_actions + div.small = yield :page_header_actions + + - if content_for? :page_header_content + = yield :page_header_content diff --git a/app/views/line_footnotes/edit.html.slim b/app/views/line_footnotes/edit.html.slim index 4a0fbb931..203bdab94 100644 --- a/app/views/line_footnotes/edit.html.slim +++ b/app/views/line_footnotes/edit.html.slim @@ -1,10 +1,5 @@ -/ PageHeader -= pageheader 'ligne', - "Notes sur la ligne #{@line.name}", - 'Lorem ipsum dolor sit amet', - (@line.footnotes.any? ? t('last_update', time: l(@line.footnotes.last.updated_at, format: :short)) : '') +- page_header_content_for @line -/ PageContent .page_content .container-fluid .row diff --git a/app/views/line_footnotes/show.html.slim b/app/views/line_footnotes/show.html.slim index 0ed1d2958..e4f2a1d42 100644 --- a/app/views/line_footnotes/show.html.slim +++ b/app/views/line_footnotes/show.html.slim @@ -1,12 +1,11 @@ - breadcrumb :line_footnotes, @referential, @line -/ PageHeader -= pageheader 'ligne', - "Notes sur la ligne #{@line.name}", - 'Lorem ipsum dolor sit amet', - '', - (policy(@line).update_footnote? ? link_to(t('actions.edit'), edit_referential_line_footnotes_path(@referential, @line), class: 'btn btn-primary') : '') -/ PageContent +- content_for :page_header_actions do + - if policy(@line).update_footnote? + = link_to(t('actions.edit'), edit_referential_line_footnotes_path(@referential, @line), class: 'btn btn-primary') + +- page_header_content_for @line + .page_content .container-fluid .row diff --git a/app/views/line_referentials/edit.html.slim b/app/views/line_referentials/edit.html.slim index 820b788e5..374d34ed3 100644 --- a/app/views/line_referentials/edit.html.slim +++ b/app/views/line_referentials/edit.html.slim @@ -1,3 +1,2 @@ -= title_tag t('line_referentials.edit.title', line_referential: @line_referential.name) - -= render 'form'
\ No newline at end of file +- page_header_content_for @line_referential += render 'form' diff --git a/app/views/line_referentials/show.html.slim b/app/views/line_referentials/show.html.slim index b98e9d5bb..b4b32bc52 100644 --- a/app/views/line_referentials/show.html.slim +++ b/app/views/line_referentials/show.html.slim @@ -1,12 +1,9 @@ - breadcrumb :line_referential, @line_referential -/ PageHeader -= pageheader 'synchro-ilico', - t('.title'), - 'Lorem ipsum dolor sit amet', - t('last_update', time: l(@line_referential.updated_at, format: :short)), - link_to(t('actions.sync'), sync_line_referential_path(@line_referential), method: :post, class: 'btn btn-default') do +- page_header_content_for @line_referential +- content_for :page_header_actions do + = link_to(t('actions.sync'), sync_line_referential_path(@line_referential), method: :post, class: 'btn btn-default') - / Below is secundary actions & opt. contents +- content_for :page_header_content do .row.mb-md .col-lg-12.text-right = link_to line_referential_companies_path(@line_referential), class: 'btn btn-primary' do @@ -19,7 +16,6 @@ = Referential.human_attribute_name(:lines) em.small = " (#{@line_referential.lines.size})" -/ PageContent .page_content .container-fluid .row diff --git a/app/views/lines/edit.html.slim b/app/views/lines/edit.html.slim index 4a904d16a..efe674ba4 100644 --- a/app/views/lines/edit.html.slim +++ b/app/views/lines/edit.html.slim @@ -1,10 +1,6 @@ - breadcrumb :line, @line +- page_header_content_for @line -/ PageHeader -= pageheader 'jeux-de-controle', - t('lines.edit.title', line: @line.name) - -/ PageContent .page_content .container-fluid .row diff --git a/app/views/lines/index.html.slim b/app/views/lines/index.html.slim index d0d76d1cb..8b035b477 100644 --- a/app/views/lines/index.html.slim +++ b/app/views/lines/index.html.slim @@ -1,12 +1,8 @@ - breadcrumb :lines, @line_referential -/ PageHeader -= pageheader 'ligne', - t('lines.index.title'), - 'Lorem ipsum dolor sit amet', - '', - (policy(Chouette::Line).create? ? link_to(t('lines.actions.new'), new_line_referential_line_path(@line_referential), class: 'btn btn-primary') : '') +- content_for :page_header_actions do + - if (policy(Chouette::Line).create? && @line_referential.organisations.include?(current_organisation)) + = link_to(t('lines.actions.new'), new_line_referential_line_path(@line_referential), class: 'btn btn-primary') -/ PageContent .page_content .container-fluid - if params[:q].present? or @lines.any? diff --git a/app/views/lines/new.html.slim b/app/views/lines/new.html.slim index 00872dcfb..6eecf1e7d 100644 --- a/app/views/lines/new.html.slim +++ b/app/views/lines/new.html.slim @@ -1,12 +1,6 @@ - breadcrumb :lines, @line_referential -/ PageHeader -= pageheader 'jeux-de-controle', - t('lines.new.title') - - -/ PageContent .page_content .container-fluid .row .col-lg-8.col-lg-offset-2.col-md-8.col-md-offset-2.col-sm-10.col-sm-offset-1 - = 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 4d7b1a195..4969ca3cd 100644 --- a/app/views/lines/show.html.slim +++ b/app/views/lines/show.html.slim @@ -1,11 +1,5 @@ - breadcrumb :line, @line -/ PageHeader -= pageheader 'ligne', - @line.name, - 'Lorem ipsum dolor sit amet', - t('last_update', time: l(@line.updated_at, format: :short)) do - - / Below is secundary actions & optional contents +- content_for :page_header_content do .row .col-lg-12.text-right.mb-sm - @line.action_links.each do |link| @@ -15,7 +9,8 @@ class: 'btn btn-primary' do = link.content -/ PageContent +- page_header_content_for @line + .page_content .container-fluid .row diff --git a/app/views/networks/edit.html.slim b/app/views/networks/edit.html.slim index dbb8bada9..64513d250 100644 --- a/app/views/networks/edit.html.slim +++ b/app/views/networks/edit.html.slim @@ -1,12 +1,7 @@ -- breadcrumb :networks, @network -/ PageHeader -= pageheader 'jeux-de-controle', - t('networks.edit.title', network: @network.name) - - -/ PageContent +- breadcrumb :network, @network +- page_header_content_for @network .page_content .container-fluid .row .col-lg-8.col-lg-offset-2.col-md-8.col-md-offset-2.col-sm-10.col-sm-offset-1 - = render 'form' + = render 'form'
\ No newline at end of file diff --git a/app/views/networks/index.html.slim b/app/views/networks/index.html.slim index 5829cf649..b13c73e9e 100644 --- a/app/views/networks/index.html.slim +++ b/app/views/networks/index.html.slim @@ -1,12 +1,8 @@ - breadcrumb :networks, @line_referential -/ PageHeader -= pageheader 'reseau', - t('networks.index.title'), - 'Lorem ipsum dolor sit amet', - '', - (policy(Chouette::Network).create? ? link_to(t('networks.actions.new'), new_line_referential_network_path(@line_referential), class: 'btn btn-primary') : '') +- content_for :page_header_actions do + - if policy(Chouette::Network).create? + = link_to(t('networks.actions.new'), new_line_referential_network_path(@line_referential), class: 'btn btn-primary') -/ PageContent .page_content .container-fluid - if params[:q].present? or @networks.any? diff --git a/app/views/networks/new.html.slim b/app/views/networks/new.html.slim index d014fb35a..590d2b409 100644 --- a/app/views/networks/new.html.slim +++ b/app/views/networks/new.html.slim @@ -1,12 +1,6 @@ - breadcrumb :networks, @line_referential -/ PageHeader -= pageheader 'jeux-de-controle', - t('networks.new.title') - - -/ PageContent .page_content .container-fluid .row .col-lg-8.col-lg-offset-2.col-md-8.col-md-offset-2.col-sm-10.col-sm-offset-1 - = render 'form' + = render 'form'
\ No newline at end of file diff --git a/app/views/networks/show.html.slim b/app/views/networks/show.html.slim index e45ed46ae..f7d40a049 100644 --- a/app/views/networks/show.html.slim +++ b/app/views/networks/show.html.slim @@ -1,11 +1,6 @@ -- breadcrumb :networks, @network -/ PageHeader -= pageheader 'reseau', - @network.name, - '', - t('last_update', time: l(@network.updated_at, format: :short)) do - - / Below is secundary actions & optional contents (filters, ...) +- breadcrumb :network, @network +- page_header_content_for @network +- content_for :page_header_content do .row .col-lg-12.text-right.mb-sm - @network.action_links.each do |link| @@ -14,8 +9,6 @@ data: link.data, class: 'btn btn-primary' do = link.content - -/ PageContent .page_content .container-fluid .row diff --git a/app/views/referential_companies/edit.html.slim b/app/views/referential_companies/edit.html.slim index d191d2a37..b3fcf6cd8 100644 --- a/app/views/referential_companies/edit.html.slim +++ b/app/views/referential_companies/edit.html.slim @@ -1,4 +1,3 @@ - breadcrumb :referential_company, @referential, @company - -= title_tag t('companies.edit.title', company: @company.name) +- page_header_content_for @company = render 'form' diff --git a/app/views/referential_companies/index.html.slim b/app/views/referential_companies/index.html.slim index 3348dc722..de0f7de69 100644 --- a/app/views/referential_companies/index.html.slim +++ b/app/views/referential_companies/index.html.slim @@ -1,12 +1,8 @@ - breadcrumb :referential_companies, @referential -/ PageHeader -= pageheader 'transporteur', - t('companies.index.title'), - '', - '', - (policy(Chouette::Company).create? ? link_to(t('companies.actions.new'), new_referential_company_path(@referential), class: 'btn btn-default') : '') +- content_for :page_header_actions do + - if policy(Chouette::Company).create? + = link_to(t('companies.actions.new'), new_referential_company_path(@referential), class: 'btn btn-default') -/ PageContent .page_content .container-fluid - if params[:q].present? or @companies.any? diff --git a/app/views/referential_companies/new.html.slim b/app/views/referential_companies/new.html.slim index 1c7fc7297..5e59db139 100644 --- a/app/views/referential_companies/new.html.slim +++ b/app/views/referential_companies/new.html.slim @@ -1,3 +1,2 @@ - breadcrumb :referential_companies, @referential -= title_tag t('companies.new.title') = render 'form' diff --git a/app/views/referential_companies/show.html.slim b/app/views/referential_companies/show.html.slim index 0dbc3cdd0..1599145be 100644 --- a/app/views/referential_companies/show.html.slim +++ b/app/views/referential_companies/show.html.slim @@ -1,11 +1,5 @@ - breadcrumb :referential_company, @referential, @company -/ PageHeader -= pageheader 'transporteur', - @company.name, - 'Lorem ipsum dolor sit amet', - t('last_update', time: l(@company.updated_at, format: :short)) do - - / Below is secundary actions & optional contents (filters, ...) +- content_for :page_header_content do .row .col-lg-12.text-right.mb-sm - if policy(Chouette::Company).create? @@ -17,7 +11,8 @@ span.fa.fa-trash span = t('companies.actions.destroy') -/ PageContent +- page_header_content_for @company + .page_content .container-fluid .row diff --git a/app/views/referential_lines/edit.html.slim b/app/views/referential_lines/edit.html.slim index 8c51715ba..45f26a05c 100644 --- a/app/views/referential_lines/edit.html.slim +++ b/app/views/referential_lines/edit.html.slim @@ -1,4 +1,3 @@ -- breadcrumb :referential_line, @line, @referential -= title_tag t('lines.edit.title', line: @line.name) - +- breadcrumb :referential_line, @referential, @line +- page_header_content_for @line = render 'form' diff --git a/app/views/referential_lines/new.html.slim b/app/views/referential_lines/new.html.slim index 56da24d7c..bcc583279 100644 --- a/app/views/referential_lines/new.html.slim +++ b/app/views/referential_lines/new.html.slim @@ -1,3 +1 @@ -= title_tag t('lines.new.title') - -= 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 7607c391b..cb4791855 100644 --- a/app/views/referential_lines/show.html.slim +++ b/app/views/referential_lines/show.html.slim @@ -1,21 +1,15 @@ - breadcrumb :referential_line, @referential, @line -/ PageHeader -= pageheader 'ligne', - t('lines.index.line', line: @line.name), - '', - t('last_update', time: l(@line.updated_at, format: :short)) do +- content_for :page_header_content do +.row + .col-lg-12.text-right.mb-sm + - @line.action_links.each do |link| + = link_to link.href, + method: link.method, + data: link.data, + class: 'btn btn-primary' do + = link.content +- page_header_content_for @line - / Below is secundary actions & optional contents - .row - .col-lg-12.text-right.mb-sm - - @line.action_links.each do |link| - = link_to link.href, - method: link.method, - data: link.data, - class: 'btn btn-primary' do - = link.content - -/ PageContent .page_content .container-fluid .row diff --git a/app/views/referential_networks/edit.html.slim b/app/views/referential_networks/edit.html.slim index dded4b176..a77d2db34 100644 --- a/app/views/referential_networks/edit.html.slim +++ b/app/views/referential_networks/edit.html.slim @@ -1,4 +1,3 @@ - breadcrumb :referential_network, @referential, @network -= title_tag t('networks.edit.title', network: @network.name) - +- page_header_content_for @network = render 'form' diff --git a/app/views/referential_networks/index.html.slim b/app/views/referential_networks/index.html.slim index 6a2df6d16..d556e7e5e 100644 --- a/app/views/referential_networks/index.html.slim +++ b/app/views/referential_networks/index.html.slim @@ -1,12 +1,8 @@ - breadcrumb :referential_networks, @referential -/ PageHeader -= pageheader 'reseau', - t('networks.index.title'), - 'Lorem ipsum dolor sit amet', - '', - (policy(Chouette::Network).create? ? link_to(t('networks.actions.new'), new_referential_network_path(@referential), class: 'btn btn-default') : '') +- if policy(Chouette::Network).create? + - content_for :page_header_actions do + = link_to(t('networks.actions.new'), new_referential_network_path(@referential), class: 'btn btn-default') -/PageContent .page_content .container-fluid - if params[:q].present? or @networks.any? diff --git a/app/views/referential_networks/new.html.slim b/app/views/referential_networks/new.html.slim index 4a737d9f7..9c2020eb3 100644 --- a/app/views/referential_networks/new.html.slim +++ b/app/views/referential_networks/new.html.slim @@ -1,5 +1,2 @@ - breadcrumb :referential_networks, @referential - -= title_tag t('networks.new.title') - = render 'form' diff --git a/app/views/referential_networks/show.html.slim b/app/views/referential_networks/show.html.slim index c2cc79e0d..7de304671 100644 --- a/app/views/referential_networks/show.html.slim +++ b/app/views/referential_networks/show.html.slim @@ -1,11 +1,6 @@ - breadcrumb :referential_network, @referential, @network -/ PageHeader -= pageheader 'reseau', - @network.name, - 'Lorem ipsum dolor sit amet', - t('last_update', time: l(@network.updated_at, format: :short)) do - - / Below is secundary actions & optional contents (filters, ...) +- page_header_content_for @network +- content_for :page_header_content do .row .col-lg-12.text-right.mb-sm - @network.action_links.each do |link| diff --git a/app/views/referential_stop_areas/edit.html.slim b/app/views/referential_stop_areas/edit.html.slim index fc7220095..d88230b58 100644 --- a/app/views/referential_stop_areas/edit.html.slim +++ b/app/views/referential_stop_areas/edit.html.slim @@ -1,4 +1,3 @@ - breadcrumb :referential_stop_area, @referential, @stop_area -= title_tag t('stop_areas.edit.title', stop_area: @stop_area.name) - +- page_header_content_for @stop_area = render 'form' diff --git a/app/views/referential_stop_areas/index.html.slim b/app/views/referential_stop_areas/index.html.slim index 718cbb472..ad04fb02e 100644 --- a/app/views/referential_stop_areas/index.html.slim +++ b/app/views/referential_stop_areas/index.html.slim @@ -1,5 +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| .panel.panel-default diff --git a/app/views/referential_stop_areas/new.html.slim b/app/views/referential_stop_areas/new.html.slim index 87ba9b657..9342b673b 100644 --- a/app/views/referential_stop_areas/new.html.slim +++ b/app/views/referential_stop_areas/new.html.slim @@ -1,4 +1,2 @@ - breadcrumb :referential_stop_areas, @referential -= title_tag t('stop_areas.new.title') - = render 'form' diff --git a/app/views/referential_stop_areas/show.html.slim b/app/views/referential_stop_areas/show.html.slim index 7cc078ee0..0470b4654 100644 --- a/app/views/referential_stop_areas/show.html.slim +++ b/app/views/referential_stop_areas/show.html.slim @@ -1,9 +1,6 @@ - breadcrumb :referential_stop_area, @referential, @stop_area -/ PageHeader -= pageheader 'arret', - @stop_area.name, - 'Lorem ipsum dolor sit amet' - +- page_header_content_for @stop_area +- content_for :page_header_content do .row .col-lg-12.text-right.mb-sm - @stop_area.action_links.each do |link| @@ -13,7 +10,6 @@ class: 'btn btn-primary' do = link.content -/ PageContent .page_content .container-fluid .row diff --git a/app/views/referentials/edit.html.slim b/app/views/referentials/edit.html.slim index 1fac626e6..904dc5439 100644 --- a/app/views/referentials/edit.html.slim +++ b/app/views/referentials/edit.html.slim @@ -1,10 +1,6 @@ -/ PageHeader -= pageheader 'jeux-de-donnees', - t('.title'), - '', - t('last_update', time: l(@referential.updated_at, format: :short)) +- breadcrumb @referential +- page_header_content_for @referential -/ PageContent .page_content .container-fluid .row diff --git a/app/views/referentials/new.html.slim b/app/views/referentials/new.html.slim index f4a7e4707..2bed9f912 100644 --- a/app/views/referentials/new.html.slim +++ b/app/views/referentials/new.html.slim @@ -1,12 +1,3 @@ -/ PageHeader -- if @referential.created_from.present? - = pageheader 'jeux-de-donnees', - t('.duplicated.title') -- else - = pageheader 'jeux-de-donnees', - t('.title') - -/ PageContent .page_content .container-fluid .row diff --git a/app/views/referentials/select_compliance_control_set.html.slim b/app/views/referentials/select_compliance_control_set.html.slim index 2d3f2344c..87a888c0a 100644 --- a/app/views/referentials/select_compliance_control_set.html.slim +++ b/app/views/referentials/select_compliance_control_set.html.slim @@ -1,10 +1,3 @@ -/ PageHeader -- header_params = ['jeux-de-controle', - t('referentials.select_compliance_control_set.title'), - ''] -= pageheader(*header_params) do - -/ PageContent .page_content .container-fluid .row @@ -17,4 +10,4 @@ .col-sm-8.col-xs-7 = select_tag :compliance_control_set, options_from_collection_for_select(@compliance_control_sets, "id", "name"), class: 'select optional form-control' .separator - = button_tag t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'select_compliance_control_set'
\ No newline at end of file + = button_tag t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'select_compliance_control_set' diff --git a/app/views/referentials/show.html.slim b/app/views/referentials/show.html.slim index 0abeb0669..9852fb0a3 100644 --- a/app/views/referentials/show.html.slim +++ b/app/views/referentials/show.html.slim @@ -1,12 +1,10 @@ - breadcrumb @referential -/ PageHeader -= pageheader 'jeux-de-donnees', - @referential.name, - 'Lorem ipsum dolor sit amet', - t('last_update', time: l(@referential.updated_at, format: :short)), - ((@referential.archived? || !policy(@referential).edit?) ? '' : link_to(t('actions.edit'), edit_referential_path(@referential), class: 'btn btn-default')) do +- page_header_content_for @referential +- content_for :page_header_actions do + - unless (@referential.archived? || !policy(@referential).edit?) + = link_to(t('actions.edit'), edit_referential_path(@referential), class: 'btn btn-default') - / Below is secondary actions & optional contents (filters, ...) +- content_for :page_header_content do .row.mb-sm .col-lg-12.text-right - @referential.action_links.each do |link| @@ -19,7 +17,6 @@ class: 'btn btn-primary' do = link.content -/ PageContent .page_content .container-fluid .row diff --git a/app/views/routes/edit.html.slim b/app/views/routes/edit.html.slim index a69c5aeff..78f9a2e85 100644 --- a/app/views/routes/edit.html.slim +++ b/app/views/routes/edit.html.slim @@ -1,11 +1,6 @@ - breadcrumb :route, @referential, @route -/ PageHeader -= pageheader 'itineraire', - @route.name, - 'Lorem ipsum dolor sit amet', - t('last_update', time: l(@route.updated_at, format: :short)) +- page_header_content_for @route -/ PageContent .page_content .container-fluid .row diff --git a/app/views/routes/new.html.slim b/app/views/routes/new.html.slim index 3a8ceb963..9d5ca2e23 100644 --- a/app/views/routes/new.html.slim +++ b/app/views/routes/new.html.slim @@ -1,10 +1,4 @@ - breadcrumb :referential_line, @referential, @line -/ PageHeader -= pageheader 'itineraire', - t('routes.new.title'), - '' - -/ PageContent .page_content .container-fluid .row diff --git a/app/views/routes/show.html.slim b/app/views/routes/show.html.slim index 734d6ebf3..3adf3e2f6 100644 --- a/app/views/routes/show.html.slim +++ b/app/views/routes/show.html.slim @@ -1,12 +1,10 @@ - breadcrumb :route, @referential, @route -/ PageHeader -= pageheader 'itineraire', - t('routes.index.title', route: @route.name), - '', - t('last_update', time: l(@route.updated_at, format: :short)), - (policy(@route).edit? ? link_to(t('actions.edit'), edit_referential_line_route_path(@referential, @line, @route), class: 'btn btn-default') : '') do +- page_header_content_for @route +- content_for :page_header_actions do + - if policy(@route).edit? + = link_to(t('actions.edit'), edit_referential_line_route_path(@referential, @line, @route), class: 'btn btn-default') - / Below is secundary actions & optional contents (filters, ...) +- content_for :page_header_content do .row.mb-sm .col-lg-12.text-right - @route.action_links.each do |link| @@ -16,7 +14,6 @@ class: 'btn btn-primary' do = link.content -/ PageContent .page_content .container-fluid .row diff --git a/app/views/routing_constraint_zones/edit.html.slim b/app/views/routing_constraint_zones/edit.html.slim index c9b9b0c41..e971ee5dd 100644 --- a/app/views/routing_constraint_zones/edit.html.slim +++ b/app/views/routing_constraint_zones/edit.html.slim @@ -1,11 +1,6 @@ - breadcrumb :routing_constraint_zone, @referential, @line, @routing_constraint_zone -/ PageHeader -= pageheader 'itl', - t('.title', routing_constraint_zone: @routing_constraint_zone.name), - '', - t('last_update', time: l(@routing_constraint_zone.updated_at, format: :short)) +- page_header_content_for @routing_constraint_zone -/ PageContent .page_content .container-fluid .row diff --git a/app/views/routing_constraint_zones/index.html.slim b/app/views/routing_constraint_zones/index.html.slim index fcf904070..7c54fca68 100644 --- a/app/views/routing_constraint_zones/index.html.slim +++ b/app/views/routing_constraint_zones/index.html.slim @@ -1,12 +1,8 @@ - breadcrumb :routing_constraint_zones, @referential, @line -/ PageHeader -= pageheader 'itl', - t('routing_constraint_zones.index.title'), - '', - '', - ((policy(Chouette::RoutingConstraintZone).create? && @referential.organisation == current_organisation) ? link_to(t('actions.new'), new_referential_line_routing_constraint_zone_path(@referential, @line), class: 'btn btn-primary') : '') +- content_for :page_header_actions do + - if (policy(Chouette::RoutingConstraintZone).create? && @referential.organisation == current_organisation) + = link_to(t('actions.new'), new_referential_line_routing_constraint_zone_path(@referential, @line), class: 'btn btn-primary') -/ PageContent .page_content .container-fluid - if params[:q].present? or @routing_constraint_zones.any? diff --git a/app/views/routing_constraint_zones/new.html.slim b/app/views/routing_constraint_zones/new.html.slim index d15de13a4..62ecf5e95 100644 --- a/app/views/routing_constraint_zones/new.html.slim +++ b/app/views/routing_constraint_zones/new.html.slim @@ -1,9 +1,5 @@ - breadcrumb :routing_constraint_zones, @referential, @line -/ PageHeader -= pageheader 'itl', - t('.title') -/ PageContent .page_content .container-fluid .row diff --git a/app/views/routing_constraint_zones/show.html.slim b/app/views/routing_constraint_zones/show.html.slim index d0c0619c3..6235ade68 100644 --- a/app/views/routing_constraint_zones/show.html.slim +++ b/app/views/routing_constraint_zones/show.html.slim @@ -1,11 +1,6 @@ - breadcrumb :routing_constraint_zone, @referential, @line, @routing_constraint_zone -/ PageHeader -= pageheader 'itl', - @routing_constraint_zone.name, - '', - t('last_update', time: l(@routing_constraint_zone.updated_at, format: :short)) do - - / Below is secundary actions & optional contents +- page_header_content_for @routing_constraint_zone +- content_for :page_header_content do .row .col-lg-12.text-right.mb-sm - @routing_constraint_zone.action_links.each do |link| @@ -15,7 +10,6 @@ class: 'btn btn-primary' do = link.content -/ PageContent .page_content .container-fluid .row diff --git a/app/views/stop_area_referentials/show.html.slim b/app/views/stop_area_referentials/show.html.slim index 896ce756e..d43333fd9 100644 --- a/app/views/stop_area_referentials/show.html.slim +++ b/app/views/stop_area_referentials/show.html.slim @@ -1,18 +1,15 @@ - 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 +- content_for :page_header_actions do + = link_to(t('actions.sync'), sync_stop_area_referential_path(@stop_area_referential), method: :post, class: 'btn btn-default') +- content_for :page_header_content 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 = Referential.human_attribute_name(:stop_areas) em.small = " (#{@stop_area_referential.stop_areas.size})" +- page_header_content_for @stop_area_referential -/ PageContent .page_content .container-fluid .row diff --git a/app/views/stop_areas/edit.html.slim b/app/views/stop_areas/edit.html.slim index 3ffb53dec..4f2b3f4de 100644 --- a/app/views/stop_areas/edit.html.slim +++ b/app/views/stop_areas/edit.html.slim @@ -1,11 +1,8 @@ - breadcrumb :stop_area, @stop_area_referential, @stop_area -/ PageHeader -= pageheader 'jeux-de-controle', - t('stop_areas.edit.title', stop_area: @stop_area.name ) +- page_header_content_for @stop_area -/ PageContent .page_content .container-fluid .row .col-lg-8.col-lg-offset-2.col-md-8.col-md-offset-2.col-sm-10.col-sm-offset-1 - = 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 3e84d2bdc..c4d880081 100644 --- a/app/views/stop_areas/index.html.slim +++ b/app/views/stop_areas/index.html.slim @@ -1,12 +1,8 @@ - breadcrumb :stop_areas, @stop_area_referential -/ PageHeader -= pageheader 'arret', - t('stop_areas.index.title'), - '', - '', - (policy(Chouette::StopArea).create? ? link_to(t('stop_areas.actions.new'), new_stop_area_referential_stop_area_path(@stop_area_referential), class: 'btn btn-primary') : '') +- content_for :page_header_actions do + - if policy(Chouette::StopArea).create? + = link_to(t('stop_areas.actions.new'), new_stop_area_referential_stop_area_path(@stop_area_referential), class: 'btn btn-primary') -/ PageContent .page_content .container-fluid - if params[:q].present? or @stop_areas.any? diff --git a/app/views/stop_areas/new.html.slim b/app/views/stop_areas/new.html.slim index 10e33d5cc..69d78c533 100644 --- a/app/views/stop_areas/new.html.slim +++ b/app/views/stop_areas/new.html.slim @@ -1,11 +1,7 @@ - breadcrumb :stop_areas, @stop_area_referential -/ PageHeader -= pageheader 'jeux-de-controle', - t('stop_areas.new.title') -/ PageContent .page_content .container-fluid .row .col-lg-8.col-lg-offset-2.col-md-8.col-md-offset-2.col-sm-10.col-sm-offset-1 - = render 'form'
\ No newline at end of file + = render 'form' diff --git a/app/views/stop_areas/select_parent.html.slim b/app/views/stop_areas/select_parent.html.slim index 1289eafef..e387e83b8 100644 --- a/app/views/stop_areas/select_parent.html.slim +++ b/app/views/stop_areas/select_parent.html.slim @@ -1,5 +1,3 @@ -= title_tag t('stop_areas.select_parent.title', stop_area: @stop_area.name ) - = semantic_form_for [@referential, @stop_area] do |form| div = form.inputs do @@ -10,4 +8,4 @@ = form.action :cancel, as: :link - content_for :sidebar do - ul.actions
\ No newline at end of file + ul.actions diff --git a/app/views/stop_areas/show.html.slim b/app/views/stop_areas/show.html.slim index 7f7c2e07f..af673bb25 100644 --- a/app/views/stop_areas/show.html.slim +++ b/app/views/stop_areas/show.html.slim @@ -1,9 +1,6 @@ - breadcrumb :stop_area, @stop_area_referential, @stop_area -/ PageHeader -= pageheader 'arret', - @stop_area.name, - 'Lorem ipsum dolor sit amet' - +- page_header_content_for @stop_area +- content_for :page_header_content do .row .col-lg-12.text-right.mb-sm - @stop_area.action_links.each do |link| diff --git a/app/views/time_table_combinations/new.html.slim b/app/views/time_table_combinations/new.html.slim index e49a10bc6..f18553081 100644 --- a/app/views/time_table_combinations/new.html.slim +++ b/app/views/time_table_combinations/new.html.slim @@ -1,10 +1,4 @@ -/ PageHeader -= pageheader 'map-marker', - t('time_tables.show.combine_form'), - '', - '' -/ PageContent .page_content .container-fluid .row diff --git a/app/views/time_tables/edit.html.slim b/app/views/time_tables/edit.html.slim index a1ebb2c72..6ad572906 100644 --- a/app/views/time_tables/edit.html.slim +++ b/app/views/time_tables/edit.html.slim @@ -1,11 +1,6 @@ - breadcrumb :time_table, @referential, @time_table -/ PageHeader -= pageheader 'calendrier-application', - @time_table.comment, - '', - '' +- page_header_content_for @time_table -/ PageContent .page_content .container-fluid #periods diff --git a/app/views/time_tables/index.html.slim b/app/views/time_tables/index.html.slim index edbf89c43..b684b0bcb 100644 --- a/app/views/time_tables/index.html.slim +++ b/app/views/time_tables/index.html.slim @@ -1,11 +1,8 @@ - breadcrumb :time_tables, @referential -/ PageHeader -= pageheader 'calendrier-application', - t('time_tables.index.title'), - '', - ((policy(Chouette::TimeTable).create? && @referential.organisation == current_organisation) ? link_to(t('actions.add'), new_referential_time_table_path(@referential), class: 'btn btn-default') : '') +- content_for :page_header_actions do + - if (policy(Chouette::TimeTable).create? && @referential.organisation == current_organisation) + = link_to(t('actions.add'), new_referential_time_table_path(@referential), class: 'btn btn-default') -/ PageContent .page_content .container-fluid .row diff --git a/app/views/time_tables/new.html.slim b/app/views/time_tables/new.html.slim index c8c2658ba..ddb34e0b7 100644 --- a/app/views/time_tables/new.html.slim +++ b/app/views/time_tables/new.html.slim @@ -1,11 +1,4 @@ - breadcrumb :time_tables, @referential -/ PageHeader -= pageheader 'calendrier-application', - t("time_tables.#{params[:action]}.title"), - '', - '' - -/ PageContent .page_content .container-fluid .row diff --git a/app/views/time_tables/show.html.slim b/app/views/time_tables/show.html.slim index 85de7f8ec..8326a4d05 100644 --- a/app/views/time_tables/show.html.slim +++ b/app/views/time_tables/show.html.slim @@ -1,14 +1,12 @@ - require 'calendar_helper' - breadcrumb :time_table, @referential, @time_table -/ PageHeader +- page_header_content_for @time_table -= pageheader 'calendrier-application', - @time_table.comment, - '', - t('last_update', time: l(@time_table.updated_at, format: :short)), - (policy(@time_table).edit? ? link_to(t('actions.edit'), edit_referential_time_table_path(@referential, @time_table), class: 'btn btn-default') : '') +- content_for :page_header_actions do + - if policy(@time_table).edit? + = link_to(t('actions.edit'), edit_referential_time_table_path(@referential, @time_table), class: 'btn btn-default') - / Below is secundary actions & optional contents (filters, ...) +- content_for :page_header_content do .row.mb-sm .col-lg-12.text-right - @time_table.action_links.each do |link| @@ -18,7 +16,7 @@ class: 'btn btn-primary' do = link.content -/ PageContent + .page_content .container-fluid .row diff --git a/app/views/vehicle_journeys/index.html.slim b/app/views/vehicle_journeys/index.html.slim index 2046ecca6..ef9b5a780 100644 --- a/app/views/vehicle_journeys/index.html.slim +++ b/app/views/vehicle_journeys/index.html.slim @@ -1,11 +1,4 @@ - breadcrumb :vehicle_journeys, @referential, @route -/ PageHeader -= pageheader 'horaires-des-courses', - t('vehicle_journeys.index.title', route: @route.name ), - 'Lorem ipsum dolor sit amet', - '' do - -/ PageContent .page_content .container-fluid .row diff --git a/app/views/vehicle_journeys/show.html.slim b/app/views/vehicle_journeys/show.html.slim index 8ff4b188d..c67632864 100644 --- a/app/views/vehicle_journeys/show.html.slim +++ b/app/views/vehicle_journeys/show.html.slim @@ -1,2 +1,3 @@ +- page_header_content_for @vehicle_journey == render 'show_details', vehicle_journey: @vehicle_journey -== render 'show_sidebar'
\ No newline at end of file +== render 'show_sidebar' diff --git a/app/views/workbenches/index.html.slim b/app/views/workbenches/index.html.slim index d35ed8121..14fc79222 100644 --- a/app/views/workbenches/index.html.slim +++ b/app/views/workbenches/index.html.slim @@ -1,8 +1,5 @@ -/ PageHeader -= pageheader 'tableau-de-bord', - t('.title', organisation: current_organisation.name) - / Below is secundary actions & optional contents (filters, ...) +- content_for :page_header_content do .row.mb-sm .col-lg-12.text-right - if policy(Api::V1::ApiKey).create? diff --git a/app/views/workbenches/show.html.slim b/app/views/workbenches/show.html.slim index 66eedb68d..22869b2d7 100644 --- a/app/views/workbenches/show.html.slim +++ b/app/views/workbenches/show.html.slim @@ -1,17 +1,12 @@ - breadcrumb @workbench -/ PageHeader -= pageheader 'jeux-de-donnees', - t('referentials.index.title'), - '', - '' do - / Below is secundary actions & optional contents (filters, ...) +- page_header_content_for @workbench +- content_for :page_header_content do .row.mb-sm .col-lg-12.text-right - if policy(Referential).create? = link_to t('actions.import'), workbench_imports_path(@workbench), class: 'btn btn-primary' = link_to t('actions.add'), new_referential_path(workbench_id: @workbench), class: 'btn btn-primary' -/ PageContent .page_content .container-fluid - if params[:q].present? or @wbench_refs.any? diff --git a/config/locales/calendars.en.yml b/config/locales/calendars.en.yml index 3b015ff08..0076e5207 100644 --- a/config/locales/calendars.en.yml +++ b/config/locales/calendars.en.yml @@ -42,9 +42,9 @@ en: new: title: Add a new calendar edit: - title: Update calendar %{calendar} + title: Update calendar %{name} show: - title: Calendar %{calendar} + title: Calendar %{name} simple_form: labels: calendar: diff --git a/config/locales/calendars.fr.yml b/config/locales/calendars.fr.yml index 55ec9c620..fddb47d64 100644 --- a/config/locales/calendars.fr.yml +++ b/config/locales/calendars.fr.yml @@ -42,9 +42,9 @@ fr: new: title: Ajouter un calendrier edit: - title: Editer le calendrier %{calendar} + title: Editer le calendrier %{name} show: - title: Calendrier %{calendar} + title: Calendrier %{name} simple_form: labels: calendar: diff --git a/config/locales/companies.en.yml b/config/locales/companies.en.yml index 301f4d68d..a3cd520cb 100644 --- a/config/locales/companies.en.yml +++ b/config/locales/companies.en.yml @@ -9,9 +9,9 @@ en: new: title: "Add a new company" edit: - title: "Update company %{company}" + title: "Update company %{name}" show: - title: "Company %{company}" + title: "Company %{name}" index: title: "Companies" name: "Search by name..." diff --git a/config/locales/companies.fr.yml b/config/locales/companies.fr.yml index 58fcc2ed7..0cf729c35 100644 --- a/config/locales/companies.fr.yml +++ b/config/locales/companies.fr.yml @@ -9,9 +9,9 @@ fr: new: title: "Ajouter un transporteur" edit: - title: "Editer le transporteur %{company}" + title: "Editer le transporteur %{name}" show: - title: "Transporteur %{company}" + title: "Transporteur %{name}" index: title: "Transporteurs" name: "Recherche par nom..." diff --git a/config/locales/en.yml b/config/locales/en.yml index b65484bc2..4834ceef4 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -48,6 +48,8 @@ en: format: "%{message}" last_update: 'Last update on<br>%{time}' + whodunnit: 'By %{author}' + default_whodunnit: 'web service' last_sync: 'Last sync on %{time}' validity_range: '%{debut} > %{end}' bounding_dates: '%{debut} > %{end}' diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 49e41a570..24482166c 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -48,6 +48,8 @@ fr: format: "%{message}" last_update: 'Dernière mise à jour<br>le %{time}' + whodunnit: 'Par %{author}' + default_whodunnit: 'web service' last_sync: 'Dernière mise à jour le %{time}' validity_range: '%{debut} > %{end}' bounding_dates: '%{debut} > %{end}' diff --git a/config/locales/line_referentials.en.yml b/config/locales/line_referentials.en.yml index c6e498b50..5663ed691 100644 --- a/config/locales/line_referentials.en.yml +++ b/config/locales/line_referentials.en.yml @@ -5,7 +5,7 @@ en: sync: "Launch a new codifligne synchronization" cancel_sync: "Cancel codifligne synchronization" edit: - title: "Edit %{line_referential} referential" + title: "Edit %{name} referential" show: title: "iLICO synchronization" synchronized: Synchronized diff --git a/config/locales/line_referentials.fr.yml b/config/locales/line_referentials.fr.yml index 1711fdf9c..630a3e170 100644 --- a/config/locales/line_referentials.fr.yml +++ b/config/locales/line_referentials.fr.yml @@ -5,7 +5,7 @@ fr: sync: "Lancer une synchronisation Codifligne" cancel_sync: "Annuler la synchronisation Codifligne" edit: - title: "Editer le référentiel %{line_referential}" + title: "Editer le référentiel %{name}" show: title: 'Synchronisation iLICO' synchronized: Synchronisé diff --git a/config/locales/lines.en.yml b/config/locales/lines.en.yml index 7df75052a..a69c3b0ba 100644 --- a/config/locales/lines.en.yml +++ b/config/locales/lines.en.yml @@ -18,9 +18,9 @@ en: new: title: "Add a new line" edit: - title: "Update line %{line}" + title: "Update line %{name}" show: - title: "Line %{line}" + title: "Line %{name}" routes: title: "Routes list" group_of_lines: "Groups of lines" diff --git a/config/locales/lines.fr.yml b/config/locales/lines.fr.yml index 728598ec9..160cc4ab4 100644 --- a/config/locales/lines.fr.yml +++ b/config/locales/lines.fr.yml @@ -18,9 +18,9 @@ fr: new: title: "Ajouter une ligne" edit: - title: "Editer la ligne %{line}" + title: "Editer la ligne %{name}" show: - title: "Ligne %{line}" + title: "Ligne %{name}" routes: title: "Liste des Itinéraires" itineraries: "Liste des séquences d'arrêts de la ligne" diff --git a/config/locales/networks.en.yml b/config/locales/networks.en.yml index 86be535e4..94a8d9df0 100644 --- a/config/locales/networks.en.yml +++ b/config/locales/networks.en.yml @@ -9,7 +9,7 @@ en: new: title: "Add a new network" edit: - title: "Update network %{network}" + title: "Update network %{name}" show: title: "Network" index: diff --git a/config/locales/networks.fr.yml b/config/locales/networks.fr.yml index 30d061968..48c32e7c1 100644 --- a/config/locales/networks.fr.yml +++ b/config/locales/networks.fr.yml @@ -9,9 +9,9 @@ fr: new: title: "Ajouter un réseau" edit: - title: "Editer le réseau %{network}" + title: "Editer le réseau %{name}" show: - title: "Réseau %{network}" + title: "Réseau %{name}" index: title: "Réseaux" name: "Recherche par nom..." diff --git a/config/locales/routes.en.yml b/config/locales/routes.en.yml index ba4f76daa..d82ba98dd 100644 --- a/config/locales/routes.en.yml +++ b/config/locales/routes.en.yml @@ -16,7 +16,7 @@ en: new: title: "Add a new route" edit: - title: "Update route %{route}" + title: "Update route %{name}" select2: placeholder: "Select a stop point..." map: @@ -37,7 +37,7 @@ en: normal: Normal alighting forbidden: Forbidden alighting show: - title: "Route %{route}" + title: "Route %{name}" stop_points: "Stop point on route list" stop_areas: title: "Stop area list" @@ -45,7 +45,7 @@ en: no_opposite_route: "No reversed route associated" undefined: "Undefined" index: - title: "Routes %{route}" + title: "Routes" selection: "Selection" selection_all: "All" edit_boarding_alighting: diff --git a/config/locales/routes.fr.yml b/config/locales/routes.fr.yml index 3bcc33320..457345ae8 100644 --- a/config/locales/routes.fr.yml +++ b/config/locales/routes.fr.yml @@ -16,7 +16,7 @@ fr: new: title: "Ajouter un itinéraire" edit: - title: "Editer l'itinéraire %{route}" + title: "Editer l'itinéraire %{name}" select2: placeholder: "Sélectionnez un arrêt existant..." map: @@ -37,7 +37,7 @@ fr: normal: Descente autorisée forbidden: Descente interdite show: - title: "Itinéraire %{route} de la ligne %{line}" + title: "Itinéraire %{name}" stop_points: "Liste des arrêts de l'itinéraire" stop_areas: title: "Liste des arrêts" @@ -45,7 +45,7 @@ fr: no_opposite_route: "Aucun itinéraire associé" undefined: "Non défini" index: - title: "Itinéraire %{route}" + title: "Itinéraire" selection: "Sélection" selection_all: "Tous" edit_boarding_alighting: diff --git a/config/locales/routing_constraint_zones.en.yml b/config/locales/routing_constraint_zones.en.yml index cc0a15e0c..34a10ac67 100644 --- a/config/locales/routing_constraint_zones.en.yml +++ b/config/locales/routing_constraint_zones.en.yml @@ -31,8 +31,8 @@ en: new: title: Add a new routings constraint zone edit: - title: "Update routing constraint zone %{routing_constraint_zone}" + title: "Update routing constraint zone %{name}" show: - title: "Routing constraint zone %{routing_constraint_zone}" + title: "Routing constraint zone %{name}" index: title: "Interdictions of local trafficous" diff --git a/config/locales/routing_constraint_zones.fr.yml b/config/locales/routing_constraint_zones.fr.yml index 10c6d37f7..80bbad8cf 100644 --- a/config/locales/routing_constraint_zones.fr.yml +++ b/config/locales/routing_constraint_zones.fr.yml @@ -31,8 +31,8 @@ fr: new: title: Créer une ITL edit: - title: "Editer l'ITL : %{routing_constraint_zone}" + title: "Editer l'ITL : %{name}" show: - title: "Zone de contrainte %{routing_constraint_zone}" + title: "Zone de contrainte %{name}" index: title: "Interdictions de trafic local" diff --git a/config/locales/stop_areas.fr.yml b/config/locales/stop_areas.fr.yml index 216516e5b..bf4dd832f 100644 --- a/config/locales/stop_areas.fr.yml +++ b/config/locales/stop_areas.fr.yml @@ -44,9 +44,9 @@ fr: address: "246 Boulevard Saint-Germain, 75007 Paris" geolocalize: "Géolocalisez " edit: - title: "Editer l'arrêt %{stop_area}" + title: "Editer l'arrêt %{name}" show: - title: "Arrêt %{stop_area}" + title: "Arrêt %{name}" geographic_data: "Données géographiques" no_geographic_data: "Aucune" itl_managment: "Gestion des liens de l'ITL" diff --git a/db/migrate/20171121142536_create_versions.rb b/db/migrate/20171121142536_create_versions.rb new file mode 100644 index 000000000..ff794f9e1 --- /dev/null +++ b/db/migrate/20171121142536_create_versions.rb @@ -0,0 +1,34 @@ +class CreateVersions < ActiveRecord::Migration + + # The largest text column available in all supported RDBMS is + # 1024^3 - 1 bytes, roughly one gibibyte. We specify a size + # so that MySQL will use `longtext` instead of `text`. Otherwise, + # when serializing very large objects, `text` might not be big enough. + TEXT_BYTES = 1_073_741_823 + + def change + create_table :versions do |t| + t.string :item_type, :null => false + t.integer :item_id, :null => false + t.string :event, :null => false + t.string :whodunnit + t.text :object, :limit => TEXT_BYTES + + # Known issue in MySQL: fractional second precision + # ------------------------------------------------- + # + # MySQL timestamp columns do not support fractional seconds unless + # defined with "fractional seconds precision". MySQL users should manually + # add fractional seconds precision to this migration, specifically, to + # the `created_at` column. + # (https://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html) + # + # MySQL users should also upgrade to rails 4.2, which is the first + # version of ActiveRecord with support for fractional seconds in MySQL. + # (https://github.com/rails/rails/pull/14359) + # + t.datetime :created_at + end + add_index :versions, [:item_type, :item_id] + end +end diff --git a/db/migrate/20171121153506_remove_creator_id.rb b/db/migrate/20171121153506_remove_creator_id.rb new file mode 100644 index 000000000..520941841 --- /dev/null +++ b/db/migrate/20171121153506_remove_creator_id.rb @@ -0,0 +1,11 @@ +class RemoveCreatorId < ActiveRecord::Migration + def change + [ + 'companies', 'connection_links', 'facilities', 'group_of_lines', + 'journey_patterns', 'lines', 'networks', 'pt_links', 'routes', 'routing_constraint_zones', + 'stop_areas', 'stop_points', 'time_tables', 'timebands', 'vehicle_journeys', 'access_links', 'access_points' + ].each do |table_name| + remove_column table_name, :creator_id, :string + end + end +end diff --git a/db/migrate/20171121163631_remove_creator_from_compliance_check_sets.rb b/db/migrate/20171121163631_remove_creator_from_compliance_check_sets.rb new file mode 100644 index 000000000..0798b2040 --- /dev/null +++ b/db/migrate/20171121163631_remove_creator_from_compliance_check_sets.rb @@ -0,0 +1,5 @@ +class RemoveCreatorFromComplianceCheckSets < ActiveRecord::Migration + def change + remove_column :compliance_check_sets, :creator, :string + end +end diff --git a/db/migrate/20171130172926_delete_compliance_control_set_foreign_key_for_compliance_check_set.rb b/db/migrate/20171130172926_delete_compliance_control_set_foreign_key_for_compliance_check_set.rb new file mode 100644 index 000000000..ea94a01c1 --- /dev/null +++ b/db/migrate/20171130172926_delete_compliance_control_set_foreign_key_for_compliance_check_set.rb @@ -0,0 +1,10 @@ +class DeleteComplianceControlSetForeignKeyForComplianceCheckSet < ActiveRecord::Migration + + def up + remove_foreign_key :compliance_check_sets, :compliance_control_sets + end + + def down + add_foreign_key :compliance_check_sets, :compliance_control_sets + end +end diff --git a/db/migrate/20171130180144_change_item_id_in_versions_to_bigint.rb b/db/migrate/20171130180144_change_item_id_in_versions_to_bigint.rb new file mode 100644 index 000000000..b1e6ca0a6 --- /dev/null +++ b/db/migrate/20171130180144_change_item_id_in_versions_to_bigint.rb @@ -0,0 +1,8 @@ +class ChangeItemIdInVersionsToBigint < ActiveRecord::Migration + def up + change_column :versions, :item_id, :integer, limit: 8, null: false + end + def down + change_column :versions, :item_id, :integer, null: false + end +end diff --git a/db/schema.rb b/db/schema.rb index a67b58e94..4650d8812 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -23,7 +23,6 @@ ActiveRecord::Schema.define(version: 20171128112629) do t.integer "stop_area_id", limit: 8 t.string "objectid", null: false t.integer "object_version", limit: 8 - t.string "creator_id" t.string "name" t.string "comment" t.decimal "link_distance", precision: 19, scale: 2 @@ -46,7 +45,6 @@ ActiveRecord::Schema.define(version: 20171128112629) do create_table "access_points", id: :bigserial, force: :cascade do |t| t.string "objectid" t.integer "object_version", limit: 8 - t.string "creator_id" t.string "name" t.string "comment" t.decimal "longitude", precision: 19, scale: 16 @@ -123,7 +121,6 @@ ActiveRecord::Schema.define(version: 20171128112629) do create_table "companies", id: :bigserial, force: :cascade do |t| t.string "objectid", null: false t.integer "object_version", limit: 8 - t.string "creator_id" t.string "name" t.string "short_name" t.string "organizational_unit" @@ -188,7 +185,6 @@ ActiveRecord::Schema.define(version: 20171128112629) do t.integer "referential_id", limit: 8 t.integer "compliance_control_set_id", limit: 8 t.integer "workbench_id", limit: 8 - t.string "creator" t.string "status" t.integer "parent_id", limit: 8 t.string "parent_type" @@ -265,7 +261,6 @@ ActiveRecord::Schema.define(version: 20171128112629) do t.integer "arrival_id", limit: 8 t.string "objectid", null: false t.integer "object_version", limit: 8 - t.string "creator_id" t.string "name" t.string "comment" t.decimal "link_distance", precision: 19, scale: 2 @@ -284,6 +279,22 @@ ActiveRecord::Schema.define(version: 20171128112629) do add_index "connection_links", ["objectid"], name: "connection_links_objectid_key", unique: true, using: :btree + create_table "delayed_jobs", id: :bigserial, force: :cascade do |t| + t.integer "priority", default: 0 + t.integer "attempts", default: 0 + t.text "handler" + t.text "last_error" + t.datetime "run_at" + t.datetime "locked_at" + t.datetime "failed_at" + t.string "locked_by", limit: 255 + t.string "queue", limit: 255 + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority", using: :btree + create_table "exports", id: :bigserial, force: :cascade do |t| t.integer "referential_id", limit: 8 t.string "status" @@ -305,7 +316,6 @@ ActiveRecord::Schema.define(version: 20171128112629) do t.string "objectid", null: false t.integer "object_version", limit: 8 t.datetime "creation_time" - t.string "creator_id" t.string "name" t.string "comment" t.string "description" @@ -347,7 +357,6 @@ ActiveRecord::Schema.define(version: 20171128112629) do create_table "group_of_lines", id: :bigserial, force: :cascade do |t| t.string "objectid", null: false t.integer "object_version", limit: 8 - t.string "creator_id" t.string "name" t.string "comment" t.string "registration_number" @@ -405,7 +414,7 @@ ActiveRecord::Schema.define(version: 20171128112629) do t.datetime "started_at" t.datetime "ended_at" t.string "token_download" - t.string "type" + t.string "type", limit: 255 t.integer "parent_id", limit: 8 t.string "parent_type" t.datetime "notified_parent_at" @@ -435,7 +444,6 @@ ActiveRecord::Schema.define(version: 20171128112629) do t.integer "route_id", limit: 8 t.string "objectid", null: false t.integer "object_version", limit: 8 - t.string "creator_id" t.string "name" t.string "comment" t.string "registration_number" @@ -500,7 +508,6 @@ ActiveRecord::Schema.define(version: 20171128112629) do t.integer "company_id", limit: 8 t.string "objectid", null: false t.integer "object_version", limit: 8 - t.string "creator_id" t.string "name" t.string "number" t.string "published_name" @@ -532,7 +539,6 @@ ActiveRecord::Schema.define(version: 20171128112629) do create_table "networks", id: :bigserial, force: :cascade do |t| t.string "objectid", null: false t.integer "object_version", limit: 8 - t.string "creator_id" t.date "version_date" t.string "description" t.string "name" @@ -551,6 +557,11 @@ ActiveRecord::Schema.define(version: 20171128112629) do add_index "networks", ["objectid"], name: "networks_objectid_key", unique: true, using: :btree add_index "networks", ["registration_number"], name: "networks_registration_number_key", using: :btree + create_table "object_id_factories", id: :bigserial, force: :cascade do |t| + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + create_table "organisations", id: :bigserial, force: :cascade do |t| t.string "name" t.datetime "created_at" @@ -570,7 +581,6 @@ ActiveRecord::Schema.define(version: 20171128112629) do t.integer "route_id", limit: 8 t.string "objectid", null: false t.integer "object_version", limit: 8 - t.string "creator_id" t.string "name" t.string "comment" t.decimal "link_distance", precision: 19, scale: 2 @@ -647,7 +657,6 @@ ActiveRecord::Schema.define(version: 20171128112629) do t.integer "line_id", limit: 8 t.string "objectid", null: false t.integer "object_version", limit: 8 - t.string "creator_id" t.string "name" t.string "comment" t.integer "opposite_route_id", limit: 8 @@ -670,7 +679,6 @@ ActiveRecord::Schema.define(version: 20171128112629) do t.datetime "updated_at" t.string "objectid", null: false t.integer "object_version", limit: 8 - t.string "creator_id" t.integer "route_id", limit: 8 t.integer "stop_point_ids", limit: 8, array: true t.string "checksum" @@ -720,17 +728,16 @@ ActiveRecord::Schema.define(version: 20171128112629) do create_table "stop_areas", id: :bigserial, force: :cascade do |t| t.integer "parent_id", limit: 8 - t.string "objectid", null: false + t.string "objectid", null: false t.integer "object_version", limit: 8 - t.string "creator_id" t.string "name" t.string "comment" t.string "area_type" t.string "registration_number" t.string "nearest_topic_name" t.integer "fare_code" - t.decimal "longitude", precision: 19, scale: 16 - t.decimal "latitude", precision: 19, scale: 16 + t.decimal "longitude", precision: 19, scale: 16 + t.decimal "latitude", precision: 19, scale: 16 t.string "long_lat_type" t.string "country_code" t.string "street_name" @@ -748,7 +755,7 @@ ActiveRecord::Schema.define(version: 20171128112629) do t.datetime "deleted_at" t.datetime "created_at" t.datetime "updated_at" - t.string "stif_type" + t.string "stif_type", limit: 255 end add_index "stop_areas", ["name"], name: "index_stop_areas_on_name", using: :btree @@ -766,7 +773,6 @@ ActiveRecord::Schema.define(version: 20171128112629) do t.integer "stop_area_id", limit: 8 t.string "objectid", null: false t.integer "object_version", limit: 8 - t.string "creator_id" t.integer "position" t.string "for_boarding" t.string "for_alighting" @@ -819,18 +825,17 @@ ActiveRecord::Schema.define(version: 20171128112629) do add_index "time_table_periods", ["time_table_id"], name: "index_time_table_periods_on_time_table_id", using: :btree create_table "time_tables", id: :bigserial, force: :cascade do |t| - t.string "objectid", null: false - t.integer "object_version", limit: 8, default: 1 - t.string "creator_id" + t.string "objectid", null: false + t.integer "object_version", limit: 8, default: 1 t.string "version" t.string "comment" - t.integer "int_day_types", default: 0 + t.integer "int_day_types", default: 0 t.date "start_date" t.date "end_date" t.integer "calendar_id", limit: 8 t.datetime "created_at" t.datetime "updated_at" - t.string "color" + t.string "color", limit: 255 t.integer "created_from_id", limit: 8 t.string "checksum" t.text "checksum_source" @@ -852,7 +857,6 @@ ActiveRecord::Schema.define(version: 20171128112629) do create_table "timebands", id: :bigserial, force: :cascade do |t| t.string "objectid", null: false t.integer "object_version", limit: 8 - t.string "creator_id" t.string "name" t.time "start_time", null: false t.time "end_time", null: false @@ -924,7 +928,6 @@ ActiveRecord::Schema.define(version: 20171128112629) do t.integer "company_id", limit: 8 t.string "objectid", null: false t.integer "object_version", limit: 8 - t.string "creator_id" t.string "comment" t.string "status_value" t.string "transport_mode" @@ -946,6 +949,17 @@ ActiveRecord::Schema.define(version: 20171128112629) do add_index "vehicle_journeys", ["objectid"], name: "vehicle_journeys_objectid_key", unique: true, using: :btree add_index "vehicle_journeys", ["route_id"], name: "index_vehicle_journeys_on_route_id", using: :btree + create_table "versions", id: :bigserial, force: :cascade do |t| + t.string "item_type", null: false + t.integer "item_id", limit: 8, null: false + t.string "event", null: false + t.string "whodunnit" + t.text "object" + t.datetime "created_at" + end + + add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id", using: :btree + create_table "workbenches", id: :bigserial, force: :cascade do |t| t.string "name" t.integer "organisation_id", limit: 8 @@ -968,7 +982,6 @@ ActiveRecord::Schema.define(version: 20171128112629) do add_foreign_key "compliance_check_messages", "compliance_check_sets" add_foreign_key "compliance_check_messages", "compliance_checks" add_foreign_key "compliance_check_resources", "compliance_check_sets" - add_foreign_key "compliance_check_sets", "compliance_control_sets" add_foreign_key "compliance_check_sets", "workbenches" add_foreign_key "compliance_checks", "compliance_check_blocks" add_foreign_key "compliance_checks", "compliance_check_sets" @@ -977,7 +990,9 @@ ActiveRecord::Schema.define(version: 20171128112629) do add_foreign_key "compliance_controls", "compliance_control_blocks" add_foreign_key "compliance_controls", "compliance_control_sets" add_foreign_key "group_of_lines_lines", "group_of_lines", name: "groupofline_group_fkey", on_delete: :cascade + add_foreign_key "journey_frequencies", "timebands", name: "journey_frequencies_timeband_id_fk", on_delete: :nullify add_foreign_key "journey_frequencies", "timebands", on_delete: :nullify + add_foreign_key "journey_frequencies", "vehicle_journeys", name: "journey_frequencies_vehicle_journey_id_fk", on_delete: :nullify add_foreign_key "journey_frequencies", "vehicle_journeys", on_delete: :nullify add_foreign_key "journey_patterns", "routes", name: "jp_route_fkey", on_delete: :cascade add_foreign_key "journey_patterns", "stop_points", column: "arrival_stop_point_id", name: "arrival_point_fkey", on_delete: :nullify diff --git a/spec/db/schema_spec.rb b/spec/db/schema_spec.rb index a7fe0a162..585636124 100644 --- a/spec/db/schema_spec.rb +++ b/spec/db/schema_spec.rb @@ -44,6 +44,6 @@ Diff: #{diff} def diff RSpec::Support::Differ.new( color: RSpec::Matchers.configuration.color? - ).diff_as_string(@original, @expected) + ).diff_as_string(@expected, @original) end end diff --git a/spec/models/api/v1/api_key_spec.rb b/spec/models/api/v1/api_key_spec.rb index b700429d3..cc483a118 100644 --- a/spec/models/api/v1/api_key_spec.rb +++ b/spec/models/api/v1/api_key_spec.rb @@ -4,6 +4,7 @@ RSpec.describe Api::V1::ApiKey, type: :model do subject { create(:api_key) } it { should validate_presence_of :organisation } + it { is_expected.to be_versioned } it 'should have a valid factory' do expect(build(:api_key)).to be_valid diff --git a/spec/models/calendar_spec.rb b/spec/models/calendar_spec.rb index f5020ebf8..e71c2b081 100644 --- a/spec/models/calendar_spec.rb +++ b/spec/models/calendar_spec.rb @@ -6,6 +6,7 @@ RSpec.describe Calendar, :type => :model do it { is_expected.to validate_presence_of(:name) } it { is_expected.to validate_presence_of(:short_name) } it { is_expected.to validate_uniqueness_of(:short_name) } + it { is_expected.to be_versioned } describe '#to_time_table' do let(:calendar) { create(:calendar, date_ranges: [Date.today...(Date.today + 1.month)]) } @@ -29,7 +30,6 @@ RSpec.describe Calendar, :type => :model do end end - describe 'before_validation' do let(:calendar) { create(:calendar, date_ranges: []) } diff --git a/spec/models/chouette/access_link_spec.rb b/spec/models/chouette/access_link_spec.rb index d0f351480..ced99eb1d 100644 --- a/spec/models/chouette/access_link_spec.rb +++ b/spec/models/chouette/access_link_spec.rb @@ -4,6 +4,7 @@ describe Chouette::AccessLink, :type => :model do subject { create(:access_link) } it { is_expected.to validate_uniqueness_of :objectid } + it { is_expected.to be_versioned } describe '#get_objectid' do subject { super().get_objectid } diff --git a/spec/models/chouette/access_point_spec.rb b/spec/models/chouette/access_point_spec.rb index a6798ec3b..c734ecedf 100644 --- a/spec/models/chouette/access_point_spec.rb +++ b/spec/models/chouette/access_point_spec.rb @@ -12,6 +12,7 @@ describe Chouette::AccessPoint, :type => :model do it { is_expected.to validate_presence_of :name } it { is_expected.to validate_numericality_of :latitude } it { is_expected.to validate_numericality_of :longitude } + it { is_expected.to be_versioned } describe ".latitude" do it "should accept -90 value" do diff --git a/spec/models/chouette/company_spec.rb b/spec/models/chouette/company_spec.rb index a3101d79c..34b19eeda 100644 --- a/spec/models/chouette/company_spec.rb +++ b/spec/models/chouette/company_spec.rb @@ -3,6 +3,7 @@ require 'spec_helper' describe Chouette::Company, :type => :model do subject { create(:company) } it { should validate_presence_of :name } + it { is_expected.to be_versioned } describe "#nullables empty" do it "should set null empty nullable attributes" do diff --git a/spec/models/chouette/connection_link_spec.rb b/spec/models/chouette/connection_link_spec.rb index 04c15b42e..4ab67d007 100644 --- a/spec/models/chouette/connection_link_spec.rb +++ b/spec/models/chouette/connection_link_spec.rb @@ -8,6 +8,7 @@ describe Chouette::ConnectionLink, :type => :model do subject { create(:connection_link) } it { is_expected.to validate_uniqueness_of :objectid } + it { is_expected.to be_versioned } describe '#get_objectid' do subject { super().get_objectid } diff --git a/spec/models/chouette/group_of_line_spec.rb b/spec/models/chouette/group_of_line_spec.rb index 29b4433c5..d43d75374 100644 --- a/spec/models/chouette/group_of_line_spec.rb +++ b/spec/models/chouette/group_of_line_spec.rb @@ -4,6 +4,7 @@ describe Chouette::GroupOfLine, :type => :model do subject { create(:group_of_line) } it { should validate_presence_of :name } + it { is_expected.to be_versioned } describe "#stop_areas" do let!(:line){create(:line, :group_of_lines => [subject])} diff --git a/spec/models/chouette/journey_pattern_spec.rb b/spec/models/chouette/journey_pattern_spec.rb index 047022ade..ea7c2a2e9 100644 --- a/spec/models/chouette/journey_pattern_spec.rb +++ b/spec/models/chouette/journey_pattern_spec.rb @@ -1,6 +1,8 @@ require 'spec_helper' describe Chouette::JourneyPattern, :type => :model do + it { is_expected.to be_versioned } + describe 'checksum' do it_behaves_like 'checksum support', :journey_pattern end diff --git a/spec/models/chouette/line_spec.rb b/spec/models/chouette/line_spec.rb index bc7b6e0c7..056d5da9e 100644 --- a/spec/models/chouette/line_spec.rb +++ b/spec/models/chouette/line_spec.rb @@ -7,6 +7,7 @@ describe Chouette::Line, :type => :model do # it { is_expected.to validate_presence_of :network } # it { is_expected.to validate_presence_of :company } it { should validate_presence_of :name } + it { is_expected.to be_versioned } describe '#display_name' do it 'should display local_id, number, name and company name' do diff --git a/spec/models/chouette/network_spec.rb b/spec/models/chouette/network_spec.rb index 32bacc512..78a4150df 100644 --- a/spec/models/chouette/network_spec.rb +++ b/spec/models/chouette/network_spec.rb @@ -3,6 +3,7 @@ require 'spec_helper' describe Chouette::Network, :type => :model do subject { create(:network) } it { should validate_presence_of :name } + it { is_expected.to be_versioned } describe "#stop_areas" do let!(:line){create(:line, :network => subject)} diff --git a/spec/models/chouette/route/route_base_spec.rb b/spec/models/chouette/route/route_base_spec.rb index 79daeb6c2..26f57eae5 100644 --- a/spec/models/chouette/route/route_base_spec.rb +++ b/spec/models/chouette/route/route_base_spec.rb @@ -15,6 +15,7 @@ RSpec.describe Chouette::Route, :type => :model do #it { is_expected.to validate_presence_of :direction_code } it { is_expected.to validate_inclusion_of(:direction).in_array(%i(straight_forward backward clockwise counter_clockwise north north_west west south_west south south_east east north_east)) } it { is_expected.to validate_inclusion_of(:wayback).in_array(%i(outbound inbound)) } + it { is_expected.to be_versioned } context "reordering methods" do let(:bad_stop_point_ids){subject.stop_points.map { |sp| sp.id + 1}} diff --git a/spec/models/chouette/routing_constraint_zone_spec.rb b/spec/models/chouette/routing_constraint_zone_spec.rb index c344642e6..8ebd8695c 100644 --- a/spec/models/chouette/routing_constraint_zone_spec.rb +++ b/spec/models/chouette/routing_constraint_zone_spec.rb @@ -7,6 +7,7 @@ describe Chouette::RoutingConstraintZone, type: :model do it { is_expected.to validate_presence_of :name } # shoulda matcher to validate length of array ? xit { is_expected.to validate_length_of(:stop_point_ids).is_at_least(2) } + it { is_expected.to be_versioned } describe 'checksum' do it_behaves_like 'checksum support', :routing_constraint_zone diff --git a/spec/models/chouette/stop_area_spec.rb b/spec/models/chouette/stop_area_spec.rb index 1e0b4af84..c6aeafaf8 100644 --- a/spec/models/chouette/stop_area_spec.rb +++ b/spec/models/chouette/stop_area_spec.rb @@ -11,6 +11,7 @@ describe Chouette::StopArea, :type => :model do it { should validate_presence_of :name } it { should validate_numericality_of :latitude } it { should validate_numericality_of :longitude } + it { is_expected.to be_versioned } # describe ".latitude" do # it "should accept -90 value" do diff --git a/spec/models/chouette/stop_point_spec.rb b/spec/models/chouette/stop_point_spec.rb index 264fd26fc..6b9e7727f 100644 --- a/spec/models/chouette/stop_point_spec.rb +++ b/spec/models/chouette/stop_point_spec.rb @@ -4,6 +4,7 @@ describe Chouette::StopPoint, :type => :model do it { is_expected.to validate_uniqueness_of :objectid } it { is_expected.to validate_presence_of :stop_area } + it { is_expected.to be_versioned } describe '#objectid' do subject { super().get_objectid } diff --git a/spec/models/chouette/time_table_spec.rb b/spec/models/chouette/time_table_spec.rb index 761c39e5b..677308fc8 100644 --- a/spec/models/chouette/time_table_spec.rb +++ b/spec/models/chouette/time_table_spec.rb @@ -6,6 +6,7 @@ describe Chouette::TimeTable, :type => :model do it { is_expected.to validate_presence_of :comment } it { is_expected.to validate_uniqueness_of :objectid } + it { is_expected.to be_versioned } def create_time_table_periode time_table, start_date, end_date create(:time_table_period, time_table: time_table, :period_start => start_date, :period_end => end_date) diff --git a/spec/models/chouette/timeband_spec.rb b/spec/models/chouette/timeband_spec.rb index 1f812a6e2..b960c203f 100644 --- a/spec/models/chouette/timeband_spec.rb +++ b/spec/models/chouette/timeband_spec.rb @@ -1,6 +1,7 @@ require 'spec_helper' describe Chouette::Timeband, :type => :model do + it { is_expected.to be_versioned } describe '#create' do context 'when valid' do diff --git a/spec/models/chouette/vehicle_journey_spec.rb b/spec/models/chouette/vehicle_journey_spec.rb index 86aa475f0..ac9b21ceb 100644 --- a/spec/models/chouette/vehicle_journey_spec.rb +++ b/spec/models/chouette/vehicle_journey_spec.rb @@ -1,6 +1,7 @@ require 'spec_helper' describe Chouette::VehicleJourney, :type => :model do + it { is_expected.to be_versioned } it "must be valid with an at-stop day offset of 1" do vehicle_journey = create( diff --git a/spec/models/compliance_check_set_spec.rb b/spec/models/compliance_check_set_spec.rb index 0159d1c6b..b981a68bb 100644 --- a/spec/models/compliance_check_set_spec.rb +++ b/spec/models/compliance_check_set_spec.rb @@ -12,6 +12,7 @@ RSpec.describe ComplianceCheckSet, type: :model do it { should have_many :compliance_checks } it { should have_many :compliance_check_blocks } + it { is_expected.to be_versioned } describe "#update_status" do it "updates :status to successful when all resources are OK" do @@ -89,4 +90,13 @@ RSpec.describe ComplianceCheckSet, type: :model do expect(check_set.update_status).to be true end end + + describe 'possibility to delete the associated compliance_control_set' do + let!(:compliance_check_set) { create :compliance_check_set } + + it do + expect{ compliance_check_set.compliance_control_set.delete } + .to change{ ComplianceControlSet.count }.by(-1) + end + end end diff --git a/spec/models/compliance_check_spec.rb b/spec/models/compliance_check_spec.rb index bd797ab09..f83d78c29 100644 --- a/spec/models/compliance_check_spec.rb +++ b/spec/models/compliance_check_spec.rb @@ -1,4 +1,5 @@ RSpec.describe ComplianceCheck, type: :model do + it 'should have a valid factory' do expect(FactoryGirl.build(:compliance_check)).to be_valid end diff --git a/spec/models/compliance_control_set_spec.rb b/spec/models/compliance_control_set_spec.rb index 04d1c418c..c157dcaf3 100644 --- a/spec/models/compliance_control_set_spec.rb +++ b/spec/models/compliance_control_set_spec.rb @@ -10,4 +10,5 @@ RSpec.describe ComplianceControlSet, type: :model do it { should have_many(:compliance_control_blocks).dependent(:destroy) } it { should validate_presence_of :name } + it { is_expected.to be_versioned } end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 6d9f4a4a2..47578405e 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -3,6 +3,7 @@ ENV["RAILS_ENV"] ||= 'test' require 'spec_helper' require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' + # Add additional requires below this line. Rails is not loaded until this point! # Requires supporting ruby files with custom matchers and macros, etc, in diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 6b37b9fa8..9679952df 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -34,6 +34,7 @@ require 'webmock/rspec' require 'simplecov' require 'sidekiq/testing' Sidekiq::Testing.fake! +require 'paper_trail/frameworks/rspec' # Requires supporting ruby files with custom matchers and macros, etc, in # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are diff --git a/spec/views/companies/edit.html.erb_spec.rb b/spec/views/companies/edit.html.erb_spec.rb index 5abdddf3c..8aaf705ab 100644 --- a/spec/views/companies/edit.html.erb_spec.rb +++ b/spec/views/companies/edit.html.erb_spec.rb @@ -6,13 +6,6 @@ describe "/companies/edit", :type => :view do let!(:companies) { Array.new(2) { create(:company) } } let!(:line_referential) { assign :line_referential, company.line_referential } - describe "test" do - it "should render h2 with the company name" do - render - expect(rendered).to have_selector("h1", :text => Regexp.new(company.name)) - end - end - describe "form" do it "should render input for name" do render @@ -21,5 +14,4 @@ describe "/companies/edit", :type => :view do end end end - end diff --git a/spec/views/companies/show.html.erb_spec.rb b/spec/views/companies/show.html.erb_spec.rb index dbc544f63..aeb93aebb 100644 --- a/spec/views/companies/show.html.erb_spec.rb +++ b/spec/views/companies/show.html.erb_spec.rb @@ -5,24 +5,8 @@ describe "/companies/show", :type => :view do let!(:company) { assign(:company, create(:company)) } let!(:line_referential) { assign :line_referential, company.line_referential } - it "should render h1 with the company name" do - render - expect(rendered).to have_selector("h1", :text => Regexp.new(company.name)) - end - # it "should display a map with class 'company'" do # render # expect(rendered).to have_selector("#map", :class => 'company') # end - - it "should render a link to edit the company" do - render - expect(rendered).to have_selector("a[href='#{view.edit_line_referential_company_path(line_referential, company)}']") - end - - it "should render a link to remove the company" do - render - expect(rendered).to have_selector("a[href='#{view.line_referential_company_path(line_referential, company)}']") - end - end diff --git a/spec/views/lines/edit.html.erb_spec.rb b/spec/views/lines/edit.html.erb_spec.rb index ae1614400..2af4df10a 100644 --- a/spec/views/lines/edit.html.erb_spec.rb +++ b/spec/views/lines/edit.html.erb_spec.rb @@ -8,13 +8,6 @@ describe "/lines/edit", :type => :view do let!(:lines) { Array.new(2) { create(:line, :network => network, :company => company) } } let!(:line_referential) { assign :line_referential, line.line_referential } - describe "test" do - it "should render h2 with the group name" do - render - expect(rendered).to have_selector("h1", :text => Regexp.new(line.name)) - end - end - describe "form" do it "should render input for name" do render diff --git a/spec/views/lines/show.html.erb_spec.rb b/spec/views/lines/show.html.erb_spec.rb index 7bc120f1a..9649d9c8e 100644 --- a/spec/views/lines/show.html.erb_spec.rb +++ b/spec/views/lines/show.html.erb_spec.rb @@ -17,25 +17,4 @@ describe "/lines/show", :type => :view do before do allow(view).to receive_messages(current_organisation: referential.organisation) end - - it "should render h1 with the line name" do - render - expect(rendered).to have_selector("h1", :text => Regexp.new(line.name)) - end - - # it "should display a map with class 'line'" do - # render - # expect(rendered).to have_selector("#map", :class => 'line') - # end - # FIXME #2018 - xit "should render a link to edit the line" do - render - expect(rendered).to have_selector("a[href='#{view.edit_line_referential_line_path(line_referential, line)}']") - end - - it "should render a link to remove the line" do - render - expect(rendered).to have_selector("a[href='#{view.line_referential_line_path(line_referential, line)}']") - end - end diff --git a/spec/views/networks/edit.html.erb_spec.rb b/spec/views/networks/edit.html.erb_spec.rb index 086988277..aac6d4d28 100644 --- a/spec/views/networks/edit.html.erb_spec.rb +++ b/spec/views/networks/edit.html.erb_spec.rb @@ -5,13 +5,6 @@ describe "/networks/edit", :type => :view do let!(:network) { assign(:network, create(:network) ) } let!(:line_referential) { assign :line_referential, network.line_referential } - describe "test" do - it "should render h2 with the group name" do - render - expect(rendered).to have_selector("h1", :text => Regexp.new(network.name)) - end - end - describe "form" do it "should render input for name" do render diff --git a/spec/views/networks/show.html.erb_spec.rb b/spec/views/networks/show.html.erb_spec.rb index 72605fb46..3926ead14 100644 --- a/spec/views/networks/show.html.erb_spec.rb +++ b/spec/views/networks/show.html.erb_spec.rb @@ -11,24 +11,8 @@ describe "/networks/show", :type => :view do let!(:map) { assign(:map, double(:to_html => '<div id="map"/>'.html_safe)) } let!(:line_referential) { assign :line_referential, network.line_referential } - it "should render h1 with the network name" do - render - expect(rendered).to have_selector("h1", :text => Regexp.new(network.name)) - end - # it "should display a map with class 'network'" do # render # expect(rendered).to have_selector("#map") # end - - it "should render a link to edit the network" do - render - expect(rendered).to have_selector("a[href='#{view.edit_line_referential_network_path(line_referential, network)}']") - end - - it "should render a link to remove the network" do - render - expect(rendered).to have_selector("a[href='#{view.line_referential_network_path(line_referential, network)}']") - end - end diff --git a/spec/views/routes/show.html.erb_spec.rb b/spec/views/routes/show.html.erb_spec.rb index dae8c9ed3..3bbfaa799 100644 --- a/spec/views/routes/show.html.erb_spec.rb +++ b/spec/views/routes/show.html.erb_spec.rb @@ -22,20 +22,4 @@ RSpec.describe "/routes/show", type: :view do referential )) end - - it "should render h1 with the route name" do - render - expect(rendered).to have_selector("h1", :text => Regexp.new(route.name)) - end - - it "should render a link to edit the route" do - render - expect(rendered).to have_selector("a[href='#{view.edit_referential_line_route_path(referential, line, route)}']") - end - - it "should render a link to remove the route" do - render - expect(rendered).to have_selector("a[href='#{view.referential_line_route_path(referential, line, route)}']") - end - end diff --git a/spec/views/stop_areas/edit.html.erb_spec.rb b/spec/views/stop_areas/edit.html.erb_spec.rb index 8006fe612..5105bff4b 100644 --- a/spec/views/stop_areas/edit.html.erb_spec.rb +++ b/spec/views/stop_areas/edit.html.erb_spec.rb @@ -6,13 +6,6 @@ describe "/stop_areas/edit", :type => :view do let!(:stop_area) { assign(:stop_area, create(:stop_area)) } let!(:map) { assign(:map, double(:to_html => '<div id="map"/>'.html_safe)) } - describe "test" do - it "should render h2 with the group name" do - render - expect(rendered).to have_selector("h1", :text => Regexp.new(stop_area.name)) - end - end - describe "form" do it "should render input for name" do render diff --git a/spec/views/stop_areas/show.html.erb_spec.rb b/spec/views/stop_areas/show.html.erb_spec.rb index 6fd416128..693d9cf1f 100644 --- a/spec/views/stop_areas/show.html.erb_spec.rb +++ b/spec/views/stop_areas/show.html.erb_spec.rb @@ -7,24 +7,8 @@ describe "/stop_areas/show", :type => :view do let!(:access_points) { assign :access_points, [] } let!(:map) { assign(:map, double(:to_html => '<div id="map"/>'.html_safe)) } - it "should render h1 with the stop_area name" do - render - expect(rendered).to have_selector("h1", :text => Regexp.new(stop_area.name)) - end - # it "should display a map with class 'stop_area'" do # render # expect(rendered).to have_selector("#map", :class => 'stop_area') # end - - it "should render a link to edit the stop_area" do - render - expect(rendered).to have_selector("a[href='#{view.edit_stop_area_referential_stop_area_path(stop_area_referential, stop_area)}']") - end - - it "should render a link to remove the stop_area" do - render - expect(rendered).to have_selector("a[href='#{view.stop_area_referential_stop_area_path(stop_area_referential, stop_area)}']") - end - end diff --git a/spec/views/time_tables/edit.html.erb_spec.rb b/spec/views/time_tables/edit.html.erb_spec.rb index c84c5eb74..f431eab7b 100644 --- a/spec/views/time_tables/edit.html.erb_spec.rb +++ b/spec/views/time_tables/edit.html.erb_spec.rb @@ -3,13 +3,5 @@ require 'spec_helper' describe "/time_tables/edit", :type => :view do assign_referential let!(:time_table) { assign(:time_table, create(:time_table) ) } - - describe "test" do - it "should render h1 with the group comment" do - render - expect(rendered).to have_selector("h1", :text => Regexp.new(time_table.comment)) - end - end - # No more test for the form, as it is now managed by React/Redux. end diff --git a/spec/views/time_tables/show.html.erb_spec.rb b/spec/views/time_tables/show.html.erb_spec.rb index edfb3f3cc..100c74b90 100644 --- a/spec/views/time_tables/show.html.erb_spec.rb +++ b/spec/views/time_tables/show.html.erb_spec.rb @@ -17,20 +17,4 @@ describe "/time_tables/show", :type => :view do before do allow(view).to receive_messages(current_organisation: referential.organisation) end - - it "should render h2 with the time_table comment" do - render - expect(rendered).to have_selector("h1", :text => Regexp.new(time_table.comment)) - end - - it "should render a link to edit the time_table" do - render - expect(rendered).to have_selector(" a[href='#{view.edit_referential_time_table_path(referential, time_table)}']") - end - - it "should render a link to remove the time_table" do - render - expect(rendered).to have_selector(" a[href='#{view.referential_time_table_path(referential, time_table)}']") - end - end |
