suite
This commit is contained in:
parent
93018cb083
commit
f29600e9d8
@ -7,11 +7,15 @@ class QiImageSelectInput < Formtastic::Inputs::TextInput
|
|||||||
|
|
||||||
|
|
||||||
label_html +
|
label_html +
|
||||||
template.content_tag(:fieldset, image_preview(method, options, r) + builder.hidden_field(method.to_s, input_html_options.merge!(:id => "input_"+r.to_s)) )
|
template.content_tag(:fieldset, image_preview(method, options, r) + remove_image_link(method, options, r) + builder.hidden_field(method.to_s, input_html_options.merge!(:id => "input_"+r.to_s)) )
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def remove_image_link(method, options, r)
|
||||||
|
template.content_tag(:a, "Supprimer", :href => "#", :onclick => "remove_image_cible('"+r.to_s+"');return false;")
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
def manager_select_link(method, options, r)
|
def manager_select_link(method, options, r)
|
||||||
template.content_tag(:a, "Modifier cette image", :href => "#", :onclick => "select_image_from_manager('"+r.to_s+"');return false;")
|
template.content_tag(:a, "Modifier cette image", :href => "#", :onclick => "select_image_from_manager('"+r.to_s+"');return false;")
|
||||||
@ -19,7 +23,7 @@ class QiImageSelectInput < Formtastic::Inputs::TextInput
|
|||||||
|
|
||||||
def image_preview(method, options,r)
|
def image_preview(method, options,r)
|
||||||
if object.send("#{method}?") and ImageFile.exists?(object.send("#{method}"))
|
if object.send("#{method}?") and ImageFile.exists?(object.send("#{method}"))
|
||||||
template.content_tag(:span, template.image_tag(object.image_file.file.large.medium.small.thumb.url, :id => "img_"+r.to_s, :onclick => "select_image_from_manager('"+r.to_s+"');return false;"), :class => "preview ")
|
template.content_tag(:span, template.image_tag(eval("object.#{method[0..-4]}.file.large.medium.small.thumb.url"), :id => "img_"+r.to_s, :onclick => "select_image_from_manager('"+r.to_s+"');return false;"), :class => "preview ")
|
||||||
else
|
else
|
||||||
template.content_tag(:span, template.image_tag("admin/default_image.png", :id => "img_"+r.to_s, :onclick => "select_image_from_manager('"+r.to_s+"');return false;"), :class => "preview ")
|
template.content_tag(:span, template.image_tag("admin/default_image.png", :id => "img_"+r.to_s, :onclick => "select_image_from_manager('"+r.to_s+"');return false;"), :class => "preview ")
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user