class Ecoportal::API::V2::Page::Component::ImagesField
Public Class Methods
new_doc()
click to toggle source
# File lib/ecoportal/api/v2/page/component/images_field.rb, line 9 def new_doc { "layout" => "third" } end
Public Instance Methods
configure(*conf)
click to toggle source
Quick config helper @param conf [Symbol, Array<Symbol>]
- `:strech` to make the image fit the full size of the image field - `:popup` to set to enable disable poupup on `click` - `:layout_button` to offer layout options to user - `:layout` with the following available values - `:three_crop` to specify _3 across_ by cutting the image to equalize size - `:three` to specify _3 across_ - `:two` to specify _2 across_ - `:one` to specify _Full width (1 Across)_
Calls superclass method
Ecoportal::API::V2::Page::Component#configure
# File lib/ecoportal/api/v2/page/component/images_field.rb, line 30 def configure(*conf) conf.each_with_object([]) do |cnf, unused| case cnf when :strech self.strech = true when :popup self.no_popup = false when :layout_button self.hide_options = false when Hash supported = [:layout_button, :layout] unless (rest = hash_except(cnf.dup, *supported)).empty? unused.push(rest) end if cnf.key?(:layout_button) then self.hide_options = !cnf[:layout_button] end if cnf.key?(:layout) then configure_layour cnf[:layout] end else unused.push(cnf) end end.yield_self do |unused| super(*unused) end end
Private Instance Methods
configure_layout(value)
click to toggle source
# File lib/ecoportal/api/v2/page/component/images_field.rb, line 57 def configure_layout(value) case value when :three self.layout = "third" when :two self.layout = "half" when :one self.layout = "fill" when :three_crop self.layout = "third_crop" else # Unsupported end end