Module: JellyHelper
Instance Method Summary
collapse
#jelly_attach_op, #jelly_attachment_array, #jelly_attachment_hash, #jelly_call_op, #jelly_callback_hash, #jelly_method_call_hash, #jelly_notify_attach_hash, #jelly_notify_hash, #jelly_notify_op
Instance Method Details
#application_jelly_files(jelly_files_path_from_javascripts = '', rails_root = RAILS_ROOT) ⇒ Object
4
5
6
7
8
9
10
11
12
|
# File 'lib/jelly/jelly_helper.rb', line 4
def application_jelly_files(jelly_files_path_from_javascripts = '', rails_root = RAILS_ROOT)
rails_root = File.expand_path(rails_root)
(
Dir[File.expand_path("#{rails_root}/public/javascripts/#{jelly_files_path_from_javascripts}/components/**/*.js")] +
Dir[File.expand_path("#{rails_root}/public/javascripts/#{jelly_files_path_from_javascripts}/pages/**/*.js")]
).map do |path|
path.gsub("#{rails_root}/public/javascripts/", "").gsub(/\.js$/, "")
end
end
|
#attach_javascript_component(component_name, *args) ⇒ Object
64
65
66
|
# File 'lib/jelly/jelly_helper.rb', line 64
def attach_javascript_component(component_name, *args)
raise Jelly::OldMethodError
end
|
#attach_javascript_component_javascript_tag(components) ⇒ Object
56
57
58
|
# File 'lib/jelly/jelly_helper.rb', line 56
def attach_javascript_component_javascript_tag(components)
raise Jelly::OldMethodError
end
|
#clear_jelly_attached ⇒ Object
60
61
62
|
# File 'lib/jelly/jelly_helper.rb', line 60
def clear_jelly_attached
raise Jelly::OldMethodError
end
|
#jelly_add_op(op, &block) ⇒ Object
40
41
42
43
44
45
46
47
48
|
# File 'lib/jelly/jelly_helper.rb', line 40
def jelly_add_op(op, &block)
unless jelly_ops.include? op
if block
yield(op)
else
jelly_ops << op
end
end
end
|
#jelly_attach(component_name, *args, &block) ⇒ Object
32
33
34
|
# File 'lib/jelly/jelly_helper.rb', line 32
def jelly_attach(component_name, *args, &block)
jelly_add_op jelly_attach_op(component_name, *args), &block
end
|
#jelly_attach_on_ready(component_name, *args) ⇒ Object
68
69
70
|
# File 'lib/jelly/jelly_helper.rb', line 68
def jelly_attach_on_ready(component_name, *args)
raise Jelly::OldMethodError
end
|
#jelly_attachments ⇒ Object
72
73
74
|
# File 'lib/jelly/jelly_helper.rb', line 72
def jelly_attachments
raise Jelly::OldMethodError
end
|
#jelly_clear_ops ⇒ Object
28
29
30
|
# File 'lib/jelly/jelly_helper.rb', line 28
def jelly_clear_ops
jelly_ops.clear
end
|
#jelly_notify(message_name, *args, &block) ⇒ Object
36
37
38
|
# File 'lib/jelly/jelly_helper.rb', line 36
def jelly_notify(message_name, *args, &block)
jelly_add_op jelly_notify_op(message_name, *args), &block
end
|
#jelly_ops ⇒ Object
50
51
52
|
# File 'lib/jelly/jelly_helper.rb', line 50
def jelly_ops
@jelly_ops ||= []
end
|
#jelly_run_javascript(ops) ⇒ Object
24
25
26
|
# File 'lib/jelly/jelly_helper.rb', line 24
def jelly_run_javascript(ops)
"Jelly.run.apply(Jelly, #{ops.to_json});"
end
|
#jelly_run_javascript_tag(ops) ⇒ Object
20
21
22
|
# File 'lib/jelly/jelly_helper.rb', line 20
def jelly_run_javascript_tag(ops)
javascript_tag jelly_run_javascript(ops)
end
|
#spread_jelly ⇒ Object
14
15
16
17
18
|
# File 'lib/jelly/jelly_helper.rb', line 14
def spread_jelly
jelly_attach("Jelly.Location")
jelly_attach("Jelly.Page", controller.controller_path.camelcase, controller.action_name)
jelly_run_javascript_tag(jelly_ops)
end
|