Method: ScrivitoHelper#scrivito_image_tag
- Defined in:
- app/helpers/scrivito_helper.rb
#scrivito_image_tag(obj, field_name_or_tag_options = nil, tag_or_editing_options = {}, editing_options = {}) ⇒ String
Note:
If you do not specify an HTML alt
attribute, the helper method will use Obj#alt_description of the target object.
Calculates an HTML image tag of an image stored in the CMS for inplace editing.
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
# File 'app/helpers/scrivito_helper.rb', line 188 def scrivito_image_tag(obj, =nil, = {}, = {}) field_name, , = if .is_a?(Hash) [nil, , ] else [, , ] end if field_name.blank? if obj.binary? field_name = :blob else raise Scrivito::ScrivitoError, "when omitting `field_name' you have to pass a binary obj" end end = Scrivito::ImageTag.new(self).(obj, field_name, .with_indifferent_access, .with_indifferent_access) scrivito_tag('img', obj, field_name, ) end |