class FileInput < FormtasticBootstrap::Inputs::FileInput def to_html generic_input_wrapping do attachment = object.send(method) if !attachment.exists? <<-eos (#{I18n.t('fullstack.admin.no_file_uploaded', :default => "No file uploaded")}) #{I18n.t('fullstack.admin.choose_a_file', :default => "Choose a file")} eos else preview_menu = "" preview_menu << template.content_tag(:li, template.link_to(I18n.t('fullstack.admin.original', :default => "Original"), attachment.url(:original), :target => "_blank" )) preview_menu << template.content_tag(:li, "", :class => :divider) if !attachment.styles.empty? attachment.styles.map do |name, decl| preview_menu << template.content_tag(:li, template.link_to(name.to_s.humanize, attachment.url(name), :target => "_blank")) end <<-eos #{template.send(:html_escape, attachment.url.split("/").last.split("?").first)} #{I18n.t('fullstack.admin.change', :default => "Change")} #{I18n.t('fullstack.admin.preview', :default => "Preview")} #{template.button( I18n.t('fullstack.admin.delete', :default => "Delete"), "javascript:void(0)", :type => :danger, :class => "file-input-delete-attachment-button btn-small", :"data-toggle" => :button )} eos end.html_safe << builder.file_field(method, :style => "display:none;") << (builder.check_box("#{method}_delete", :class => "file-input-delete-attachment-checkbox", :style => "display:none;") if attachment.exists?) end end end