Method: Admin::DocumentsHelper#form_partial

Defined in:
app/helpers/admin/documents_helper.rb

#form_partialObject

Find the correct form partial for @document



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'app/helpers/admin/documents_helper.rb', line 34

def form_partial
  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 |      
    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