Module: Editables::ApplicationHelper

Defined in:
app/helpers/editables/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#cloudinary_path(field, image_method = :image) ⇒ Object



16
17
18
19
# File 'app/helpers/editables/application_helper.rb', line 16

def cloudinary_path(field, image_method = :image)
  return cl_image_path(field.send(image_method).key) if field.send(image_method).attached?
  "https://res.cloudinary.com/dockcyr0z/image/upload/v1598369435/vb13pcfoit64mylb2zzob0pzbt1n.jpg"
end

#data_editables(data_editable, editable_kind = :text) ⇒ Object



21
22
23
# File 'app/helpers/editables/application_helper.rb', line 21

def data_editables(data_editable, editable_kind = :text)
  "data-editablemodel=#{data_editable.model} data-editableroute=#{data_editable.route} data-editableparam=#{data_editable.param} data-editablekind=#{editable_kind}" if current_admin
end

#editable_image_classObject



7
8
9
# File 'app/helpers/editables/application_helper.rb', line 7

def editable_image_class
  'editable-image' if current_admin
end

#editable_text_classObject



3
4
5
# File 'app/helpers/editables/application_helper.rb', line 3

def editable_text_class
  'editable editable-text' if current_admin
end

#url_for_image(field, image_method = :image) ⇒ Object



11
12
13
14
# File 'app/helpers/editables/application_helper.rb', line 11

def url_for_image(field, image_method = :image)
  return url_for(field.send(image_method)) if field.send(image_method).attached?
  "https://res.cloudinary.com/dockcyr0z/image/upload/v1598369435/vb13pcfoit64mylb2zzob0pzbt1n.jpg"
end