Sha256: 7d7c7d3a763b9a8d276cac266a935de825aa574aeadfdff79056116691a606ef
Contents?: true
Size: 924 Bytes
Versions: 6
Compression:
Stored size: 924 Bytes
Contents
class ElasticSliderPanelWidget < Widget attribute :image, :reference attribute :panel_content, :widgetlist def additional_classes(params) begin "active" if self.container.panels.first == self rescue end end def description_for_editor "Elastic Slider Panel" end def self.valid_container_classes [ElasticSliderWidget] end def transform_for_desktop(width) if container.slider_height.to_i > 100 image.binary.transform(width: width, height: self.height, fit: :crop, crop: :center) else image.binary.transform(width: width) end end def fallback_transform if container.slider_height.to_i > 100 return { width: 1920, height: self.height, fit: :crop, crop: :center } end end def height h = container.slider_height.to_i h > 100 ? h+200 : image.meta_data[:height] # 50vh, 100vh is dynamic, no height calculation possible end end
Version data entries
6 entries across 6 versions & 1 rubygems