Sha256: 3060d157d4bb2032f15c1b279a902e93a7e5968b3cf0abce3278564cdae6499b

Contents?: true

Size: 642 Bytes

Versions: 5

Compression:

Stored size: 642 Bytes

Contents

module Initjs
  module Helper
    def initjs_tag options = {}
      options = { app_name: options } unless options.is_a?(Hash)
      if options[:partial] && options[:partial] == true
        id = 'init-partial-js'
      else
        id = 'init-js'
      end

      content_tag 'div', '', { id: id,
                               :"data-resource" => controller.controller_path.split('/').map(&:camelize).join('/'),
                               :"data-action" => controller.action_name.camelize,
                               :"data-app-name" => options[:app_name] || "App"}
    end
  end
end

ActionView::Base.send :include, Initjs::Helper

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
initjs-2.1.2 lib/initjs/helper.rb
initjs-2.1.1 lib/initjs/helper.rb
initjs-2.1.0 lib/initjs/helper.rb
initjs-2.0.0 lib/initjs/helper.rb
initjs-2.0.0.beta1 lib/initjs/helper.rb