Class: Orange::PageParts
Instance Method Summary
collapse
Methods inherited from Resource
call_me, #do_view, #find_extras, #init, #initialize, #nests, #options, #orange, #orange_name, #routable, #set_orange, set_orange, #view, #view_opts, #viewable, viewable
#cattr_accessor, #cattr_reader, #cattr_writer, eval_in_accessor_module, fetch_value, store_value
Instance Method Details
#add_css(packet, file, opts = {}) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/orange-core/resources/page_parts.rb', line 17
def add_css(packet, file, opts = {})
ie = opts[:ie] || false
mod = opts[:module] || 'public'
assets = File.join('assets', mod)
file = File.join('', assets, 'css', file)
unless packet[:css_files, []].include?(file)
if ie
part(packet)[:ie_css] = part(packet)[:ie_css] + "<link rel=\"stylesheet\" href=\"#{file}\" type=\"text/css\" media=\"screen\" charset=\"utf-8\" />"
else
part(packet)[:css] = part(packet)[:css] + "<link rel=\"stylesheet\" href=\"#{file}\" type=\"text/css\" media=\"screen\" charset=\"utf-8\" />"
end
packet[:css_files] ||= []
packet[:css_files].insert((opts[:position] ? opts[:position] : -1), file)
end
end
|
#add_js(packet, file, opts = {}) ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/orange-core/resources/page_parts.rb', line 34
def add_js(packet, file, opts = {})
ie = opts[:ie] || false
mod = opts[:module] || 'public'
assets = File.join('assets', mod)
file = File.join('', assets, 'js', file)
unless packet[:js_files, []].include?(file)
if ie
part(packet)[:ie_js] = part(packet)[:ie_js] + "<script src=\"#{file}\" type=\"text/javascript\"></script>"
else
part(packet)[:js] = part(packet)[:js] + "<script src=\"#{file}\" type=\"text/javascript\"></script>"
end
packet[:js_files] ||= []
packet[:js_files].insert((opts[:position] ? opts[:position] : -1), file)
end
end
|
#afterLoad ⇒ Object
4
5
6
|
# File 'lib/orange-core/resources/page_parts.rb', line 4
def afterLoad
orange.add_pulp Orange::Pulp::PageParts
end
|
#part(packet) ⇒ Object
8
9
10
11
12
13
14
|
# File 'lib/orange-core/resources/page_parts.rb', line 8
def part(packet)
unless packet[:page_parts, false]
packet[:page_parts] = DefaultHash.new
packet[:page_parts].default = ''
end
packet[:page_parts]
end
|