diff --git a/app/controllers/concerns/report_actions.rb b/app/controllers/concerns/report_actions.rb index 6ba54c76d..8e8a675d3 100644 --- a/app/controllers/concerns/report_actions.rb +++ b/app/controllers/concerns/report_actions.rb @@ -89,7 +89,7 @@ module ReportActions res << el end else - file_name = contents.element.to_s.singularize + file_name = contents.file_name file_name = contents.element if contents.element == :samples res << generate_el( "reports/elements/my_module_#{file_name}_element.html.erb", diff --git a/config/initializers/extends/report_extends.rb b/config/initializers/extends/report_extends.rb index 2194f4c3c..5437454a3 100644 --- a/config/initializers/extends/report_extends.rb +++ b/config/initializers/extends/report_extends.rb @@ -16,15 +16,16 @@ module ReportExtends # :locals => an array of names of local variables which are passed in the view # :coll => a prock which the my_module is passed and have to return a # collection of element - # :options => a hash of options for now only :add_values which - # will add a value to locals + # :singular => true by defaut change the enum type to singular + # needed when querying partials by name ModuleElement = Struct.new(:element, :children, :locals, - :coll) do - def initialize(element, children, locals, coll = nil) - super(element, children, locals, coll) + :coll, + :singular) do + def initialize(element, children, locals, coll = nil, singular = true) + super(element, children, locals, coll, singular) end def collection(my_module) @@ -38,6 +39,11 @@ module ReportExtends end container end + + def file_name + return element.to_s unless singular + element.to_s.singularize + end end # Module contents element