aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/helpers/application_helper.rb2
-rw-r--r--app/models/compliance_control_block.rb4
-rw-r--r--app/policies/referential_policy.rb2
3 files changed, 6 insertions, 2 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?