Module: Alchemy::Admin::PicturesHelper

Defined in:
app/helpers/alchemy/admin/pictures_helper.rb

Instance Method Summary collapse

Instance Method Details

#create_or_assign_url(picture_to_assign, options) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/helpers/alchemy/admin/pictures_helper.rb', line 6

def create_or_assign_url(picture_to_assign, options)
  if @content.nil?
    {
      controller: :contents,
      action: :create,
      picture_id: picture_to_assign.id,
      content: {
        essence_type: "Alchemy::EssencePicture",
        element_id: @element.id
      },
      options: options
    }
  else
    {
      controller: :essence_pictures,
      action: :assign,
      picture_id: picture_to_assign.id,
      content_id: @content.id,
      options: options
    }
  end
end

#preview_size(size) ⇒ Object



29
30
31
32
33
34
35
36
# File 'app/helpers/alchemy/admin/pictures_helper.rb', line 29

def preview_size(size)
  case size
  when 'small' then '80x60'
  when 'large' then '240x180'
  else
    '160x120'
  end
end