Class: Workarea::Storefront::ContentBlocks::HeroSliderBlockViewModel

Inherits:
ContentBlockViewModel
  • Object
show all
Defined in:
app/view_models/workarea/storefront/content_blocks/hero_slider_block_view_model.rb

Instance Method Summary collapse

Instance Method Details

#content_block_optionsObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/view_models/workarea/storefront/content_blocks/hero_slider_block_view_model.rb', line 5

def content_block_options
  {
    options: {
      slidesToShow: 1,
      slidesToScroll: 1,
      autoplay: false, # mobile autoplay
      dots: data[:show_dots],
      arrows: data[:show_arrows],
      centerMode: data[:partial_slide_preview],
      pauseOnHover: data[:pause_on_hover],
      pauseOnDotsHover: data[:pause_on_hover],
      pauseOnFocus: data[:pause_on_hover],
      mobileFirst: true,
      responsive: [
        {
          breakpoint: Workarea.config.storefront_break_points[:wide] - 1,
          settings: {
            autoplay: data[:auto_rotate],
            autoplaySpeed: rotate_speed
          }
        }
      ]
    },
    stopOnInteraction: data[:stop_on_interaction]
  }.to_json
end

#has_content?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'app/view_models/workarea/storefront/content_blocks/hero_slider_block_view_model.rb', line 32

def has_content?
  data[:"heading"].present? || data[:"sub_heading"].present?
end