aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTeddy Wing2018-01-25 15:09:02 +0100
committerZog2018-01-25 17:18:03 +0100
commit9f6c7a5372d960eea49f5428975d7a92f6f91d33 (patch)
tree941ffd5005ecd2912c07b2b6897259538283e04f /lib
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 'lib')
-rw-r--r--lib/af83/decorator.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/af83/decorator.rb b/lib/af83/decorator.rb
index 1b9574053..f990555fe 100644
--- a/lib/af83/decorator.rb
+++ b/lib/af83/decorator.rb
@@ -32,6 +32,12 @@ class AF83::Decorator < ModelDecorator
instance_decorator.send(:define_method, method_name, &block)
end
+ # Defines a class method on the decorated object's class. These
+ # can be called like `object.class.my_method`.
+ def self.define_instance_class_method method_name, &block
+ instance_decorator.send(:define_singleton_method, method_name, &block)
+ end
+
class ActionLinks
attr_reader :options