Class: Alchemy::Ingredients::TextView
- Includes:
- LinkTarget
- Defined in:
- app/components/alchemy/ingredients/text_view.rb
Constant Summary
Constants included from LinkTarget
LinkTarget::BLANK_VALUE, LinkTarget::REL_VALUE
Instance Attribute Summary collapse
-
#disable_link ⇒ Object
readonly
Returns the value of attribute disable_link.
Attributes inherited from BaseView
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(ingredient, disable_link: nil, html_options: {}) ⇒ TextView
constructor
A new instance of TextView.
Methods included from LinkTarget
#link_rel_value, #link_target_value
Methods inherited from BaseView
Constructor Details
#initialize(ingredient, disable_link: nil, html_options: {}) ⇒ TextView
Returns a new instance of TextView.
14 15 16 17 |
# File 'app/components/alchemy/ingredients/text_view.rb', line 14 def initialize(ingredient, disable_link: nil, html_options: {}) super(ingredient, html_options: ) @disable_link = settings_value(:disable_link, value: disable_link, default: false) end |
Instance Attribute Details
#disable_link ⇒ Object (readonly)
Returns the value of attribute disable_link.
6 7 8 |
# File 'app/components/alchemy/ingredients/text_view.rb', line 6 def disable_link @disable_link end |
Instance Method Details
#call ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/components/alchemy/ingredients/text_view.rb', line 19 def call if disable_link? dom_id.present? ? anchor : value else link_to(value, url_for(link), { id: dom_id.presence, title: link_title, target: link_target_value(link_target), rel: link_rel_value(link_target) }.merge()) end.html_safe end |