mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-08 21:06:24 +08:00
fix bug with filenames
This commit is contained in:
parent
9939d8df06
commit
3057965940
2 changed files with 12 additions and 6 deletions
|
@ -89,7 +89,7 @@ module ReportActions
|
||||||
res << el
|
res << el
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
file_name = contents.element.to_s.singularize
|
file_name = contents.file_name
|
||||||
file_name = contents.element if contents.element == :samples
|
file_name = contents.element if contents.element == :samples
|
||||||
res << generate_el(
|
res << generate_el(
|
||||||
"reports/elements/my_module_#{file_name}_element.html.erb",
|
"reports/elements/my_module_#{file_name}_element.html.erb",
|
||||||
|
|
|
@ -16,15 +16,16 @@ module ReportExtends
|
||||||
# :locals => an array of names of local variables which are passed in the view
|
# :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
|
# :coll => a prock which the my_module is passed and have to return a
|
||||||
# collection of element
|
# collection of element
|
||||||
# :options => a hash of options for now only :add_values which
|
# :singular => true by defaut change the enum type to singular
|
||||||
# will add a value to locals
|
# needed when querying partials by name
|
||||||
|
|
||||||
ModuleElement = Struct.new(:element,
|
ModuleElement = Struct.new(:element,
|
||||||
:children,
|
:children,
|
||||||
:locals,
|
:locals,
|
||||||
:coll) do
|
:coll,
|
||||||
def initialize(element, children, locals, coll = nil)
|
:singular) do
|
||||||
super(element, children, locals, coll)
|
def initialize(element, children, locals, coll = nil, singular = true)
|
||||||
|
super(element, children, locals, coll, singular)
|
||||||
end
|
end
|
||||||
|
|
||||||
def collection(my_module)
|
def collection(my_module)
|
||||||
|
@ -38,6 +39,11 @@ module ReportExtends
|
||||||
end
|
end
|
||||||
container
|
container
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def file_name
|
||||||
|
return element.to_s unless singular
|
||||||
|
element.to_s.singularize
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Module contents element
|
# Module contents element
|
||||||
|
|
Loading…
Add table
Reference in a new issue