diff options
| author | Teddy Wing | 2017-12-05 18:26:57 +0100 | 
|---|---|---|
| committer | Teddy Wing | 2017-12-05 18:26:57 +0100 | 
| commit | 47181fd81105396b2db394958c39a6e40bc6f0f0 (patch) | |
| tree | e95e67d8479f348453e3e494b5991053b15ba3de /app | |
| parent | 1098e24f15b235dce127f0398adac4bbf7cfe463 (diff) | |
| parent | 9f1aa4d40d7d968963dae5799e15ad5da4cbcbc5 (diff) | |
| download | chouette-core-47181fd81105396b2db394958c39a6e40bc6f0f0.tar.bz2 | |
Merge remote-tracking branch 'origin/master' into 5024-prevent-duplicate-referentials-from-being-created-during-parallel-db-transactions--rb201711271659
Conflicts:
	app/models/referential.rb
A whitespace conflict in a place I don't even remember editing? Okaay.
Diffstat (limited to 'app')
208 files changed, 938 insertions, 916 deletions
| 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/components/_forms.sass b/app/assets/stylesheets/components/_forms.sass index 2b715d669..9a363ab97 100644 --- a/app/assets/stylesheets/components/_forms.sass +++ b/app/assets/stylesheets/components/_forms.sass @@ -531,6 +531,12 @@ table, .table        &.open > .control-label + *          display: block +    &.search +      width: 30% +      > .search_bar +        padding: 0 15px +        > .input-group-btn +          right: 5%      > .filter_menu        margin: 0 diff --git a/app/assets/stylesheets/components/_page_header.sass b/app/assets/stylesheets/components/_page_header.sass index 566f46d6b..30b88f2c1 100644 --- a/app/assets/stylesheets/components/_page_header.sass +++ b/app/assets/stylesheets/components/_page_header.sass @@ -59,7 +59,6 @@    .page-action      line-height: 42px -    height: 45px      margin-bottom: 10px      text-align: right diff --git a/app/assets/stylesheets/typography/_sboiv.sass b/app/assets/stylesheets/typography/_sboiv.sass index e37f89f2d..6c82a5739 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,10 +89,10 @@  .sb-OAS:before    content: '\e90f' -.sb-modele-calendrier:before +.sb-calendar:before    content: '\e910' -.sb-mission:before +.sb-journey_pattern:before    content: '\e911'  .sb-ligne_commerciale: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/v1/internals/application_controller.rb b/app/controllers/api/v1/internals/application_controller.rb new file mode 100644 index 000000000..77b74f5f6 --- /dev/null +++ b/app/controllers/api/v1/internals/application_controller.rb @@ -0,0 +1,16 @@ +module Api +  module V1 +    module Internals +      class ApplicationController < ActionController::Base +        respond_to :json +        layout false +        before_action :authenticate + +        private +        def authenticate +          authenticate_with_http_token { |token| Rails.application.secrets.api_token == token } +        end +      end +    end +  end +end diff --git a/app/controllers/api/v1/internals/compliance_check_sets_controller.rb b/app/controllers/api/v1/internals/compliance_check_sets_controller.rb new file mode 100644 index 000000000..db92c3fad --- /dev/null +++ b/app/controllers/api/v1/internals/compliance_check_sets_controller.rb @@ -0,0 +1,46 @@ +module Api +  module V1 +    module Internals +      class ComplianceCheckSetsController < ApplicationController +        include ControlFlow + +        def validated +          find_compliance_check_set + +          if @compliance_check_set.update_status +            render :validated +          else +            render json: { +              status: "error", +              messages: @compliance_check_set.errors.full_messages +            } +          end +        end + +        def notify_parent +          find_compliance_check_set +          if  @compliance_check_set.notify_parent && @compliance_check_set.parent +            render json: { +              status: "ok", +              message:"#{@compliance_check_set.parent_type} (id: #{@compliance_check_set.parent_id}) successfully notified at #{l(@compliance_check_set.notified_parent_at)}" +            } +          else +            render json: {status: "error", message: @compliance_check_set.errors.full_messages } +          end          +        end + +        private + +        def find_compliance_check_set +          @compliance_check_set = ComplianceCheckSet.find(params[:id]) +        rescue ActiveRecord::RecordNotFound +          render json: { +            status: "error",  +            message: "Record not found" +          } +          finish_action!    +        end +      end +    end +  end +end   diff --git a/app/controllers/api/v1/internals/netex_imports_controller.rb b/app/controllers/api/v1/internals/netex_imports_controller.rb new file mode 100644 index 000000000..89bc1b81d --- /dev/null +++ b/app/controllers/api/v1/internals/netex_imports_controller.rb @@ -0,0 +1,104 @@ +module Api +  module V1 +    module Internals +      class NetexImportsController < ApplicationController +        include ControlFlow + +        def create +          respond_to do | format | +            format.json(&method(:create_models)) +          end +        end + +        def notify_parent +          find_netex_import +          if @netex_import.notify_parent +            render json: { +              status: "ok", +              message:"#{@netex_import.parent_type} (id: #{@netex_import.parent_id}) successfully notified at #{l(@netex_import.notified_parent_at)}" +            } +          else +            render json: {status: "error", message: @netex_import.errors.full_messages } +          end +        end + +        private + +        def find_netex_import +          @netex_import = NetexImport.find(params[:id]) +        rescue ActiveRecord::RecordNotFound +          render json: { +            status: "error",  +            message: "Record not found" +          } +          finish_action!    +        end + +        def find_workbench +          @workbench = Workbench.find(netex_import_params['workbench_id']) +        rescue ActiveRecord::RecordNotFound +          render json: {errors: {'workbench_id' => 'missing'}}, status: 406 +          finish_action! +        end + +        def create_models +          find_workbench +          create_referential +          create_netex_import +        end + +        def create_netex_import +          attributes = netex_import_params.merge creator: "Webservice" + +          attributes = attributes.merge referential_id: @new_referential.id + +          @netex_import = NetexImport.new attributes +          @netex_import.save! + +          unless @netex_import.referential +            Rails.logger.info "Can't create referential for import #{@netex_import.id}: #{@new_referential.inspect} #{@new_referential.metadatas.inspect} #{@new_referential.errors.full_messages}" +            @netex_import.messages.create criticity: :error, message_key: "referential_creation" +          end +        rescue ActiveRecord::RecordInvalid +          render json: {errors: @netex_import.errors}, status: 406 +          finish_action! +        end + +        def create_referential +          @new_referential = +            Referential.new( +              name: netex_import_params['name'], +              organisation_id: @workbench.organisation_id, +              workbench_id: @workbench.id, +              metadatas: [metadata] +            ) +          @new_referential.save +        end + +        def metadata +          metadata = ReferentialMetadata.new + +          if netex_import_params['file'] +            netex_file = STIF::NetexFile.new(netex_import_params['file'].to_io) +            frame = netex_file.frames.first + +            if frame +              metadata.periodes = frame.periods + +              line_objectids = frame.line_refs.map { |ref| "STIF:CODIFLIGNE:Line:#{ref}" } +              metadata.line_ids = @workbench.lines.where(objectid: line_objectids).pluck(:id) +            end +          end + +          metadata +        end + +        def netex_import_params +          params +            .require('netex_import') +            .permit(:file, :name, :workbench_id, :parent_id, :parent_type) +        end +      end +    end +  end +end diff --git a/app/controllers/api/v1/netex_imports_controller.rb b/app/controllers/api/v1/netex_imports_controller.rb index 8e8c48986..d86c1fcd8 100644 --- a/app/controllers/api/v1/netex_imports_controller.rb +++ b/app/controllers/api/v1/netex_imports_controller.rb @@ -1,9 +1,11 @@  module Api    module V1 -    class NetexImportsController < ChouetteController +    class NetexImportsController < ActionController::Base        include ControlFlow -      skip_before_action :authenticate + +      respond_to :json, :xml +      layout false        def create          respond_to do | format | 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 175c22191..600c69126 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) } @@ -12,18 +12,26 @@ class ComplianceCheckSetsController < InheritedResources::Base        @q_for_form = scope.ransack(params[:q])        format.html {          @compliance_check_sets = ModelDecorator.decorate( -          @q_for_form.result, +          @q_for_form.result.order(created_at: :desc),            with: ComplianceCheckSetDecorator          )        }      end    end +  def show +    show! do +      @compliance_check_set = @compliance_check_set.decorate(context: { +        compliance_check_set: @compliance_check_set +      }) +    end +  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..46d34efda 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) } @@ -77,10 +77,10 @@ class ImportsController < InheritedResources::Base    end    def sort_column -    parent.imports.column_names.include?(params[:sort]) ? params[:sort] : 'name' +    parent.imports.column_names.include?(params[:sort]) ? params[:sort] : 'created_at'    end    def sort_direction -    %w[asc desc].include?(params[:direction]) ?  params[:direction] : 'asc' +    %w[asc desc].include?(params[:direction]) ?  params[:direction] : 'desc'    end    def decorate_imports(imports) 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 98c840777..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 @@ -22,10 +22,12 @@ class NetworksController < InheritedResources::Base    def new      authorize resource_class +    new!    end    def create      authorize resource_class +    create!    end    def index @@ -70,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 d6c4327f9..227651a59 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 1d6f88068..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 @@ -64,22 +64,22 @@ class StopAreasController < InheritedResources::Base    def new      authorize resource_class -    @map = StopAreaMap.new( Chouette::StopArea.new).with_helpers(self) -    @map.editable = true +    # @map = StopAreaMap.new( Chouette::StopArea.new).with_helpers(self) +    # @map.editable = true      new!    end    def create      authorize resource_class -    @map = StopAreaMap.new( Chouette::StopArea.new).with_helpers(self) -    @map.editable = true +    # @map = StopAreaMap.new( Chouette::StopArea.new).with_helpers(self) +    # @map.editable = true      create!    end    def show -    map.editable = false -    @access_points = @stop_area.access_points +    # map.editable = false +    # @access_points = @stop_area.access_points      show! do |format|        unless stop_area.position or params[:default] or params[:routing]          format.kml { @@ -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..317bc5518 100644 --- a/app/controllers/time_table_combinations_controller.rb +++ b/app/controllers/time_table_combinations_controller.rb @@ -1,4 +1,6 @@  class TimeTableCombinationsController < ChouetteController +  include ReferentialSupport +  defaults :resource_class => TimeTableCombination    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/decorators/compliance_check_set_decorator.rb b/app/decorators/compliance_check_set_decorator.rb index 5f3821cbe..096596b19 100644 --- a/app/decorators/compliance_check_set_decorator.rb +++ b/app/decorators/compliance_check_set_decorator.rb @@ -3,6 +3,23 @@ class ComplianceCheckSetDecorator < Draper::Decorator    def action_links      links = [] + +    links << Link.new( +      content: h.destroy_link_content, +      href: h.workbench_compliance_check_sets_path(object.id), +      method: :delete, +      data: {confirm: h.t('imports.actions.destroy_confirm')} +    ) + +    links +  end + +  def lines_status +    object.compliance_check_resources.where(status: :OK, resource_type: :line).count +  end + +  def lines_in_compliance_check_set +    object.compliance_check_resources.where(resource_type: :line).count    end  end diff --git a/app/decorators/import_decorator.rb b/app/decorators/import_decorator.rb index d63d723cd..e748f830d 100644 --- a/app/decorators/import_decorator.rb +++ b/app/decorators/import_decorator.rb @@ -12,6 +12,7 @@ class ImportDecorator < Draper::Decorator    end    def action_links +    policy = h.policy(object)      links = []      links << Link.new( @@ -27,16 +28,17 @@ class ImportDecorator < Draper::Decorator        href: object.file.url      ) -    # if h.policy(object).destroy? -    links << Link.new( -      content: h.destroy_link_content, -      href: h.workbench_import_path( -        context[:workbench], -        object -      ), -      method: :delete, -      data: { confirm: h.t('imports.actions.destroy_confirm') } -    ) +    if policy.destroy? +      links << Link.new( +        content: h.destroy_link_content, +        href: h.workbench_import_path( +          context[:workbench], +          object +        ), +        method: :delete, +        data: { confirm: h.t('imports.actions.destroy_confirm') } +      ) +    end      links    end diff --git a/app/decorators/line_decorator.rb b/app/decorators/line_decorator.rb index f351103b2..ede670cbd 100644 --- a/app/decorators/line_decorator.rb +++ b/app/decorators/line_decorator.rb @@ -22,9 +22,19 @@ class LineDecorator < Draper::Decorator      )      if h.policy(Chouette::Line).create? && -        context[:line_referential].organisations.include?( -          context[:current_organisation] -        ) +      context[:line_referential].organisations.include?( +        context[:current_organisation] +      ) +      links << Link.new( +        content: h.t('lines.actions.edit'), +        href: h.edit_line_referential_line_path(context[:line_referential], object.id) +      ) +    end + +    if h.policy(Chouette::Line).create? && +      context[:line_referential].organisations.include?( +        context[:current_organisation] +      )        links << Link.new(          content: h.t('lines.actions.new'),          href: h.new_line_referential_line_path(context[:line_referential]) @@ -33,10 +43,10 @@ class LineDecorator < Draper::Decorator      if h.policy(object).destroy?        links << Link.new( -        content: h.destroy_link_content('lines.actions.destroy_confirm'), +        content: h.destroy_link_content('lines.actions.destroy'),          href: h.line_referential_line_path(context[:line_referential], object),          method: :delete, -        data: { confirm: h.t('lines.actions.destroy_confirm') } +        data: {confirm: h.t('lines.actions.destroy_confirm')}        )      end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0a7b0fb75..d2cdaaa20 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} <br/> #{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/helpers/compliance_check_sets_helper.rb b/app/helpers/compliance_check_sets_helper.rb index fc7165fed..b255aee63 100644 --- a/app/helpers/compliance_check_sets_helper.rb +++ b/app/helpers/compliance_check_sets_helper.rb @@ -13,4 +13,18 @@ module ComplianceCheckSetsHelper        compliance_check.compliance_check_set,        compliance_check)    end + +    # Import statuses helper +  def compliance_check_set_status(status) +    if %w[new running pending].include? status +      content_tag :span, '', class: "fa fa-clock-o" +    else +      cls ='' +      cls = 'success' if status == 'OK' +      cls = 'warning' if status == 'WARNING' +      cls = 'danger' if %w[ERROR IGNORED].include? status + +      content_tag :span, '', class: "fa fa-circle text-#{cls}" +    end +  end  end diff --git a/app/helpers/import_resources_helper.rb b/app/helpers/import_resources_helper.rb index 1d870f68e..3ee96eb9b 100644 --- a/app/helpers/import_resources_helper.rb +++ b/app/helpers/import_resources_helper.rb @@ -12,8 +12,4 @@ module ImportResourcesHelper        content_tag :span, '', class: "fa fa-circle text-#{cls}"    end -  def import_resoruce_metrics(metrics) -    metrics.delete_if {|k,v| !k.include?("count")}.deep_symbolize_keys -  end -  end diff --git a/app/helpers/networks_helper.rb b/app/helpers/networks_helper.rb deleted file mode 100644 index b881ce078..000000000 --- a/app/helpers/networks_helper.rb +++ /dev/null @@ -1,7 +0,0 @@ -module NetworksHelper - -  def source_type_name_label_pairs -    Chouette::Network.source_type_names -      .zip_map { |source_type_name| t("source_types.label.#{source_type_name}") } -  end -end 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..b6f78f239 100644 --- a/app/models/chouette/access_point.rb +++ b/app/models/chouette/access_point.rb @@ -1,14 +1,15 @@  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"      include Geokit::Mappable      include ProjectionFields -    include ObjectidSupport      has_many :access_links, :dependent => :destroy      belongs_to :stop_area @@ -167,4 +168,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 8d5ff5f60..784e3f5b9 100644 --- a/app/models/chouette/line.rb +++ b/app/models/chouette/line.rb @@ -1,10 +1,11 @@  module Chouette    class Line < Chouette::ActiveRecord +    has_paper_trail      include LineRestrictions      include LineReferentialSupport      include ObjectidSupport -    extend StifTransportModeEnumerations -    extend StifTransportSubmodeEnumerations +    include StifTransportModeEnumerations +    include StifTransportSubmodeEnumerations      extend ActiveModel::Naming      # FIXME http://jira.codehaus.org/browse/JRUBY-6358 @@ -79,4 +80,4 @@ module Chouette      end    end -end
\ No newline at end of file +end diff --git a/app/models/chouette/network.rb b/app/models/chouette/network.rb index 3f07ebe0c..9b3f2fe29 100644 --- a/app/models/chouette/network.rb +++ b/app/models/chouette/network.rb @@ -1,15 +1,26 @@  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 +    enumerize :source_type_name, in: %w(public_and_private_utilities +                                        road_authorities +                                        transit_operator +                                        public_transport +                                        passenger_transport_coordinating_authority +                                        travel_information_service_provider +                                        travel_agency +                                        individual_subject_of_travel_itinerary +                                        other_information) +      validates_format_of :registration_number, :with => %r{\A[0-9A-Za-z_-]+\Z}, :allow_nil => true, :allow_blank => true      validates_presence_of :name @@ -47,4 +58,4 @@ module Chouette    end -end
\ No newline at end of file +end 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 329b37a6c..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 @@ -304,4 +305,4 @@ module Chouette          .where('"time_tables_vehicle_journeys"."vehicle_journey_id" IS NULL')      end    end -end
\ No newline at end of file +end diff --git a/app/models/compliance_check_set.rb b/app/models/compliance_check_set.rb index 80e499b74..7c55561af 100644 --- a/app/models/compliance_check_set.rb +++ b/app/models/compliance_check_set.rb @@ -1,16 +1,17 @@  class ComplianceCheckSet < ActiveRecord::Base    extend Enumerize +  has_paper_trail    belongs_to :referential    belongs_to :compliance_control_set    belongs_to :workbench    belongs_to :parent, polymorphic: true -  has_many :compliance_check_blocks -  has_many :compliance_checks +  has_many :compliance_check_blocks, dependent: :destroy +  has_many :compliance_checks, dependent: :destroy -  has_many :compliance_check_resources -  has_many :compliance_check_messages +  has_many :compliance_check_resources, dependent: :destroy +  has_many :compliance_check_messages, dependent: :destroy    enumerize :status, in: %w[new pending successful warning failed running aborted canceled] @@ -18,6 +19,15 @@ class ComplianceCheckSet < ActiveRecord::Base      where('created_at BETWEEN :begin AND :end', begin: period_range.begin, end: period_range.end)    end +  def notify_parent +    if parent +      # parent.child_change +      update(notified_parent_at: DateTime.now) +    else +      errors.add(:base, I18n.t('compliance_check_sets.errors.no_parent')) +    end +  end +    def update_status      statuses = compliance_check_resources.map do |resource|        case resource.status 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/concerns/objectid_formatter_support.rb b/app/models/concerns/objectid_formatter_support.rb index 34a51740f..edc7704b4 100644 --- a/app/models/concerns/objectid_formatter_support.rb +++ b/app/models/concerns/objectid_formatter_support.rb @@ -3,9 +3,9 @@ module ObjectidFormatterSupport    included do      extend Enumerize -    enumerize :objectid_format, in: %w(netex stif_netex stif_reflex stif_codifligne), default: 'netex' +    enumerize :objectid_format, in: %w(netex stif_netex stif_reflex stif_codifligne)      validates_presence_of :objectid_format -     +      def objectid_formatter        objectid_formatter_class.new      end diff --git a/app/models/concerns/objectid_support.rb b/app/models/concerns/objectid_support.rb index 85b5da3a8..cec36678e 100644 --- a/app/models/concerns/objectid_support.rb +++ b/app/models/concerns/objectid_support.rb @@ -27,4 +27,4 @@ module ObjectidSupport        get_objectid.try(:class)      end    end -end
\ No newline at end of file +end 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/models/referential.rb b/app/models/referential.rb index c91007172..f89eafee8 100644 --- a/app/models/referential.rb +++ b/app/models/referential.rb @@ -127,10 +127,11 @@ class Referential < ActiveRecord::Base      Chouette::RoutingConstraintZone.all    end -  after_initialize :define_default_attributes +  before_validation :define_default_attributes    def define_default_attributes      self.time_zone ||= Time.zone.name +    self.objectid_format ||= workbench.objectid_format if workbench    end    def switch @@ -149,6 +150,7 @@ class Referential < ActiveRecord::Base        line_referential: from.line_referential,        stop_area_referential: from.stop_area_referential,        created_from: from, +      objectid_format: from.objectid_format,        metadatas: from.metadatas.map { |m| ReferentialMetadata.new_from(m, functional_scope) }      )    end diff --git a/app/policies/company_policy.rb b/app/policies/company_policy.rb index 45386aba4..b08dcec53 100644 --- a/app/policies/company_policy.rb +++ b/app/policies/company_policy.rb @@ -1,7 +1,19 @@  class CompanyPolicy < ApplicationPolicy -    class Scope < Scope -      def resolve -        scope -      end +  class Scope < Scope +    def resolve +      scope      end    end + +  def create? +    user.has_permission?('companies.create') +  end + +  def destroy? +    user.has_permission?('companies.destroy') +  end + +  def update? +    user.has_permission?('companies.update') +  end +end diff --git a/app/policies/compliance_check_set_policy.rb b/app/policies/compliance_check_set_policy.rb index 171a33347..90323d7c3 100644 --- a/app/policies/compliance_check_set_policy.rb +++ b/app/policies/compliance_check_set_policy.rb @@ -3,5 +3,6 @@ class ComplianceCheckSetPolicy < ApplicationPolicy      def resolve        scope      end +    end -end
\ No newline at end of file +end diff --git a/app/policies/import_policy.rb b/app/policies/import_policy.rb index b12dcc167..512bfc8ac 100644 --- a/app/policies/import_policy.rb +++ b/app/policies/import_policy.rb @@ -6,14 +6,10 @@ class ImportPolicy < ApplicationPolicy    end    def create? -    !archived? && user.has_permission?('imports.create') -  end - -  def destroy? -    !archived? && user.has_permission?('imports.destroy') +    user.has_permission?('imports.create')    end    def update? -    !archived? && user.has_permission?('imports.update') +    user.has_permission?('imports.update')    end  end diff --git a/app/policies/line_policy.rb b/app/policies/line_policy.rb index acb0d79e7..67ea0b611 100644 --- a/app/policies/line_policy.rb +++ b/app/policies/line_policy.rb @@ -1,11 +1,23 @@  class LinePolicy < ApplicationPolicy -    class Scope < Scope      def resolve        scope      end    end +  def create? +    Rails.logger.debug "LinePolicy.create?" +    user.has_permission?('lines.create') +  end + +  def destroy? +    user.has_permission?('lines.destroy') +  end + +  def update? +    user.has_permission?('lines.update') +  end +    def create_footnote?      !archived? && organisation_match? && user.has_permission?('footnotes.create')    end diff --git a/app/policies/stop_area_policy.rb b/app/policies/stop_area_policy.rb index de8ecda8d..faeebbc2a 100644 --- a/app/policies/stop_area_policy.rb +++ b/app/policies/stop_area_policy.rb @@ -4,4 +4,16 @@ class StopAreaPolicy < ApplicationPolicy        scope      end    end + +  def create? +    user.has_permission?('stop_areas.create') +  end + +  def destroy? +    user.has_permission?('stop_areas.destroy') +  end + +  def update? +    user.has_permission?('stop_areas.update') +  end  end diff --git a/app/services/http_service.rb b/app/services/http_service.rb index d3999f293..c0cc1c59b 100644 --- a/app/services/http_service.rb +++ b/app/services/http_service.rb @@ -26,7 +26,7 @@ module HTTPService extend self    # params: { netex_import: {referential_id: 13, workbench_id: 1}},    # upload: {file: [StringIO.new('howdy'), 'application/zip', 'greeting']})    def post_resource(host:, path:, token: nil, params: {}, upload: nil) -    result = Faraday.new(url: host) do |c| +    Faraday.new(url: host) do |c|        c.headers['Authorization'] = "Token token=#{token.inspect}" if token        c.request :multipart        c.request :url_encoded 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/_form.html.slim b/app/views/companies/_form.html.slim index caf75bd8b..3979c5800 100644 --- a/app/views/companies/_form.html.slim +++ b/app/views/companies/_form.html.slim @@ -1,18 +1,18 @@ -= semantic_form_for [@line_referential, @company] do |form| -  = form.inputs do -    = form.input :name, :input_html => {  :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.company.name") } -    = form.input :short_name -    = form.input :organizational_unit -    = form.input :operating_department_name -    = form.input :code -    = form.input :phone, as: :phone -    = form.input :fax, as: :phone -    = form.input :email, as: :email -    = form.input :time_zone, include_blank: true -    = form.input :url -    = form.input :registration_number, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.company.registration_number") } -    = form.input :objectid, :required => !@company.new_record?, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.company.objectid") } += simple_form_for [@line_referential, @company], html: {class: 'form-horizontal', id: 'company_form'}, wrapper: :horizontal_form do |f| +  .row +    .col-lg-12 +      = f.input :name, :input_html => {:title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.company.name")} +      = f.input :short_name +      = f.input :organizational_unit +      = f.input :operating_department_name +      = f.input :code +      = f.input :phone +      = f.input :fax +      = f.input :email, as: :email +      = f.input :time_zone, include_blank: true +      = f.input :url +      = f.input :registration_number, :input_html => {:title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.company.registration_number")} -  = form.actions do -    = form.action :submit, as: :button -    = form.action :cancel, as: :link
\ No newline at end of file +  .separator + +  = f.button :submit, t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'company_form' diff --git a/app/views/companies/edit.html.slim b/app/views/companies/edit.html.slim index 2f4c559b9..faa88f829 100644 --- a/app/views/companies/edit.html.slim +++ b/app/views/companies/edit.html.slim @@ -1,4 +1,3 @@  - breadcrumb :company, @company - -= title_tag t('companies.edit.title', company: @company.name) -= 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 68c0f76c3..cc085ffe2 100644 --- a/app/views/companies/new.html.slim +++ b/app/views/companies/new.html.slim @@ -1,2 +1,6 @@ -= title_tag t('companies.new.title') -= render 'form' +- breadcrumb :lines, @line_referential +.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 diff --git a/app/views/companies/show.html.slim b/app/views/companies/show.html.slim index 4219595b8..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,14 +11,15 @@          = 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        .col-lg-6.col-md-6.col-sm-12.col-xs-12          = definition_list t('metadatas'), -          { 'ID Codif' => @company.try(:get_objectid).try(:local_id), +          { 'ID Codif' => @company.try(:get_objectid).try(:short_id),              Chouette::Company.human_attribute_name(:phone) => @company.phone,              Chouette::Company.human_attribute_name(:email) => @company.email,              Chouette::Company.human_attribute_name(:url) => @company.url } diff --git a/app/views/compliance_check_sets/_filters.html.slim b/app/views/compliance_check_sets/_filters.html.slim index 3051bda64..bf929bc08 100644 --- a/app/views/compliance_check_sets/_filters.html.slim +++ b/app/views/compliance_check_sets/_filters.html.slim @@ -10,14 +10,18 @@      .form-group.togglable        = f.label t('activerecord.attributes.compliance_check_set.assigned_to'), required: false, class: 'control-label'        = f.input :parent_type_eq_any, collection: ComplianceCheckSet.order('parent_type'), as: :check_boxes, label: false, label_method: lambda {|w| ("<span>#{w}</span>").html_safe}, required: false, wrapper_html: {class: 'checkbox_list'} -      .form-group.togglable        = f.label Import.human_attribute_name(:created_at), required: false, class: 'control-label'        .filter_menu          = f.simple_fields_for :created_at do |p|            = p.input :start_date, as: :date, label: false, wrapper_html: {class: 'date smart_date filter_menu-item'}, default: @begin_range, include_blank: @begin_range ? false : true            = p.input :end_date, as: :date, label: false, wrapper_html: {class: 'date smart_date filter_menu-item'}, default: @end_range, include_blank: @end_range ? false : true - +    .form-group.search +      .input-group.search_bar +        = f.search_field :compliance_control_set_name_cont, class: 'form-control', placeholder: t('compliance_check_sets.filters.name_compliance_control_set') +        span.input-group-btn +          button.btn.btn-default type='submit' +            span.fa.fa-search    .actions      = link_to t('actions.erase'), @compliance_checks_sets, class: 'btn btn-link'      = f.submit t('actions.filter'), class: 'btn btn-default', id: 'compliance_check_set_filter_btn' 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 4ca5a2ee7..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 @@ -22,7 +12,7 @@                [ \                  TableBuilderHelper::Column.new( \                    key: :ref, \ -                  attribute: 'referential_id' \ +                  attribute: 'compliance_check_set_id' \                  ), \                  TableBuilderHelper::Column.new( \                    key: :creation_date, \ @@ -31,8 +21,8 @@                  TableBuilderHelper::Column.new( \                    key: :associated_object, \                    attribute: Proc.new{|n| n.referential.name}, \ -                  link_to: lambda do |referential| \ -                    referential_path(referential, current_workbench_id: params[:id]) \ +                  link_to: lambda do |compliance_check_set| \ +                    referential_path(compliance_check_set.referential_id) \                    end \                  ), \                  TableBuilderHelper::Column.new( \ diff --git a/app/views/compliance_check_sets/show.html.slim b/app/views/compliance_check_sets/show.html.slim new file mode 100644 index 000000000..c9d0583a5 --- /dev/null +++ b/app/views/compliance_check_sets/show.html.slim @@ -0,0 +1,47 @@ +- breadcrumb :compliance_check_sets, @workbench, @compliance_check_set +/ PageHeader += pageheader 'jeux-de-donnees', +             @compliance_check_set.name, +             '', +             t('last_update', time: l(@compliance_check_set.updated_at, format: :short)) do + +  / Below is secundary actions & optional contents (filters, ...) +  .row +    .col-lg-12.text-right.mb-sm +      - @compliance_check_set.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.import_messages +  .container-fluid +    .row +      .col-lg-12 +        h1 +          span.status_icon = compliance_check_set_status(@compliance_check_set.status) +          span = t('compliance_check_sets.show.table_state', lines_status: @compliance_check_set.lines_status , lines_in_compliance_check_set: @compliance_check_set.lines_in_compliance_check_set ) +      .col-lg-12 +        = t('compliance_check_sets.show.table_explanation') +    .row +      .col-lg-12 +        = table_builder_2 @compliance_check_set.compliance_check_resources, +          [ \ +            TableBuilderHelper::Column.new( \ +              key: :name, \ +              attribute: 'name' \ +            ), \ +            TableBuilderHelper::Column.new( \ +              key: :status, \ +              attribute: Proc.new { |n| compliance_check_set_status(n.status) } \ +            ), \ +            TableBuilderHelper::Column.new( \ +              key: :metrics, \ +              attribute: Proc.new { |n| I18n.t('compliance_check_sets.show.metrics', n.metrics.deep_symbolize_keys) } \ +            ) \ +          ], +          sortable: false, \ +          links: [], +          cls: 'table' 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/_dashboard.html.slim b/app/views/dashboards/_dashboard.html.slim index 0b5deffc6..f03301e23 100644 --- a/app/views/dashboards/_dashboard.html.slim +++ b/app/views/dashboards/_dashboard.html.slim @@ -19,6 +19,20 @@            .panel-body              em.small.text-muted = t('.offers.no_content') +    .panel.panel-default +      .panel-heading +        h3.panel-title.with_actions +          = "Modèles de calendrier" +          div +            = link_to '', calendars_path, class: ' fa fa-chevron-right pull-right' +      - if @dashboard.current_organisation.calendars.present? +        .list-group +          - @dashboard.current_organisation.calendars.order("updated_at desc").limit(5).each do |calendar| +            = link_to calendar.name, calendar_path(calendar), class: 'list-group-item' +      - else +        .panel-body +          em.small.text-muted Aucun modèle de calendrier défini +    .col-lg-6.col-md-6.col-sm-6.col-xs-12      .panel.panel-default        .panel-heading 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..1c4a5a765 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 @@ -38,7 +31,7 @@                  ), \                  TableBuilderHelper::Column.new( \                    name: 'Résultat des tests' , \ -                  attribute: Proc.new { |n| I18n.t('import_resources.index.metrics', import_resoruce_metrics(n.metrics) }, \ +                  attribute: Proc.new { |n| I18n.t('import_resources.index.metrics', n.metrics.deep_symbolize_keys) }, \                    sortable: false, \                  ), \                  TableBuilderHelper::Column.new( \ 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..834501da3 100644 --- a/app/views/journey_patterns_collections/show.html.slim +++ b/app/views/journey_patterns_collections/show.html.slim @@ -1,9 +1,7 @@  - 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 +- content_for :page_header_title, t('journey_patterns.index.title', route: @route.name), flush: true +  - @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..90fd7d855 --- /dev/null +++ b/app/views/layouts/navigation/_page_header.html.slim @@ -0,0 +1,23 @@ +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 +          - else +            - if 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-action +          - if content_for? :page_header_meta +            = yield :page_header_meta +          - if content_for? :page_header_actions +            = 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/_filters.html.slim b/app/views/lines/_filters.html.slim index 58f8f2431..e3674656a 100644 --- a/app/views/lines/_filters.html.slim +++ b/app/views/lines/_filters.html.slim @@ -8,11 +8,11 @@    .ffg-row      .form-group.togglable -      = f.label Chouette::Line.human_attribute_name(:network), required: false, class: 'control-label' +      = f.label Chouette::Line.human_attribute_name(:network_id), required: false, class: 'control-label'        = f.input :network_id_eq_any, collection: @line_referential.networks.order(name: :asc), as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + l.name + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'}      .form-group.togglable -      = f.label Chouette::Line.human_attribute_name(:company), required: false, class: 'control-label' +      = f.label Chouette::Line.human_attribute_name(:company_id), required: false, class: 'control-label'        = f.input :company_id_eq_any, collection: @line_referential.companies.order(name: :asc), as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + l.name + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'}      .form-group.togglable diff --git a/app/views/lines/_form.html.slim b/app/views/lines/_form.html.slim index d7b5a65ed..4952b72ff 100644 --- a/app/views/lines/_form.html.slim +++ b/app/views/lines/_form.html.slim @@ -1,45 +1,22 @@ -= semantic_form_for [@line_referential, @line] do |form| -  = form.inputs do -   / = form.input :network, as: :select, :collection => Chouette::Network.all, include_blank: false -    / = form.input :company, as: :select, :collection => Chouette::Company.all, include_blank: false -    / = form.input :name, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.line.name") } -    / = form.input :published_name -    / = form.input :registration_number, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.line.registration_number")} -    / = form.input :number, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.line.number") } -    / = form.input :transport_mode, include_blank: false -    / = form.input :color, as: :string -    / = form.input :text_color -    / = form.input :stable_id -    / = form.input :url -    / = form.input :mobility_restricted_suitability, as: :select, :collection => [[@line.human_attribute_name("accessible"), true], [@line.human_attribute_name("not_accessible"), false]], :include_blank => true -    / = form.input :flexible_service, as: :select, :collection => [[@line.human_attribute_name("on_demaond_fs"), true], [@line.human_attribute_name("regular_fs"), false]], :include_blank => true -    / = form.input :comment -    / = form.input :objectid, :required => !@line.new_record?, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.line.objectid")} -    / = form.input :group_of_line_tokens, :label => t('.group_of_lines'), as: :text,  :input_html => { :"data-pre" => ( @line.group_of_lines.map { |group_of_line| { :id => group_of_line.id, :name => group_of_line.name } } ).to_json } += simple_form_for [@line_referential, @line], html: {class: 'form-horizontal', id: 'lines_form'}, wrapper: :horizontal_form do |f| +  .row +    .col-lg-12 +      = f.input :name +      = f.input :network_id, as: :select, :collection => @line_referential.networks, include_blank: false +      = f.input :company_id, as: :select, :collection => @line_referential.companies, include_blank: false +      = f.input :published_name +      = f.input :registration_number +      = f.input :number +      = f.input :transport_mode, as: :select, collection: Chouette::Line.sorted_transport_modes, label: t('activerecord.attributes.compliance_control_blocks.transport_mode'), label_method: lambda {|t| ("<span>" + t("enumerize.transport_mode.#{t}") + "</span>").html_safe}, required: true, :include_blank => false +      = f.input :transport_submode, as: :select, collection: Chouette::Line.sorted_transport_submodes, label: t('activerecord.attributes.compliance_control_blocks.transport_submode'), label_method: lambda {|t| ("<span>" + t("enumerize.transport_submode.#{t}") + "</span>").html_safe}, :include_blank => true +      = f.input :color, as: :string +      = f.input :text_color +      = f.input :stable_id +      = f.input :url +      = f.input :mobility_restricted_suitability, as: :select, :collection => [[@line.human_attribute_name("accessible"), true], [@line.human_attribute_name("not_accessible"), false]], :include_blank => true +      = f.input :flexible_service, as: :select, :collection => [[@line.human_attribute_name("on_demaond_fs"), true], [@line.human_attribute_name("regular_fs"), false]], :include_blank => true +      = f.input :comment +  .separator -    .footnotes_block -      h3 = t("footnotes.index.title") +  = f.button :submit, t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'lines_form' -      #footnotes -        = form.semantic_fields_for :footnotes do |f| -          = render "footnotes/footnote_fields",  :f => f - -      .add_footnote -        = link_to_add_association t("footnotes.actions.add_footnote"), form, :footnotes , :partial => "footnotes/footnote_fields", :"data-association-insertion-method" => "append", :"data-association-insertion-node" => "div#footnotes", class: 'add' - -  = form.actions do -    = form.action :submit, as: :button -    = form.action :cancel, as: :link - -javascript: -  $(function() { -    $("#line_group_of_line_tokens").tokenInput("#{name_filter_referential_group_of_lines_path(@line_referential, format: :json)}", { -      crossDomain: false, -      prePopulate: $('#group_of_line_tokens').data('pre'), -      minChars: 3, -      preventDuplicates: true, -      hintText: "#{I18n.t('search_hint')}", -      noResultsText: "#{I18n.t('no_result_text')}", -      searchingText: "#{I18n.t('searching_term')}" -    }); -  }); diff --git a/app/views/lines/edit.html.slim b/app/views/lines/edit.html.slim index 3c2eee03f..efe674ba4 100644 --- a/app/views/lines/edit.html.slim +++ b/app/views/lines/edit.html.slim @@ -1,5 +1,8 @@  - breadcrumb :line, @line +- page_header_content_for @line -= title_tag t('lines.edit.title', line: @line.name) - -= render 'form' +.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' diff --git a/app/views/lines/index.html.slim b/app/views/lines/index.html.slim index 911c95e0c..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? && @line_referential.organisations.include?(current_organisation)) ? 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 f09a4b4aa..6eecf1e7d 100644 --- a/app/views/lines/new.html.slim +++ b/app/views/lines/new.html.slim @@ -1,5 +1,6 @@  - breadcrumb :lines, @line_referential - -= title_tag t('lines.new.title') - -= render 'form' +.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' diff --git a/app/views/lines/show.html.slim b/app/views/lines/show.html.slim index ccf237154..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 @@ -23,8 +18,8 @@          = definition_list t('metadatas'),            {  'ID Codif' => @line.get_objectid.short_id,               'Activé' => (@line.deactivated? ? t('false') : t('true')), -             @line.human_attribute_name(:network) => (@line.network.nil? ? t('lines.index.unset') : @line.network.name), -             @line.human_attribute_name(:company) => (@line.company.nil? ? t('lines.index.unset') : @line.company.name), +             @line.human_attribute_name(:network_id) => (@line.network.nil? ? t('lines.index.unset') : @line.network.name), +             @line.human_attribute_name(:company_id) => (@line.company.nil? ? t('lines.index.unset') : @line.company.name),               'Transporteur(s) secondaire(s)' => (@line.secondary_companies.nil? ? t('lines.index.unset') : @line.secondary_companies.collect(&:name).join(', ')),               'Nom court' => @line.number,               'Code public' => (@line.registration_number ? @line.registration_number : '-'), diff --git a/app/views/networks/_form.html.slim b/app/views/networks/_form.html.slim index 7b048edc9..362584f97 100644 --- a/app/views/networks/_form.html.slim +++ b/app/views/networks/_form.html.slim @@ -1,15 +1,14 @@ -= semantic_form_for [@line_referential, @network] do |form| -  = form.inputs do -    = form.input :name, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.network.name")} -    = form.input :registration_number, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.network.registration_number")} -    = form.input :comment -    = form.input :version_date, as: :date_picker -    = form.input :description -    = form.input :source_name -    = form.input :source_type_name, as: :select, :collection => source_type_name_label_pairs, :include_blank => true -    = form.input :source_identifier -    = form.input :objectid, :required => !@network.new_record?, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.network.objectid")} += simple_form_for [@line_referential, @network], html: {class: 'form-horizontal', id: 'network_form'}, wrapper: :horizontal_form do |f| +  .row +    .col-lg-12 +      = f.input :name, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.network.name")} +      = f.input :registration_number, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.network.registration_number")} +      = f.input :comment +      = f.input :version_date, :label_html => { :class => 'string optional col-sm-4 col-xs-5 control-label' }, :wrapper => :multi_select_inline +      = f.input :description +      = f.input :source_name +      = f.input :source_type_name, as: :select, :collection => Chouette::Network.source_type_name.options, :include_blank => true +      = f.input :source_identifier +  .separator -  = form.actions do -    = form.action :submit, as: :button -    = form.action :cancel, as: :link +    = f.button :submit, t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'network_form' diff --git a/app/views/networks/edit.html.slim b/app/views/networks/edit.html.slim index 2d511e15d..64513d250 100644 --- a/app/views/networks/edit.html.slim +++ b/app/views/networks/edit.html.slim @@ -1,4 +1,7 @@  - breadcrumb :network, @network -= title_tag t('networks.edit.title', network: @network.name) - -= render 'form' +- 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'
\ No newline at end of file diff --git a/app/views/networks/index.html.slim b/app/views/networks/index.html.slim index 6004f5859..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? @@ -27,7 +23,7 @@              [ \                TableBuilderHelper::Column.new( \                  name: 'Oid', \ -                attribute: Proc.new { |n| n.get_objectid.try(:short_id) }, \ +                attribute: Proc.new { |n| n.try(:get_objectid).try(:short_id) }, \                  sortable: false \                ),                TableBuilderHelper::Column.new( \ diff --git a/app/views/networks/new.html.slim b/app/views/networks/new.html.slim index cf04ab03f..590d2b409 100644 --- a/app/views/networks/new.html.slim +++ b/app/views/networks/new.html.slim @@ -1,4 +1,6 @@  - breadcrumb :networks, @line_referential -= title_tag t('networks.new.title') - -= render 'form' +.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 diff --git a/app/views/networks/show.html.slim b/app/views/networks/show.html.slim index 89aa1e50a..f7d40a049 100644 --- a/app/views/networks/show.html.slim +++ b/app/views/networks/show.html.slim @@ -1,11 +1,6 @@  - breadcrumb :network, @network -/ PageHeader -= pageheader 'reseau', -             @network.name, -             '', -             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| @@ -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..cfba8cab3 100644 --- a/app/views/referential_lines/show.html.slim +++ b/app/views/referential_lines/show.html.slim @@ -1,11 +1,5 @@  - 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 - -  / 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| @@ -14,8 +8,8 @@              data: link.data,              class: 'btn btn-primary' do                = link.content +- page_header_content_for @line -/ 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/_form.html.slim b/app/views/stop_areas/_form.html.slim index 546143393..20c7c0468 100644 --- a/app/views/stop_areas/_form.html.slim +++ b/app/views/stop_areas/_form.html.slim @@ -1,153 +1,45 @@ -= semantic_form_for [@stop_area_referential, @stop_area] do |form| += simple_form_for [@stop_area_referential, @stop_area], html: {class: 'form-horizontal', id: 'stop_area_form'}, wrapper: :horizontal_form do |f|    .row -    .container-fluid -      - if !manage_itl && @map -        = @map.to_html - -      = form.inputs do -        = form.input :id, as: :hidden -        = form.input :name, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.name")} -        = form.input :stop_area_type, as: :select, :input_html => { :disabled => !@stop_area.new_record? }, :collection => Chouette::StopArea.area_type.options, :include_blank => false +    .col-lg-12 +      /- if !manage_itl && @map +      - if !manage_itl +        /= @map.to_html +        = f.input :id, as: :hidden +        = f.input :name, :input_html => {:title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.name")} +        = f.input :area_type, as: :select, :input_html => {:disabled => !@stop_area.new_record?}, :collection => Chouette::StopArea.area_type.options, :include_blank => false          .location_info            h3 = t("stop_areas.stop_area.localisation") -          #prefetch              label = t('.geolocalize')              input.typeahead.form-control.input-lg maxlength="255" type="text" placeholder="#{t('.address')}"            - unless @stop_area.projection.blank? or @stop_area.projection_type_label.empty? -            = form.input :projection_xy, :label => t("activerecord.attributes.stop_area.projection_xy", :projection => @referential.projection_type_label), :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.projection_xy")} - -          = form.input :coordinates, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.coordinates")} -          = form.input :street_name -          = form.input :country_code, required: format_restriction_for_locales(@referential) == '.hub' -          = form.input :zip_code, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.zip_code")} -          = form.input :city_name, required: format_restriction_for_locales(@referential) == '.hub', :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.city_name")} - -  .stop_areas.stop_area.general_info -    h3 = t("stop_areas.stop_area.general") - -    = form.inputs do -      = form.input :objectid, :required => !@stop_area.new_record?, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.objectid")} -      = form.input :registration_number, required: format_restriction_for_locales(@referential) == '.hub', :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.registration_number")} -      = form.input :fare_code, as: :number -      = form.input :nearest_topic_name, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.nearest_topic_name")} -      = form.input :comment, as: :text, :input_html => { :rows => 5,  :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.comment") } -      = form.input :time_zone,  :include_blank => true -      = form.input :url - -  .pmr_info -    h3 = t("stop_areas.stop_area.accessibility") -    = form.inputs do -      - if !manage_itl -  	    = form.input :mobility_restricted_suitability, as: :select, :collection => [[t("true"), true], [t("false"), false]], :include_blank => true -  	    = form.input :stairs_availability, as: :select, :collection => [[t("true"), true], [t("false"), false]], :include_blank => true -  	    = form.input :lift_availability, as: :select, :collection => [[t("true"), true], [t("false"), false]], :include_blank => true - -  = form.actions do -    = form.action :submit, as: :button -    = form.action :cancel, as: :link - -javascript: -  $(document).ready(function() { -    var address_display = function( address ) { -      var name = ""; -      if ( address.house_number) { -        name += address.house_number+" "; -      } -      name += address.road+", "; -      if ( address.suburb) { -        name += address.suburb+", "; -      } -      if ( address.postcode) { -        name += address.postcode+" "; -      } -      if ( address.city) { -        name += address.city; -      } else if ( address.village) { -        name += address.village; -      } else if ( address.town) { -        name += address.town; -      } else if ( address.county ) { -        name += address.county; -      } else if ( address.country ) { -        name += address.country; -      } - - -      return name; -    }; -    var filtering = function(list) { -      // update map view -      removeAddress(); - -      var selection = $.grep( list, function(item) { -          return (item.type == "house" || item.type == "residential" || -            item.type == "tertiary" || item.type == "primary" || -            item.type == "secondary") && item.address.road ; -          }); -      return $.map( selection, function( d) { -          var city = ""; -          if ( d.address.city) { -            city = d.address.city; -          } else if ( d.address.town) { -            city = d.address.town; -          } else if ( d.address.village) { -            city = d.address.village; -          } -          return { postcode: d.address.postcode, -                   road: d.address.road, -                   lon: d.lon, lat: d.lat, -                   suburb: d.address.suburb, -                   city: city, -                   postcode: d.address.postcode, -                   the_key: address_display( d.address)}; -      }); -    }; - -    var addressesEngine = new Bloodhound({ -      datumTokenizer: function(d) { -        return Bloodhound.tokenizers.whitespace(d.id+" : "+d.road); -      }, -      queryTokenizer: function(d) { -        return Bloodhound.tokenizers.whitespace(d.id+" :: "+d.road); -      }, -      limit: 10, -      remote: { -          url: 'http://nominatim.openstreetmap.org/search?q=%QUERY&format=json&addressdetails=1&bounded=1&viewbox='+ -          // FIXME #821 -          //= @stop_area_referential.viewbox_left_top_right_bottom -        filter: filtering, -      } -    }); - -    // kicks off the loading/processing of `local` and `prefetch` -    var promise = addressesEngine.initialize(); - -    // passing in `null` for the `options` arguments will result in the default -    // options being used -    $('#prefetch .typeahead').typeahead( -      { -        hint: true, -        highlight: true, -        minLength: 1 -      }, -      { -        name: 'addresses', -        displayKey: 'the_key', -        source: addressesEngine.ttAdapter(), -      } -    ); - -    $('.typeahead').on('typeahead:selected', function($e, datum) { -      // update map view -      addAddress( datum.lon, datum.lat, datum.road); -      // update form fields -      <% if @stop_area.new_record? %> -      $('input[name="stop_area[street_name]"]').val(datum.road); -      $('input[name="stop_area[zip_code]"]').val(datum.postcode); -      $('input[name="stop_area[city_name]"]').val(datum.city); -      <% end %> -    }) -  }); +            = f.input :projection_xy, :label => t("activerecord.attributes.stop_area.projection_xy", :projection => @referential.projection_type_label), :input_html => {:title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.projection_xy")} + +          = f.input :coordinates, :input_html => {:title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.coordinates")}, required: true +          = f.input :street_name +          /= f.input :country_code, required: format_restriction_for_locales(@referential) == '.hub' +          = f.input :zip_code, :input_html => {:title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.zip_code")} +          = f.input :city_name, required: format_restriction_for_locales(@referential) == '.hub', :input_html => {:title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.city_name")} + +        .stop_areas.stop_area.general_info +          h3 = t("stop_areas.stop_area.general") + +          = f.input :registration_number, required: format_restriction_for_locales(@referential) == '.hub', :input_html => {:title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.registration_number")} +          = f.input :fare_code +          = f.input :nearest_topic_name, :input_html => {:title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.nearest_topic_name")} +          = f.input :comment, as: :text, :input_html => {:rows => 5, :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.comment")} +          = f.input :time_zone, :include_blank => true +          = f.input :url + +        .pmr_info +          h3 = t("stop_areas.stop_area.accessibility") +          - if !manage_itl +            = f.input :mobility_restricted_suitability, as: :select, :collection => [[t("true"), true], [t("false"), false]], :include_blank => true +            = f.input :stairs_availability, as: :select, :collection => [[t("true"), true], [t("false"), false]], :include_blank => true +            = f.input :lift_availability, as: :select, :collection => [[t("true"), true], [t("false"), false]], :include_blank => true + +  .separator + +  = f.button :submit, t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'stop_area_form' diff --git a/app/views/stop_areas/edit.html.slim b/app/views/stop_areas/edit.html.slim index 8005f5a08..4f2b3f4de 100644 --- a/app/views/stop_areas/edit.html.slim +++ b/app/views/stop_areas/edit.html.slim @@ -1,4 +1,8 @@  - breadcrumb :stop_area, @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' +.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' diff --git a/app/views/stop_areas/index.html.slim b/app/views/stop_areas/index.html.slim index 1b28f411e..c4d880081 100644 --- a/app/views/stop_areas/index.html.slim +++ b/app/views/stop_areas/index.html.slim @@ -1,18 +1,14 @@  - 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?        .row          .col-lg-12 -            = render 'filters' +          = render 'filters'      - if @stop_areas.any?        .row diff --git a/app/views/stop_areas/new.html.slim b/app/views/stop_areas/new.html.slim index e0c5b7a61..69d78c533 100644 --- a/app/views/stop_areas/new.html.slim +++ b/app/views/stop_areas/new.html.slim @@ -1,4 +1,7 @@  - breadcrumb :stop_areas, @stop_area_referential -= title_tag t('stop_areas.new.title') -== render 'form' +.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' 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..7d2551311 100644 --- a/app/views/time_table_combinations/new.html.slim +++ b/app/views/time_table_combinations/new.html.slim @@ -1,10 +1,3 @@ -/ 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..e1c566ff4 100644 --- a/app/views/time_tables/edit.html.slim +++ b/app/views/time_tables/edit.html.slim @@ -1,11 +1,7 @@  - breadcrumb :time_table, @referential, @time_table -/ PageHeader -= pageheader 'calendrier-application', -             @time_table.comment, -             '', -             '' +- page_header_content_for @time_table +- content_for :page_header_title, t('time_tables.show.title', name: @time_table.comment), flush: true -/ 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..036581268 100644 --- a/app/views/time_tables/show.html.slim +++ b/app/views/time_tables/show.html.slim @@ -1,14 +1,14 @@  - 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_title, t('time_tables.show.title', name: @time_table.comment), flush: true -  / Below is secundary actions & optional contents (filters, ...) +- 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') + +- content_for :page_header_content do    .row.mb-sm      .col-lg-12.text-right        - @time_table.action_links.each do |link| @@ -18,7 +18,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..52c1a9728 100644 --- a/app/views/vehicle_journeys/index.html.slim +++ b/app/views/vehicle_journeys/index.html.slim @@ -1,11 +1,6 @@  - breadcrumb :vehicle_journeys, @referential, @route -/ PageHeader -= pageheader 'horaires-des-courses', -             t('vehicle_journeys.index.title', route: @route.name ), -             'Lorem ipsum dolor sit amet', -             '' do +- content_for :page_header_title, t('vehicle_journeys.index.title', route: @route.name) -/ 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? | 
