Sha256: 0fff4e3ab843c8838ecd8194131c9b5c171e5e331d34a1ee7600faebdd6535dd
Contents?: true
Size: 896 Bytes
Versions: 1
Compression:
Stored size: 896 Bytes
Contents
module SimpleForm module Components module Sortable def sortable(wrapper_options = nil) @sortable ||= begin if sortable? input_html_options[:data] ||= {} input_html_options[:data][:sortable] = true options[:wrapper_html] ||= {} options[:wrapper_html][:class] = "#{options[:wrapper_html][:class]} sortable" if remote? && options[:collection].present? && reflection.present? options[:collection] = Array(object.send(reflection.name)).collect { |a| [a.to_label, a.id, data: { select2_response: a.to_select2_response }] } end end end nil end def sortable? options[:sortable].present? && options.dig(:input_html, :multiple).present? end end end end SimpleForm::Inputs::Base.send(:include, SimpleForm::Components::Sortable)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
forest_cms-0.98.1 | config/initializers/simple_form/sortable.rb |