Class: Tramway::Landing::BlockDecorator
- Inherits:
-
Core::ApplicationDecorator
- Object
- Core::ApplicationDecorator
- Tramway::Landing::BlockDecorator
- Defined in:
- app/decorators/tramway/landing/block_decorator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #block_type ⇒ Object
- #button ⇒ Object
- #form_url ⇒ Object
- #link ⇒ Object
- #view_state ⇒ Object
- #view_state_button_color(event) ⇒ Object
Class Method Details
.collections ⇒ Object
5 6 7 |
# File 'app/decorators/tramway/landing/block_decorator.rb', line 5 def collections [:all] end |
.list_attributes ⇒ Object
9 10 11 |
# File 'app/decorators/tramway/landing/block_decorator.rb', line 9 def list_attributes %i[position view_state block_type] end |
Instance Method Details
#block_type ⇒ Object
18 19 20 |
# File 'app/decorators/tramway/landing/block_decorator.rb', line 18 def block_type object.block_type_text end |
#button ⇒ Object
43 44 45 46 47 48 49 |
# File 'app/decorators/tramway/landing/block_decorator.rb', line 43 def if object..present? && object.['title'].present? && object.['link'].present? content_tag :a, href: object.['link'], target: '_blank', class: 'btn btn-primary' do object.['title'] end end end |
#form_url ⇒ Object
30 31 32 |
# File 'app/decorators/tramway/landing/block_decorator.rb', line 30 def form_url object.values['form_url'] end |
#link ⇒ Object
26 27 28 |
# File 'app/decorators/tramway/landing/block_decorator.rb', line 26 def link "##{object.anchor}" end |
#view_state ⇒ Object
22 23 24 |
# File 'app/decorators/tramway/landing/block_decorator.rb', line 22 def view_state object.human_view_state_name end |
#view_state_button_color(event) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'app/decorators/tramway/landing/block_decorator.rb', line 34 def (event) case event when :publish :primary when :hide :secondary end end |