Class: PhrasingBackgroundImageWidget
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- PhrasingBackgroundImageWidget
- Defined in:
- app/widgets/phrasing_background_image_widget.rb
Constant Summary collapse
- HTML_CLASS =
'phrasable-background-image'
Instance Attribute Summary collapse
-
#default_image ⇒ Object
Returns the value of attribute default_image.
-
#options ⇒ Object
Returns the value of attribute options.
-
#wrapped_html ⇒ Object
Returns the value of attribute wrapped_html.
Instance Method Summary collapse
-
#initialize(phrasing_image, view_context, wrapped_html, options = {}) ⇒ PhrasingBackgroundImageWidget
constructor
A new instance of PhrasingBackgroundImageWidget.
- #tag ⇒ Object
Constructor Details
#initialize(phrasing_image, view_context, wrapped_html, options = {}) ⇒ PhrasingBackgroundImageWidget
Returns a new instance of PhrasingBackgroundImageWidget.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/widgets/phrasing_background_image_widget.rb', line 9 def initialize(phrasing_image, view_context, wrapped_html, = {}) super(phrasing_image) @view_context = view_context @wrapped_html = wrapped_html @options = @default_image = @options.delete(:default_image) @options[:style] = "background-image: url(#{image_url})" @tag = @options.delete(:tag) return unless view_context.can_edit_phrases? add_phrasable_image_class end |
Instance Attribute Details
#default_image ⇒ Object
Returns the value of attribute default_image.
7 8 9 |
# File 'app/widgets/phrasing_background_image_widget.rb', line 7 def default_image @default_image end |
#options ⇒ Object
Returns the value of attribute options.
7 8 9 |
# File 'app/widgets/phrasing_background_image_widget.rb', line 7 def @options end |
#wrapped_html ⇒ Object
Returns the value of attribute wrapped_html.
7 8 9 |
# File 'app/widgets/phrasing_background_image_widget.rb', line 7 def wrapped_html @wrapped_html end |
Instance Method Details
#tag ⇒ Object
23 24 25 |
# File 'app/widgets/phrasing_background_image_widget.rb', line 23 def tag @tag || :div end |