aboutsummaryrefslogtreecommitdiffstats
path: root/app/decorators
diff options
context:
space:
mode:
authorTeddy Wing2018-01-25 15:09:02 +0100
committerZog2018-01-25 17:18:03 +0100
commit9f6c7a5372d960eea49f5428975d7a92f6f91d33 (patch)
tree941ffd5005ecd2912c07b2b6897259538283e04f /app/decorators
parent2bf4cf2e3a9e54bc9b91bf3efcac721951df730d (diff)
downloadchouette-core-9f6c7a5372d960eea49f5428975d7a92f6f91d33.tar.bz2
ComplianceControlDecorator: Convert to new action links interface
* Decorate the `ComplianceControl` so we can show the action links from the decorator in the header. * Add a `decorates` to get `object_class` to work inside the decorator. * Define `AF83::Decorator.define_instance_class_method` in order to enable the `@compliance_control.class.METHOD` calls in the view to work. Thanks very much to Johan for figuring out a way to do that. Refs #5586
Diffstat (limited to 'app/decorators')
-rw-r--r--app/decorators/compliance_control_decorator.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/decorators/compliance_control_decorator.rb b/app/decorators/compliance_control_decorator.rb
index a0445faa2..c57a7ccc7 100644
--- a/app/decorators/compliance_control_decorator.rb
+++ b/app/decorators/compliance_control_decorator.rb
@@ -1,4 +1,6 @@
class ComplianceControlDecorator < AF83::Decorator
+ decorates ComplianceControl
+
with_instance_decorator do |instance_decorator|
instance_decorator.show_action_link do |l|
l.content h.t('compliance_control_sets.actions.show')
@@ -30,4 +32,16 @@ class ComplianceControlDecorator < AF83::Decorator
l.data confirm: h.t('compliance_controls.actions.destroy_confirm')
end
end
+
+ define_instance_class_method :predicate do
+ object_class.predicate
+ end
+
+ define_instance_class_method :prerequisite do
+ object_class.prerequisite
+ end
+
+ define_instance_class_method :dynamic_attributes do
+ object_class.dynamic_attributes
+ end
end