Sha256: 3b1e75d2eb1dd4a064f05b1a909b5b2eb63cf33d7ebd34b614e03fdad43ea77f

Contents?: true

Size: 520 Bytes

Versions: 24

Compression:

Stored size: 520 Bytes

Contents

module Loco
  module Helpers
    def loco_body_data
      { 'data-namespace' => namespace_name,
        'data-controller' => controller_name.split('_').map(&:capitalize).join(""),
        'data-action' => action_name,
        'data-rails-env' => Rails.env,
        'data-user-agent' => request.user_agent
      }
    end


    private

      def namespace_name
        path = controller_path.split '/'
        if path.size > 1
          path.first
        else
          "Main"
        end.capitalize
      end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
loco-rails-2.5.3 lib/loco/helpers.rb
loco-rails-2.5.2 lib/loco/helpers.rb
loco-rails-2.5.1 lib/loco/helpers.rb
loco-rails-2.5.0 lib/loco/helpers.rb
loco-rails-2.4.0 lib/loco/helpers.rb
loco-rails-2.3.0 lib/loco/helpers.rb
loco-rails-3.0.0 lib/loco/helpers.rb
loco-rails-2.2.2 lib/loco/helpers.rb
loco-rails-2.2.1 lib/loco/helpers.rb
loco-rails-2.2.0 lib/loco/helpers.rb
loco-rails-2.1.0 lib/loco/helpers.rb
loco-rails-2.0.0 lib/loco/helpers.rb
loco-rails-1.5.2 lib/loco/helpers.rb
loco-rails-1.5.1 lib/loco/helpers.rb
loco-rails-1.5.0 lib/loco/helpers.rb
loco-rails-1.4.0 lib/loco/helpers.rb
loco-rails-1.3.3 lib/loco/helpers.rb
loco-rails-1.3.2 lib/loco/helpers.rb
loco-rails-1.3.1 lib/loco/helpers.rb
loco-rails-1.3.0 lib/loco/helpers.rb