Class: Ecm::Galleries::ViewHelper

Inherits:
Object
  • Object
show all
Defined in:
app/view_helpers/ecm/galleries/view_helper.rb

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ ViewHelper

Returns a new instance of ViewHelper.



4
5
6
# File 'app/view_helpers/ecm/galleries/view_helper.rb', line 4

def initialize(context)
  @context = context
end

Instance Method Details

#render(options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'app/view_helpers/ecm/galleries/view_helper.rb', line 8

def render(options = {})
  options.reverse_merge!(variant_options: {}, show_details: true)
  
  name            = options.delete(:name)
  variant_options = options.delete(:variant_options)
  show_details    = options.delete(:show_details)
  
  resource = Ecm::Galleries::PictureGallery.where(name: name).first
  c.render partial: 'ecm/galleries/view_helper/render', locals: { resource: resource, variant_options: variant_options, show_details: show_details }
end