fix bug with filenames

This commit is contained in:
zmagod 2017-03-09 11:48:50 +01:00
parent 9939d8df06
commit 3057965940
2 changed files with 12 additions and 6 deletions

View file

@ -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",

View file

@ -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