Sha256: 1de432dad43cba8ac882b22c8e4aec8289eedf59bd16ce0ea044c5bde7909aab

Contents?: true

Size: 1.27 KB

Versions: 18

Compression:

Stored size: 1.27 KB

Contents

module Cmor
  module Galleries
    # Usage:
    #
    #     # app/controllers/application_vontroller.rb
    #     class ApplicationController < ActionController::Base
    #       view_helper Cmor::Galleries::GalleriesHelper, as: :galleries_helper
    #       # ...
    #     end
    #
    #     # app/views/home/index.html.haml
    #     = galleries_helper(self).render(name: 'main', variant_options: { combine_options: { resize: "255x255^", extent: "255x255", gravity: "center"} }, show_details: true)
    #
    # Default options are taken from Cmor::Galleries::Configuration.galleries_helper_render_default_options.
    # You can set this option in the initializer.
    #
    class GalleriesHelper < Rao::ViewHelper::Base
      def render(options = {})
        options.reverse_merge!(Cmor::Galleries::Configuration.galleries_helper_render_default_options)
        
        name            = options.delete(:name)
        variant_options = options.delete(:variant_options)
        show_details    = options.delete(:show_details)
        
        resource = Cmor::Galleries::PictureGallery.where(name: name).first
        c.render partial: 'cmor/galleries/galleries_helper/render', locals: { resource: resource, variant_options: variant_options, show_details: show_details }
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
cmor_galleries-0.0.60.pre app/view_helpers/cmor/galleries/galleries_helper.rb
cmor_galleries-0.0.59.pre app/view_helpers/cmor/galleries/galleries_helper.rb
cmor_galleries-0.0.58.pre app/view_helpers/cmor/galleries/galleries_helper.rb
cmor_galleries-0.0.57.pre app/view_helpers/cmor/galleries/galleries_helper.rb
cmor_galleries-0.0.56.pre app/view_helpers/cmor/galleries/galleries_helper.rb
cmor_galleries-0.0.55.pre app/view_helpers/cmor/galleries/galleries_helper.rb
cmor_galleries-0.0.54.pre app/view_helpers/cmor/galleries/galleries_helper.rb
cmor_galleries-0.0.53.pre app/view_helpers/cmor/galleries/galleries_helper.rb
cmor_galleries-0.0.52.pre app/view_helpers/cmor/galleries/galleries_helper.rb
cmor_galleries-0.0.51.pre app/view_helpers/cmor/galleries/galleries_helper.rb
cmor_galleries-0.0.50.pre app/view_helpers/cmor/galleries/galleries_helper.rb
cmor_galleries-0.0.49.pre app/view_helpers/cmor/galleries/galleries_helper.rb
cmor_galleries-0.0.48.pre app/view_helpers/cmor/galleries/galleries_helper.rb
cmor_galleries-0.0.45.pre app/view_helpers/cmor/galleries/galleries_helper.rb
cmor_galleries-0.0.44.pre app/view_helpers/cmor/galleries/galleries_helper.rb
cmor_galleries-0.0.43.pre app/view_helpers/cmor/galleries/galleries_helper.rb
cmor_galleries-0.0.42.pre app/view_helpers/cmor/galleries/galleries_helper.rb
cmor_galleries-0.0.41.pre app/view_helpers/cmor/galleries/galleries_helper.rb