Module: Katalyst::Navigation::HasLink
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/katalyst/navigation/has_link.rb
Constant Summary collapse
- HTTP_METHODS =
%w[get post patch put delete].index_by(&:itself).freeze
- TARGETS =
%w[self top blank kpop].index_by(&:itself).freeze
Instance Method Summary collapse
Instance Method Details
#link_attributes ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/models/concerns/katalyst/navigation/has_link.rb', line 29 def link_attributes = if target_self? {} # default elsif target_blank? || target_top? { target: "_#{target}" } # browser will handle this target else { data: { turbo_frame: target } } # turbo target end .deep_merge!({ data: { turbo_method: http_method } }) unless http_get? || target_blank? end |