Class: Alchemy::Ingredients::TextView
- Defined in:
- app/components/alchemy/ingredients/text_view.rb
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 inherited from BaseView
Constructor Details
#initialize(ingredient, disable_link: nil, html_options: {}) ⇒ TextView
Returns a new instance of TextView.
12 13 14 15 |
# File 'app/components/alchemy/ingredients/text_view.rb', line 12 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.
4 5 6 |
# File 'app/components/alchemy/ingredients/text_view.rb', line 4 def disable_link @disable_link end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/components/alchemy/ingredients/text_view.rb', line 17 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 }.merge()) end.html_safe end |