diff options
| author | Xinhui Xu | 2017-11-30 11:09:36 +0100 |
|---|---|---|
| committer | GitHub | 2017-11-30 11:09:36 +0100 |
| commit | a7930abe5a70b8b964af0dcbf86fe0a587ea98cb (patch) | |
| tree | dc8e1a1ff57ff0328e4b8b2ac72932f82e379406 | |
| parent | fb7ad0e23e73954e6e5d172d61edb31cd686b8b4 (diff) | |
| parent | 7b019504fd792293f1112b2375228505fab303fe (diff) | |
| download | chouette-core-a7930abe5a70b8b964af0dcbf86fe0a587ea98cb.tar.bz2 | |
Merge branch 'master' into 4981_last_editor
47 files changed, 374 insertions, 351 deletions
diff --git a/app/controllers/compliance_check_sets_controller.rb b/app/controllers/compliance_check_sets_controller.rb index eda17a1c6..03b920030 100644 --- a/app/controllers/compliance_check_sets_controller.rb +++ b/app/controllers/compliance_check_sets_controller.rb @@ -19,6 +19,14 @@ class ComplianceCheckSetsController < ChouetteController 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| # But now nobody is aware anymore that `format.html` passes a parameter into the block diff --git a/app/controllers/networks_controller.rb b/app/controllers/networks_controller.rb index 81f9ab6ce..494d1e69f 100644 --- a/app/controllers/networks_controller.rb +++ b/app/controllers/networks_controller.rb @@ -22,10 +22,12 @@ class NetworksController < ChouetteController def new authorize resource_class + new! end def create authorize resource_class + create! end def index diff --git a/app/controllers/stop_areas_controller.rb b/app/controllers/stop_areas_controller.rb index 63e2cd97a..133518324 100644 --- a/app/controllers/stop_areas_controller.rb +++ b/app/controllers/stop_areas_controller.rb @@ -64,22 +64,22 @@ class StopAreasController < ChouetteController 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 { 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/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/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/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/chouette/line.rb b/app/models/chouette/line.rb index 16d7ec6f6..784e3f5b9 100644 --- a/app/models/chouette/line.rb +++ b/app/models/chouette/line.rb @@ -4,8 +4,8 @@ module Chouette 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 diff --git a/app/models/chouette/network.rb b/app/models/chouette/network.rb index d64ef038a..9b3f2fe29 100644 --- a/app/models/chouette/network.rb +++ b/app/models/chouette/network.rb @@ -4,12 +4,23 @@ module Chouette 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 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/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/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/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 d2bb26e77..faa88f829 100644 --- a/app/views/companies/edit.html.slim +++ b/app/views/companies/edit.html.slim @@ -1,3 +1,3 @@ - breadcrumb :company, @company - page_header_content_for @company -= render 'form' += render 'form'
\ No newline at end of file diff --git a/app/views/companies/new.html.slim b/app/views/companies/new.html.slim index bcc583279..cc085ffe2 100644 --- a/app/views/companies/new.html.slim +++ b/app/views/companies/new.html.slim @@ -1 +1,6 @@ -= 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 f8b939ba0..0d6b4aae3 100644 --- a/app/views/companies/show.html.slim +++ b/app/views/companies/show.html.slim @@ -19,7 +19,7 @@ .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/index.html.slim b/app/views/compliance_check_sets/index.html.slim index b02b1c89f..f5d1bd777 100644 --- a/app/views/compliance_check_sets/index.html.slim +++ b/app/views/compliance_check_sets/index.html.slim @@ -12,7 +12,7 @@ [ \ TableBuilderHelper::Column.new( \ key: :ref, \ - attribute: 'referential_id' \ + attribute: 'compliance_check_set_id' \ ), \ TableBuilderHelper::Column.new( \ key: :creation_date, \ @@ -21,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/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 8b1612205..efe674ba4 100644 --- a/app/views/lines/edit.html.slim +++ b/app/views/lines/edit.html.slim @@ -1,4 +1,8 @@ - breadcrumb :line, @line - page_header_content_for @line -= 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/new.html.slim b/app/views/lines/new.html.slim index 3a322db54..6eecf1e7d 100644 --- a/app/views/lines/new.html.slim +++ b/app/views/lines/new.html.slim @@ -1,2 +1,6 @@ - breadcrumb :lines, @line_referential -= 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 7c48bd063..4969ca3cd 100644 --- a/app/views/lines/show.html.slim +++ b/app/views/lines/show.html.slim @@ -18,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 0a396361f..64513d250 100644 --- a/app/views/networks/edit.html.slim +++ b/app/views/networks/edit.html.slim @@ -1,3 +1,7 @@ - breadcrumb :network, @network - page_header_content_for @network -= 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/index.html.slim b/app/views/networks/index.html.slim index 3a804bad0..b13c73e9e 100644 --- a/app/views/networks/index.html.slim +++ b/app/views/networks/index.html.slim @@ -23,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 de5dd9121..590d2b409 100644 --- a/app/views/networks/new.html.slim +++ b/app/views/networks/new.html.slim @@ -1,2 +1,6 @@ - breadcrumb :networks, @line_referential -= 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/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 e5d864d93..4f2b3f4de 100644 --- a/app/views/stop_areas/edit.html.slim +++ b/app/views/stop_areas/edit.html.slim @@ -1,3 +1,8 @@ - breadcrumb :stop_area, @stop_area_referential, @stop_area - 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 1942756cf..c4d880081 100644 --- a/app/views/stop_areas/index.html.slim +++ b/app/views/stop_areas/index.html.slim @@ -8,7 +8,7 @@ - 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 78aa98585..69d78c533 100644 --- a/app/views/stop_areas/new.html.slim +++ b/app/views/stop_areas/new.html.slim @@ -1,2 +1,7 @@ - breadcrumb :stop_areas, @stop_area_referential -== 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/config/initializers/simple_form_bootstrap.rb b/config/initializers/simple_form_bootstrap.rb index d90ea6398..4b9bd320d 100644 --- a/config/initializers/simple_form_bootstrap.rb +++ b/config/initializers/simple_form_bootstrap.rb @@ -132,6 +132,17 @@ SimpleForm.setup do |config| ba.use :hint, wrap_with: { tag: 'p', class: 'help-block small' } end end + + config.wrappers :multi_select_inline, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| + b.use :html5 + b.optional :readonly + b.use :label, class: 'control-label' + b.wrapper tag: 'div', class: 'form-inline col-sm-8 col-xs-7' do |ba| + ba.use :input, class: 'form-control' + ba.use :error, wrap_with: {tag: 'span', class: 'help-block small'} + ba.use :hint, wrap_with: {tag: 'p', class: 'help-block small'} + end + end # Wrappers for forms and inputs using the Bootstrap toolkit. # Check the Bootstrap docs (http://getbootstrap.com) # to learn about the different styles for forms and inputs, diff --git a/config/locales/compliance_check_sets.en.yml b/config/locales/compliance_check_sets.en.yml index 5aa6f9740..e6bec2b55 100644 --- a/config/locales/compliance_check_sets.en.yml +++ b/config/locales/compliance_check_sets.en.yml @@ -17,6 +17,10 @@ en: search_no_results: No control reports match your search executed: title: Executed control report %{name} + show: + table_state: "%{lines_status} lines imported on %{lines_in_compliance_check_set} in the archive" + table_explanation: "These controls apply to all imported data and condition the construction of your organization's offer." + metrics: "%{ok_count} ok, %{error_count} errors, %{warning_count} warnings, %{uncheck_count} n/a" activerecord: attributes: compliance_check_set: @@ -26,6 +30,11 @@ en: assigned_to: Assigned to compliance_control_set: Compliance control set name: Name + compliance_check_resources: + name: Name of the line + status: Status + metrics: Test results + download: Download models: compliance_check_block: one: compliance_control_set diff --git a/config/locales/compliance_check_sets.fr.yml b/config/locales/compliance_check_sets.fr.yml index 8ad5af904..b526261a9 100644 --- a/config/locales/compliance_check_sets.fr.yml +++ b/config/locales/compliance_check_sets.fr.yml @@ -13,6 +13,10 @@ fr: search_no_results: Aucun rapport de contrôle ne correspond à votre recherche executed: title: Jeu de contrôles exécutés %{name} + show: + table_state: "%{lines_status} lignes importées sur %{lines_in_compliance_check_set} présentes dans l'archive" + table_explanation: Ces contrôles s’appliquent pour toutes les données importées et conditionnent la construction de l’offre de votre organisation + metrics: "%{ok_count} ok, %{error_count} errors, %{warning_count} warnings, %{uncheck_count} n/a" activerecord: attributes: compliance_check_set: @@ -22,6 +26,11 @@ fr: assigned_to: Affectation compliance_control_set: jeu de contrôle name: Nom + compliance_check_resource: + name: Nom de la ligne + status: État + metrics: Résultat des tests + download: Télécharger models: compliance_check_block: zero: "Groupe de contrôle" diff --git a/config/locales/enumerize.en.yml b/config/locales/enumerize.en.yml index f5e51171b..bfd7b8c22 100644 --- a/config/locales/enumerize.en.yml +++ b/config/locales/enumerize.en.yml @@ -244,3 +244,15 @@ en: streetCableCar: 'Street cable car' allFunicularServices: 'All funicular services' undefinedFunicular: 'Undefined funicular' + source_type_name: + name: "Source types" + public_and_private_utilities: "Public and private utilities" + road_authorities: "Road authorities" + transit_operator: "Transit operator" + public_transport: "Public transport" + passenger_transport_coordinating_authority: "Passenger transport coordinating authority" + travel_information_service_provider: "Travel information service provider" + travel_agency: "Travel_agency" + individual_subject_of_travel_itinerary: "Individual subject of travel itinerary" + other_information: "Other information" + diff --git a/config/locales/enumerize.fr.yml b/config/locales/enumerize.fr.yml index a5845971b..b2eab665d 100644 --- a/config/locales/enumerize.fr.yml +++ b/config/locales/enumerize.fr.yml @@ -242,3 +242,14 @@ fr: streetCableCar: 'Tramway (2)' allFunicularServices: 'Tous services de funiculaire' undefinedFunicular: 'Funiculaire non défini' + source_type_name: + name: "Type de source" + public_and_private_utilities: "Service public ou privé" + road_authorities: "Autorité routière" + transit_operator: "Exploitant de transport public" + public_transport: "Transport public" + passenger_transport_coordinating_authority: "Autorité organisatrice de transport public" + travel_information_service_provider: "Opérateur de voyage (voyagiste/tour operator ...)" + travel_agency: "Agence de voyage" + individual_subject_of_travel_itinerary: "Voyageur individuel" + other_information: "Autre source d'information" diff --git a/config/locales/lines.en.yml b/config/locales/lines.en.yml index cbca6baab..a69c3b0ba 100644 --- a/config/locales/lines.en.yml +++ b/config/locales/lines.en.yml @@ -62,10 +62,10 @@ en: attributes: line: id: "ID" - network: "Network" + network_id: "Network" networks: name: "Network" - company: "Company" + company_id: "Company" companies: name: "Company" registration_number: "Registration number" diff --git a/config/locales/lines.fr.yml b/config/locales/lines.fr.yml index fa23f8369..160cc4ab4 100644 --- a/config/locales/lines.fr.yml +++ b/config/locales/lines.fr.yml @@ -63,10 +63,10 @@ fr: attributes: line: id: "ID" - network: "Réseau" + network_id: "Réseau" networks: name: "Réseau" - company: "Transporteur principal" + company_id: "Transporteur principal" companies: name: "Transporteur principal" registration_number: "Nom court" diff --git a/config/locales/source_types.en.yml b/config/locales/source_types.en.yml deleted file mode 100644 index 1cea5ed2c..000000000 --- a/config/locales/source_types.en.yml +++ /dev/null @@ -1,13 +0,0 @@ -en: - source_types: - name: "Source type" - label: - public_and_private_utilities: "public and private utilities" - road_authorities: "road authorities" - transit_operator: "transit operator" - public_transport: "public transport" - passenger_transport_coordinating_authority: "passenger transport coordinating authority" - travel_information_service_provider: "travel information service provider" - travel_agency: "travel_agency" - individual_subject_of_travel_itinerary: "individual subject of travel itinerary" - other_information: "other information" diff --git a/config/locales/source_types.fr.yml b/config/locales/source_types.fr.yml deleted file mode 100644 index 6979a14b7..000000000 --- a/config/locales/source_types.fr.yml +++ /dev/null @@ -1,13 +0,0 @@ -fr: - source_types: - name: "Type de source" - label: - public_and_private_utilities: "Service public ou privé" - road_authorities: "Autorité routière" - transit_operator: "Exploitant de transport public" - public_transport: "Transport public" - passenger_transport_coordinating_authority: "Autorité organisatrice de transport public" - travel_information_service_provider: "Opérateur de voyage (voyagiste/tour operator ...)" - travel_agency: "Agence de voyage" - individual_subject_of_travel_itinerary: "Voyageur individuel" - other_information: "Autre source d'information" diff --git a/db/seeds.rb b/db/seeds.rb new file mode 100644 index 000000000..b7db25411 --- /dev/null +++ b/db/seeds.rb @@ -0,0 +1 @@ +# Empty diff --git a/db/seeds/chouette.seeds.rb b/db/seeds/chouette.seeds.rb deleted file mode 100644 index 1cbdb584d..000000000 --- a/db/seeds/chouette.seeds.rb +++ /dev/null @@ -1,6 +0,0 @@ -path = File.join(File.expand_path('../seeds', __FILE__), "*.rb") - -Dir.glob(path).sort.each do |file| - puts "Seed #{file}" - load file -end diff --git a/db/seeds/stif.rb b/db/seeds/stif.rb deleted file mode 100644 index d31a35cfc..000000000 --- a/db/seeds/stif.rb +++ /dev/null @@ -1,38 +0,0 @@ -# coding: utf-8 -# This file should contain all the record creation needed to seed the database with its default values. -# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). - -stop_area_referential = StopAreaReferential.find_or_create_by!(name: "Reflex") -line_referential = LineReferential.find_or_create_by!(name: "CodifLigne") - -# Organisations -stif = Organisation.find_or_create_by!(code: "STIF") do |org| - org.name = 'STIF' -end -operator = Organisation.find_or_create_by!(code: 'transporteur-a') do |organisation| - organisation.name = "Transporteur A" -end - -# Member -line_referential.add_member stif, owner: true -line_referential.add_member operator - -stop_area_referential.add_member stif, owner: true -stop_area_referential.add_member operator - -# Users -stif.users.find_or_create_by!(username: "admin") do |user| - user.email = 'stif-boiv@af83.com' - user.password = "secret" - user.name = "STIF Administrateur" -end - -operator.users.find_or_create_by!(username: "transporteur") do |user| - user.email = 'stif-boiv+transporteur@af83.com' - user.password = "secret" - user.name = "Martin Lejeune" -end - -# Include all Lines in organisation functional_scope -stif.update sso_attributes: { functional_scope: line_referential.lines.pluck(:objectid) } -operator.update sso_attributes: { functional_scope: line_referential.lines.limit(3).pluck(:objectid) } diff --git a/spec/policies/company_policy_spec.rb b/spec/policies/company_policy_spec.rb index 2d249a2be..e018902ca 100644 --- a/spec/policies/company_policy_spec.rb +++ b/spec/policies/company_policy_spec.rb @@ -1,3 +1,4 @@ +# coding: utf-8 RSpec.describe CompanyPolicy, type: :policy do let( :record ){ build_stubbed :company } @@ -24,19 +25,19 @@ RSpec.describe CompanyPolicy, type: :policy do context 'Destructive actions →' do permissions :create? do - it_behaves_like 'always forbidden', 'companies.create', archived: true + it_behaves_like 'permitted policy', 'companies.create' end permissions :destroy? do - it_behaves_like 'always forbidden', 'companies.destroy', archived: true + it_behaves_like 'permitted policy', 'companies.destroy' end permissions :edit? do - it_behaves_like 'always forbidden', 'companies.update', archived: true + it_behaves_like 'permitted policy', 'companies.update' end permissions :new? do - it_behaves_like 'always forbidden', 'companies.create', archived: true + it_behaves_like 'permitted policy', 'companies.create' end permissions :update? do - it_behaves_like 'always forbidden', 'companies.update', archived: true + it_behaves_like 'permitted policy', 'companies.update' end end end diff --git a/spec/policies/line_policy_spec.rb b/spec/policies/line_policy_spec.rb index 334073506..452606bcf 100644 --- a/spec/policies/line_policy_spec.rb +++ b/spec/policies/line_policy_spec.rb @@ -1,3 +1,4 @@ +# coding: utf-8 RSpec.describe LinePolicy, type: :policy do let( :record ){ build_stubbed :line } @@ -24,19 +25,19 @@ RSpec.describe LinePolicy, type: :policy do context 'Destructive actions →' do permissions :create? do - it_behaves_like 'always forbidden', 'lines.create', archived: true + it_behaves_like 'permitted policy', 'lines.create' end permissions :destroy? do - it_behaves_like 'always forbidden', 'lines.destroy', archived: true + it_behaves_like 'permitted policy', 'lines.destroy' end permissions :edit? do - it_behaves_like 'always forbidden', 'lines.update', archived: true + it_behaves_like 'permitted policy', 'lines.update' end permissions :new? do - it_behaves_like 'always forbidden', 'lines.create', archived: true + it_behaves_like 'permitted policy', 'lines.create' end permissions :update? do - it_behaves_like 'always forbidden', 'lines.update', archived: true + it_behaves_like 'permitted policy', 'lines.update' end end diff --git a/spec/policies/stop_area_policy_spec.rb b/spec/policies/stop_area_policy_spec.rb index 8fe59c8e3..90835d1d8 100644 --- a/spec/policies/stop_area_policy_spec.rb +++ b/spec/policies/stop_area_policy_spec.rb @@ -1,3 +1,4 @@ +# coding: utf-8 RSpec.describe StopAreaPolicy, type: :policy do let( :record ){ build_stubbed :stop_area } @@ -24,19 +25,19 @@ RSpec.describe StopAreaPolicy, type: :policy do context 'Destructive actions →' do permissions :create? do - it_behaves_like 'always forbidden', 'stop_areas.create', archived: true + it_behaves_like 'permitted policy', 'stop_areas.create' end permissions :destroy? do - it_behaves_like 'always forbidden', 'stop_areas.destroy', archived: true + it_behaves_like 'permitted policy', 'stop_areas.destroy' end permissions :edit? do - it_behaves_like 'always forbidden', 'stop_areas.update', archived: true + it_behaves_like 'permitted policy', 'stop_areas.update' end permissions :new? do - it_behaves_like 'always forbidden', 'stop_areas.create', archived: true + it_behaves_like 'permitted policy', 'stop_areas.create' end permissions :update? do - it_behaves_like 'always forbidden', 'stop_areas.update', archived: true + it_behaves_like 'permitted policy', 'stop_areas.update' end end end |
