Module: Aloha::Rails::Helpers
- Defined in:
- lib/aloha-rails/helpers.rb
Instance Method Summary collapse
Instance Method Details
#aloha!(options = {}) ⇒ Object
39 40 41 |
# File 'lib/aloha-rails/helpers.rb', line 39 def aloha!( = {}) aloha_script_tag() + aloha_setup end |
#aloha_script_tag(options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/aloha-rails/helpers.rb', line 6 def aloha_script_tag(={}) = { :type => 'text/javascript', :src => '/assets/aloha/lib/aloha.js', :plugins => Aloha::Rails.default_plugins, :extra_plugins => [] }.update() plugins = .delete(:plugins) || [] plugins += .delete(:extra_plugins) if plugins.any? [:data] = { 'aloha-plugins' => plugins.join(',') } end content_tag :script, nil, end |
#aloha_setup ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/aloha-rails/helpers.rb', line 27 def aloha_setup js = <<-JS Aloha.ready(function() { Aloha.require(Aloha.settings.modules, function(Aloha, $) { Aloha.onReady(); $(Aloha.settings.editables).aloha(); }); }); JS javascript_tag js end |