app/helpers/admin/documents_helper.rb in qcms-1.3.7 vs app/helpers/admin/documents_helper.rb in qcms-1.3.8

- old
+ new

@@ -30,15 +30,19 @@ result end # Find the correct form partial for @document def form_partial - file = "admin/documents/_#{@document.label}_form.html.erb" + root = 'admin/documents' + choices = ["_#{@document.meta_definition.label_path.gsub('/', '_')}_form.html.erb", "_#{@document.label}_form.html.erb"] + self.view_paths.each do | view_path | - target = File.join(view_path, file) - logger.debug 'PARTIAL ' + target - if File.exists? target - return file.gsub('/_', '/') + choices.each do | choice | + target = File.join(view_path, root, choice) + logger.debug 'FORM: ' + target + if File.exists? target + return File.join(root, choice).gsub('/_', '/') + end end end "admin/documents/form" end