class HasFilepickerImage::View
Public Class Methods
new(object_name, attribute_name, template, options = {})
click to toggle source
# File lib/has_filepicker_image/view.rb, line 3 def initialize(object_name, attribute_name, template, options = {}) @object_name = object_name @attribute_name = attribute_name @template = template @options = options end
Public Instance Methods
render()
click to toggle source
# File lib/has_filepicker_image/view.rb, line 10 def render buttons + preview + hidden_field end
Private Instance Methods
html_options()
click to toggle source
# File lib/has_filepicker_image/view.rb, line 81 def html_options @options[:html_options] || {} end
object()
click to toggle source
# File lib/has_filepicker_image/view.rb, line 77 def object @options[:object] end
preview()
click to toggle source
# File lib/has_filepicker_image/view.rb, line 24 def preview @template.content_tag(:div, :class => 'filepicker-image', :style => (value.present? ? '' : 'display:none;')) do if value.present? # Render preview + Delete link thumb_url = value + "/convert?w=260&h=180" thumb_alt = "#{@attribute_name} thumbnail" @template.image_tag(thumb_url, alt: thumb_alt ) end end end
value()
click to toggle source
# File lib/has_filepicker_image/view.rb, line 73 def value object.send(@attribute_name) end