Sha256: 828dac90663c65c38eeccb1a1a8ee1fd77b7a9c578107114764c85a3525063f2
Contents?: true
Size: 1.51 KB
Versions: 1
Compression:
Stored size: 1.51 KB
Contents
module Ecm module Galleries # Usage: # # # app/controllers/application_vontroller.rb # class ApplicationController < ActionController::Base # view_helper Ecm::Galleries::PicturesHelper, as: :pictures_helper # # ... # end # # # app/views/home/index.html.haml # = pictures_helper(self).render(name: 'main', variant_options: { combine_options: { resize: "255x255^", extent: "255x255", gravity: "center"} }, show_details: true) # # Default options are taken from Ecm::Galleries::Configuration.pictures_helper_render_default_options. # You can set this option in the initializer. # # You can pass the image_tag_only option to render just the <img>-tag without a bootstrap card. # class PicturesHelper < ViewHelper::Base def initialize(context) @context = context end def render(options = {}) options.reverse_merge!(Ecm::Galleries::Configuration.pictures_helper_render_default_options) id = options.delete(:id) variant_options = options.delete(:variant_options) || {} show_details = options.delete(:show_details) image_tag_only = options.delete(:image_tag_only) resource = Ecm::Galleries::PictureDetail.where(id: id).first c.render partial: 'ecm/galleries/pictures_helper/render', locals: { resource: resource, variant_options: variant_options, show_details: show_details, image_tag_only: image_tag_only } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ecm_galleries-0.2.0 | app/view_helpers/ecm/galleries/pictures_helper.rb |