class Formtastic::Inputs::JcropableInput

Constants

VALID_OPTIONS

Public Instance Methods

to_html() click to toggle source
# File lib/formtastic/inputs/jcrop_input.rb, line 21
def to_html
  input_wrapping do
    label_html <<
    builder.file_field(method, input_html_options) <<
    jcrop_feature
  end
end

Private Instance Methods

jcrop_feature() click to toggle source
# File lib/formtastic/inputs/jcrop_input.rb, line 31
def jcrop_feature
  if @object.send(method).present?
    template.render(partial: "active_admin_jcrop/jcrop_modal", locals: {field: method, object: @object, jcrop_options: jcrop_options})
  else
    ''
  end
end
jcrop_options() click to toggle source
# File lib/formtastic/inputs/jcrop_input.rb, line 39
def jcrop_options
  options[:jcrop_options] ||= {}
  options[:jcrop_options].assert_valid_keys(*VALID_OPTIONS)
  options[:jcrop_options].reverse_merge!(setSelect: [0,0,100,100])
end