Sha256: c316200bae6acac83548ecfa2bba6024c55dce40c8c4b71123691d8eea4c096f
Contents?: true
Size: 1.16 KB
Versions: 20
Compression:
Stored size: 1.16 KB
Contents
module WorkflowRESTHelpers attr_accessor :workflow_resources def self.workflow_resources @@workflow_resources ||= [Rbbt.share.views.find(:lib)] end def workflow_resources [Rbbt.www.views.find(:lib)] + WorkflowRESTHelpers.workflow_resources end def locate_workflow_template_from_resource(resource, template, workflow = nil, task = nil) template += '.haml' unless template =~ /.+\..+/ paths = [] paths << resource[workflow][task][template] if task and workflow paths << resource[workflow][template] if workflow paths << resource[template] paths.each do |path| return path.find if path.exists? end nil end def locate_workflow_template(template, workflow = nil, task = nil) if workflow path = locate_workflow_template_from_resource(workflow.libdir.www.views.find, template, workflow, task) return path if path and path.exists? end workflow_resources.each do |resource| path = locate_workflow_template_from_resource(resource, template, workflow, task) return path if path and path.exists? end raise "Template not found: [#{ template }, #{workflow}, #{ task }]" end end
Version data entries
20 entries across 20 versions & 1 rubygems