Module: SimpleFormAttachments

Defined in:
lib/simple_form_attachments.rb,
lib/simple_form_attachments/engine.rb,
lib/simple_form_attachments/version.rb,
lib/simple_form_attachments/configuration.rb,
lib/simple_form_attachments/attachment_input.rb,
app/models/concerns/simple_form_attachments/attachment.rb,
app/controllers/simple_form_attachments/upload_controller.rb,
app/models/concerns/simple_form_attachments/has_attachments.rb

Overview


Defined Under Namespace

Modules: Attachment, HasAttachments Classes: AttachmentInput, Configuration, Engine, UploadController

Constant Summary collapse

VERSION =
'1.2.0'.freeze

Class Method Summary collapse

Class Method Details

.dom_class(*args) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/simple_form_attachments.rb', line 19

def self.dom_class(*args)
  prefix, alts = args.partition { |i| !i.is_a?(Array) }
  prefix = ['simple_form_attachments'] + prefix
  return prefix.compact.join('__') if alts.empty?
  alts.flatten.map do |item|
    prefix += [item]
    prefix.compact.join('__')
  end
end

.jquery_ui_asset(asset) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/simple_form_attachments.rb', line 29

def self.jquery_ui_asset(asset)
  jquery_ui_version = Gem::Version.new(Jquery::Ui::Rails::JQUERY_UI_VERSION)
  case
  when Gem::Dependency.new('', '< 1.12').match?('', jquery_ui_version) then "jquery-ui/#{asset}"
  when Gem::Dependency.new('', '>= 1.12').match?('', jquery_ui_version) then "jquery-ui/widgets/#{asset}"
  else raise "This version of jQuery UI is not supported"
  end
end