quartz_app/app/inputs/qi_video_select_input.rb
Caroline Girard 37d278a7da initial
2018-09-13 13:32:45 +02:00

36 lines
1.2 KiB
Ruby

class QiVideoSelectInput < Formtastic::Inputs::TextInput
include FormtasticBootstrap::Inputs::Base
def to_html
r = rand(1000000000000000000000000000)
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)) )
end
def manager_select_link(method, options, r)
template.content_tag(:a, "Modifier cette video", :href => "#", :style => "background:black;min-width:100px;min-height:100px;", :onclick => "select_video_from_manager('"+r.to_s+"');return false;")
end
def image_preview(method, options,r)
# if object.send("#{method}?") and VideoFile.exists?(object.send("#{method}"))
# template.content_tag(:span, template.image_tag(object.video_file.poster.large.medium.small.thumb.url, :id => "img_"+r.to_s, :style => "background:black;min-width:100px;min-height:100px;", :onclick => "select_video_from_manager('"+r.to_s+"');return false;"), :class => "preview ")
#else
template.content_tag(:span, template.image_tag("admin/default_image.png", :id => "img_"+r.to_s, :onclick => "select_video_from_manager('"+r.to_s+"');return false;"), :class => "preview ")
#end
end
end