Module: Cocooned::Helpers::Tags
- Includes:
- Deprecated::Helpers::Tags
- Defined in:
- lib/cocooned/helpers/tags.rb,
lib/cocooned/helpers/tags/up.rb,
lib/cocooned/helpers/tags/add.rb,
lib/cocooned/helpers/tags/down.rb,
lib/cocooned/helpers/tags/remove.rb
Overview
Cocooned tags helpers output action link to interact with a dynamic nested form.
Each action has its dedicated helpers:
-
cocooned_add_item_link/cocooned_add_item_buttonto add an item -
cocooned_remove_item_link/cocooned_remove_item_buttonto remove an item -
cocooned_move_item_up_link/cocooned_move_item_up_buttonto move an item up (in a reorderable form) -
cocooned_move_item_down_link/cocooned_move_item_down_linkto move an item down (in a reorderable form)
Labelling action links
The label of any action links can be given explicitly as helper’s first argument or as a block, just as you can do on ActionView’s link_to or similar helpers.
Additionally, Cocooned helpers will lookup I18n translations for a default label based on the action name (add, remove, up, down) and the association name.
For add action links, the association name used is the same as passed as argument. On other action triggers, it is extracted from nested form #object_name.
You can declare default labels in your translation files with following keys:
-
‘cocooned.association.action` (Ex:
cocooned.items.add) -
‘cocooned.defaults.action`
If no translation is found, the default label will be the humanized action name.
Defined Under Namespace
Modules: Add, Down, Remove, Up