Sha256: d483b06baa47c6ba09f8754917034c951d102699349263a7a90a48c844a38a0d

Contents?: true

Size: 994 Bytes

Versions: 6

Compression:

Stored size: 994 Bytes

Contents

module Enjoy::Gallery::LoadGalleryImages
  extend ActiveSupport::Concern


  def enjoy_gallery_render_gallery_images
    @gallery_images = enjoy_gallery_load_gallery_images

    @next_page = (params[:page] || 1).to_i + 1

    render_opts = {
      layout:   enjoy_gallery_gallery_images_layout,
      action:   enjoy_gallery_gallery_images_action,
      partial:  enjoy_gallery_gallery_images_partial
    }
    render render_opts.compact
  end

  private

  def enjoy_gallery_gallery_images_layout
    request.xhr? ? false : 'application'
  end

  def enjoy_gallery_gallery_images_action
    'enjoy_gallery_render_gallery_images'
  end

  def enjoy_gallery_gallery_images_partial
    nil
  end

  def enjoy_gallery_gallery_image_class
    Enjoy::Gallery::Image
  end

  def enjoy_gallery_load_gallery_images
    enjoy_gallery_gallery_image_class.enabled.sorted.page(params[:page]).per(enjoy_gallery_gallery_images_per_page)
  end

  def enjoy_gallery_gallery_images_per_page
    4
  end



end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
enjoy_cms_gallery-0.4.1 app/controllers/concerns/enjoy/gallery/load_gallery_images.rb
enjoy_cms_gallery-0.4.0.2 app/controllers/concerns/enjoy/gallery/load_gallery_images.rb
enjoy_cms_gallery-0.4.0.1 app/controllers/concerns/enjoy/gallery/load_gallery_images.rb
enjoy_cms_gallery-0.4.0 app/controllers/concerns/enjoy/gallery/load_gallery_images.rb
enjoy_cms_gallery-0.4.0.beta3 app/controllers/concerns/enjoy/gallery/load_gallery_images.rb
enjoy_cms_gallery-0.4.0.beta1 app/controllers/concerns/enjoy/gallery/load_gallery_images.rb