class Interview::ImageAttribute
Attributes
hide_if_not_exists[RW]
image_style[RW]
object[RW]
Protected Instance Methods
build_read(b)
click to toggle source
# File lib/interview/controls/image_attribute.rb, line 15 def build_read(b) image_style = @image_style || :thumb html_class = @html_class html_class << "image_#{image_style}" return if value.nil? and @hide_if_not_exists b.section html_class: html_class, html_options: @html_options do if value b << h.image_tag(value.url(image_style), class: 'image img-responsive') else b << h.image_tag('missing_thumb.png', class: 'image img-responsive') end end end
build_write(b)
click to toggle source
# File lib/interview/controls/image_attribute.rb, line 31 def build_write(b) image_style = @image_style || :thumb b.section html_class: 'image_attribute_container' do unless value.nil? and @hide_if_not_exists b.section html_class: 'inline-block' do b << h.image_tag(value.url(image_style), class: 'image img-responsive') end end b.section html_class: 'inline-block' do b.section html_class: "clearfix" do b.section style: 'span', html_class: "btn btn-default fileinput-button" do b.text text: "Bild hochladen", style: 'span' # todo b << h.file_field_tag("upload_buffer[attachment]", class: 'upload_image', data: {url: "/upload_buffers.json", type: 'POST'}) end end b.progress_bar hidden: true b << form_builder.hidden_field(:upload_buffer_id, class: 'upload_buffer_id') # if attachment.exists? # b << form_builder.check_box("destroy_#{@method}") # b.text text: ' Datei löschen' # end end end end