Class: HooplaSalesforce::TemplateProcessor::VisualForce
- Inherits:
-
Base
- Object
- Base
- HooplaSalesforce::TemplateProcessor::VisualForce
show all
- Defined in:
- lib/hoopla_salesforce/template_processor.rb
Instance Attribute Summary
Attributes inherited from Base
#base, #file, #src
Instance Method Summary
collapse
Methods inherited from Base
#each_resource_file, #initialize
#capture
Instance Method Details
#as_json_array(collection, var) ⇒ Object
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/hoopla_salesforce/template_processor.rb', line 62
def as_json_array(collection, var)
<<-EOS.margin
[<apex:repeat value="{!#{collection}}" var="#{var}" rows="1">
#{send("#{var}_json")}
</apex:repeat>
<apex:repeat value="{!#{collection}}" var="#{var}" first="1">
,#{send("#{var}_json")}
</apex:repeat>]
EOS
end
|
#end_page ⇒ Object
41
42
43
|
# File 'lib/hoopla_salesforce/template_processor.rb', line 41
def end_page
"</apex:page>"
end
|
#javascript_include_tag(*files) ⇒ Object
56
57
58
59
60
|
# File 'lib/hoopla_salesforce/template_processor.rb', line 56
def javascript_include_tag(*files)
each_resource_file(files, "js") do |file|
%Q|<script type="text/javascript" src="#{resource_url(file)}"></script>|
end
end
|
#output_file ⇒ Object
73
74
75
|
# File 'lib/hoopla_salesforce/template_processor.rb', line 73
def output_file
"#{src}/pages/#{base}"
end
|
#page(opts = {}) ⇒ Object
36
37
38
39
|
# File 'lib/hoopla_salesforce/template_processor.rb', line 36
def page(opts={})
params = opts.map { |key, val| %Q|#{key}="#{val}"| }.join(" ")
"<apex:page #{params}>"
end
|
#resource_url(file) ⇒ Object
45
46
47
48
|
# File 'lib/hoopla_salesforce/template_processor.rb', line 45
def resource_url(file)
resource, file = file.split('/', 2)
"{!URLFOR($Resource.#{resource}, '/#{file}')}"
end
|
#stylesheet_include_tag(*files) ⇒ Object
50
51
52
53
54
|
# File 'lib/hoopla_salesforce/template_processor.rb', line 50
def stylesheet_include_tag(*files)
each_resource_file(files, "css") do |file|
%Q|<apex:stylesheet value="#{resource_url(file)}" />|
end
end
|