Module: Gluttonberg::Public::Assets

Included in:
Gluttonberg::Public
Defined in:
app/helpers/gluttonberg/public/assets.rb

Instance Method Summary collapse

Instance Method Details

Generates a <ul> with list of the images.

Parameters:

  • slug (String)

    Gallery’s unique slug, it is used to find gallery.

  • gallery_thumb_image (Symbol)

    Small thumbnail settings names

  • gallery_large_image (Symbol)

    Actual large image for gallery settings name

  • html_opts_for_ul (Hash) (defaults to: {})

    Any html related options for ul tag

  • html_opts_for_li (Hash) (defaults to: {})

    Any html related options for li tag

  • html_opts_for_a (Hash) (defaults to: {})

    Any html related options for a tag



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/helpers/gluttonberg/public/assets.rb', line 15

def gallery_ul(slug, gallery_thumb_image, gallery_large_image, html_opts_for_ul = {}, html_opts_for_li = {}, html_opts_for_a = {})
  gallery = Gluttonberg::Gallery.where(:slug => slug).published.first
  unless gallery.blank? || gallery.gallery_images.blank?
    options = render(:partial => "/gluttonberg/public/shared/gallery_images_lis", :locals => {
      :gallery => gallery,
      :gallery_thumb_image => gallery_thumb_image,
      :gallery_large_image => gallery_large_image,
      :html_opts_for_li => html_opts_for_li, 
      :html_opts_for_a => html_opts_for_a
    })
    html_opts_for_ul[:id] = "gallery_#{gallery.slug}"
    (:ul  , options.html_safe , html_opts_for_ul)
  end
end