diff options
| -rw-r--r-- | app/helpers/application_helper.rb | 2 | ||||
| -rw-r--r-- | app/models/compliance_control_block.rb | 4 | ||||
| -rw-r--r-- | app/policies/referential_policy.rb | 2 | ||||
| -rw-r--r-- | config/breadcrumbs.rb | 4 | ||||
| -rw-r--r-- | config/locales/compliance_control_blocks.en.yml | 2 | ||||
| -rw-r--r-- | config/locales/compliance_control_blocks.fr.yml | 2 | ||||
| -rw-r--r-- | spec/lib/compliance_control_set_cloner_spec.rb | 2 |
7 files changed, 11 insertions, 7 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6b35863f6..124604cd9 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -16,7 +16,7 @@ module ApplicationHelper 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) + t(local, name: object.name || object.id) else t(local) end diff --git a/app/models/compliance_control_block.rb b/app/models/compliance_control_block.rb index cfcdfd1a6..e27f85ae0 100644 --- a/app/models/compliance_control_block.rb +++ b/app/models/compliance_control_block.rb @@ -12,4 +12,8 @@ class ComplianceControlBlock < ActiveRecord::Base validates :transport_mode, presence: true validates :compliance_control_set, presence: true + def name + ApplicationController.helpers.transport_mode_text(self) + end + end diff --git a/app/policies/referential_policy.rb b/app/policies/referential_policy.rb index bc8a3e24b..253917509 100644 --- a/app/policies/referential_policy.rb +++ b/app/policies/referential_policy.rb @@ -22,7 +22,7 @@ class ReferentialPolicy < ApplicationPolicy end def validate? - !archived? && create? + !archived? && create? && organisation_match? end def archive? diff --git a/config/breadcrumbs.rb b/config/breadcrumbs.rb index 970f933f0..eb285b731 100644 --- a/config/breadcrumbs.rb +++ b/config/breadcrumbs.rb @@ -82,8 +82,8 @@ crumb :import do |workbench, import| end crumb :import_resources do |import, import_resources| - link I18n.t('import_resources.index.title'), workbench_import_import_resources_path(import.workbench, import) - parent :import, import.workbench, import + link I18n.t('import_resources.index.title'), workbench_import_import_resources_path(import.workbench, import.parent) + parent :import, import.workbench, import.parent end crumb :organisation do |organisation| diff --git a/config/locales/compliance_control_blocks.en.yml b/config/locales/compliance_control_blocks.en.yml index 150157ff3..b9c01278c 100644 --- a/config/locales/compliance_control_blocks.en.yml +++ b/config/locales/compliance_control_blocks.en.yml @@ -17,7 +17,7 @@ fr: new: title: Create a control block edit: - title: "Edit the control block : %{compliance_control_block}" + title: "Edit the control block : %{name}" metas: control: zero: "No controls" diff --git a/config/locales/compliance_control_blocks.fr.yml b/config/locales/compliance_control_blocks.fr.yml index 1222b5c1a..a6720881f 100644 --- a/config/locales/compliance_control_blocks.fr.yml +++ b/config/locales/compliance_control_blocks.fr.yml @@ -17,7 +17,7 @@ fr: new: title: Créer un groupe de contrôle(s) edit: - title: "Editer le groupe de contrôle : %{compliance_control_block}" + title: "Editer le groupe de contrôle : %{name}" metas: control: zero: "Aucun contrôle" diff --git a/spec/lib/compliance_control_set_cloner_spec.rb b/spec/lib/compliance_control_set_cloner_spec.rb index c17f0bb52..7efe27659 100644 --- a/spec/lib/compliance_control_set_cloner_spec.rb +++ b/spec/lib/compliance_control_set_cloner_spec.rb @@ -102,7 +102,7 @@ RSpec.describe ComplianceControlSetCloner do # Check correctly copied blocks target_blox.zip(source_blox).each do | target_block, source_block | expect( target_block.compliance_control_set ).to eq(target_set) - expect( target_block.name ).to eq( [block_prefix, source_block.name].join(' ') ) + expect( target_block.name ).to eq(source_block.name) expect( target_block.condition_attributes ).to eq( source_block.condition_attributes ) end |
