Module: Granite::Projector::Helpers

Extended by:
ActiveSupport::Concern
Included in:
Granite::Projector
Defined in:
lib/granite/projector/helpers.rb

Instance Method Summary collapse

Instance Method Details

#action_path(action, **options) ⇒ Object



30
31
32
# File 'lib/granite/projector/helpers.rb', line 30

def action_path(action, **options)
  action_url(action, **options, only_path: true)
end

#action_url(action, **options) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/granite/projector/helpers.rb', line 20

def action_url(action, **options)
  action_path = controller_actions[action.to_sym].fetch(:as, action)
  params = required_params.merge(projector_action: action_path)

  Rails.application.routes.url_for(
    options.reverse_merge(url_options).merge!(params),
    corresponding_route.name
  )
end

#view_contextObject Also known as: h



15
16
17
# File 'lib/granite/projector/helpers.rb', line 15

def view_context
  Granite.view_context
end