Class: Locomotive::SimpleImageInput

Inherits:
ImageInput
  • Object
show all
Defined in:
app/inputs/locomotive/simple_image_input.rb

Instance Method Summary collapse

Methods inherited from ImageInput

#actions, #default_url, #file?, #file_wrapper_options, #filename_html, #image_html, #input, #resize_format, #resized_file_url, #text

Instance Method Details

#browse_button_htmlObject



10
11
12
13
14
# File 'app/inputs/locomotive/simple_image_input.rb', line 10

def browse_button_html
  <<-EOF
  <span class="file-browse">#{text(:browse)}</span>
  EOF
end

#fileObject



16
17
18
# File 'app/inputs/locomotive/simple_image_input.rb', line 16

def file
  self.object.send(attribute_name.to_sym)
end

#file_inputObject



4
5
6
7
8
# File 'app/inputs/locomotive/simple_image_input.rb', line 4

def file_input
  @builder.file_field(attribute_name, input_html_options.merge(accept: 'image/*')) +
  @builder.hidden_field(:"remove_#{attribute_name}", class: 'remove', value: '0') +
  @builder.hidden_field(:"remote_#{attribute_name}_url", class: 'remote-url', value: '')
end

#file_urlObject



20
21
22
# File 'app/inputs/locomotive/simple_image_input.rb', line 20

def file_url
  file.url
end