diff options
| author | cedricnjanga | 2018-03-16 07:32:28 -0700 |
|---|---|---|
| committer | cedricnjanga | 2018-03-16 07:32:28 -0700 |
| commit | 2cbae0fdcfaab4dca13e50755ca031610eb3eedd (patch) | |
| tree | 16b26bfacbc3fedaf02f8719b03ab2172d421ce3 | |
| parent | 6e27953fbf3539da0d0971f762c0a4443c9f8946 (diff) | |
| download | chouette-core-2cbae0fdcfaab4dca13e50755ca031610eb3eedd.tar.bz2 | |
Refs #6177 Add control attributes to CC#show6177-compliance-control-metadatas
| -rw-r--r-- | app/helpers/compliance_controls_helper.rb | 11 | ||||
| -rw-r--r-- | app/views/shared/controls/_metadatas.html.slim | 8 |
2 files changed, 13 insertions, 6 deletions
diff --git a/app/helpers/compliance_controls_helper.rb b/app/helpers/compliance_controls_helper.rb index ba0c538c9..297ae3afa 100644 --- a/app/helpers/compliance_controls_helper.rb +++ b/app/helpers/compliance_controls_helper.rb @@ -8,4 +8,15 @@ module ComplianceControlsHelper key, pattern = key_pattern [t("compliance_controls.filters.subclasses.#{key}"), "-#{pattern}-"] end + + def compliance_control_metadatas(compliance_control) + attributes = resource.class.dynamic_attributes + attributes.push(*resource.control_attributes.keys) if resource.respond_to? :control_attributes + + {}.tap do |hash| + attributes.each do |attribute| + hash[ComplianceControl.human_attribute_name(attribute)] = resource.send(attribute) + end + end + end end diff --git a/app/views/shared/controls/_metadatas.html.slim b/app/views/shared/controls/_metadatas.html.slim index 49df06166..80f3936e6 100644 --- a/app/views/shared/controls/_metadatas.html.slim +++ b/app/views/shared/controls/_metadatas.html.slim @@ -7,9 +7,5 @@ I18n.t('activerecord.attributes.compliance_control.predicate') => resource.predicate, I18n.t('activerecord.attributes.compliance_control.prerequisite') => resource.prerequisite, }.merge( \ - {}.tap do |hash| \ - resource.class.dynamic_attributes.each do |attribute| \ - hash[ComplianceControl.human_attribute_name(attribute)] = resource.send(attribute) \ - end \ - end \ - ) + compliance_control_metadatas(resource) \ + )
\ No newline at end of file |
