Module: Para::OrderingHelper

Defined in:
app/helpers/para/ordering_helper.rb

Instance Method Summary collapse

Instance Method Details

#reorder_anchor(options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/helpers/para/ordering_helper.rb', line 3

def reorder_anchor(options = {})
  options[:class] ||= ''
  options[:class] = [options[:class], 'order-anchor'].join(' ')

  field = if (form = options.delete(:form))
    form.hidden_field(:position, class: 'resource-position-field')
  else
    value = options.delete(:value) || 0
    hidden_field_tag(:position, value, class: 'resource-position-field')
  end

  (:span, options) do
    (:i, '', class: 'sort-dots') +
    field
  end
end