| Module | ActiveLinkTo |
| In: |
lib/active_link_to/version.rb
lib/active_link_to/active_link_to.rb |
| VERSION | = | "1.0.5" |
Wrapper around link_to. Accepts following params:
:active => Boolean | Symbol | Regex | Controller/Action Pair :class_active => String :class_inactive => String :disable_active => Boolean :wrap_tag => Symbol
Example usage:
active_link_to('/users', class_active: 'enabled')
active_link_to(users_path, active: :exclusive, wrap_tag: :li)
Returns css class name. Takes the link‘s URL and its params Example usage:
active_link_to_class('/root', class_active: 'on', class_inactive: 'off')
Returns true or false based on the provided path and condition Possible condition values are:
Boolean -> true | false
Symbol -> :exclusive | :inclusive
Regex -> /regex/
Controller/Action Pair -> [[:controller], [:action_a, :action_b]]
Example usage:
is_active_link?('/root', true)
is_active_link?('/root', :exclusive)
is_active_link?('/root', /^\/root/)
is_active_link?('/root', ['users', ['show', 'edit']])