Sha256: 2c549bb7afe7499a714292bb24a6763a40f5dd23b6d7599952b4ad1ec420847a

Contents?: true

Size: 702 Bytes

Versions: 3

Compression:

Stored size: 702 Bytes

Contents

module JellyHelper

  def application_jelly_files(jelly_files_path_from_javascripts = '', rails_root = RAILS_ROOT)
    Dir["#{rails_root}/public/javascripts/#{jelly_files_path_from_javascripts}/pages/**/*.js"].map do |path|
      path.gsub("#{rails_root}/public/javascripts/", "").gsub(/\.js$/, "")
    end
  end

  def spread_jelly
    javascript_tag <<-JS
      window._token = '#{form_authenticity_token}'
      Jelly.activatePage('#{controller.controller_path.camelcase}', '#{controller.action_name}');
      #{@content_for_javascript}
    JS
  end

  def attach_javascript_component(component_name, *args)
    content_for(:javascript, "page.attach(#{component_name}, #{args.to_json});")
  end

end

Version data entries

3 entries across 3 versions & 3 rubygems

Version Path
honkster-honkster-jelly-0.3.0 lib/jelly/jelly_helper.rb
pivotal-honkster-jelly-0.3.0 lib/jelly/jelly_helper.rb
pivotal-jelly-0.3.1 lib/jelly/jelly_helper.rb