class RailsAdmin::Config::Fields::Types::RichPicker

Public Instance Methods

editor_options() click to toggle source
# File lib/rich/rails_admin/config/fields/types/rich_picker.rb, line 23
def editor_options
  Rich.options(config, scope_type, scope_id)
end
preview_image_path() click to toggle source
# File lib/rich/rails_admin/config/fields/types/rich_picker.rb, line 27
def preview_image_path
  if value.to_s.html_safe != ""
    if (true if Float(value) rescue false)
      # if the value is numeric we assume its an object id
      rich_file = Rich::RichFile.find(value)
      rich_file.rich_file.url(:rich_thumb)
    else
      # if not, we assume its a url
      value.to_s
    end
  else
    # no value, show placeholder image
    editor_options[:placeholder_image]
  end

end
scope_id() click to toggle source
# File lib/rich/rails_admin/config/fields/types/rich_picker.rb, line 19
def scope_id
  bindings[:object].id
end
scope_type() click to toggle source
# File lib/rich/rails_admin/config/fields/types/rich_picker.rb, line 15
def scope_type
  bindings[:form].object_name
end