aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorcedricnjanga2018-05-29 07:35:32 -0700
committerJohan Van Ryseghem2018-05-31 14:10:09 +0200
commit264122418a29e102061e0dac2ce53a6158ee4c89 (patch)
tree79a601ab01a718a2637531bab6ac2fed9f3755f6 /app/models
parentab00694f49336a326d934ff0bd85b76e2e0a6c23 (diff)
downloadchouette-core-264122418a29e102061e0dac2ce53a6158ee4c89.tar.bz2
Refs #7057 Add some improvements to select type view & compliance control table builder on subclass column
Diffstat (limited to 'app/models')
-rw-r--r--app/models/compliance_control.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/compliance_control.rb b/app/models/compliance_control.rb
index 59c359bd5..4a2a6e91c 100644
--- a/app/models/compliance_control.rb
+++ b/app/models/compliance_control.rb
@@ -20,6 +20,17 @@ class ComplianceControl < ApplicationModel
}
end
+ def subclasses_to_hash
+ ComplianceControl.subclasses.inject(Hash.new{ |h, k| h[k] = [] } ) do |h, klass|
+ h[ComplianceControl.subclass_patterns.key(klass.object_type)] << klass
+ h
+ end
+ end
+
+ def translated_subclass
+ I18n.t("compliance_controls.filters.subclasses.#{subclass_patterns.key(self.object_type)}")
+ end
+
def object_type
self.default_code.match(/^\d+-(?'object_type'\w+)-\d+$/)[:object_type]
end