Sha256: a07119e8d719add43b78731bc607a143ef91397b564962bb0dc9fb6222f6db92

Contents?: true

Size: 870 Bytes

Versions: 20

Compression:

Stored size: 870 Bytes

Contents

require 'active_support/concern'

module ResourceRow
  module ActsAsListExtensions
    extend ActiveSupport::Concern

    def acts_as_list(options = {})
      options.reverse_merge!(scope: nil)

      scope = options.delete(:scope)

      scope = "#{scope}_id".intern if scope.is_a?(Symbol) && scope.to_s !~ /_id$/

      data_attributes = {
        'acts-as-list-item':                true,
        'acts-as-list-item-scope':          "#{scope}-#{resource.send(scope)}",
        'acts-as-list-item-uid':            resource.to_param,
        'acts-as-list-item-on-drop-target': h.url_for([:reposition, resource])
      }

      column(:acts_as_list) do |_resource|
        h.content_tag(:span, data: data_attributes, class: 'btn btn-xs btn-default acts-as-list-item') do
          h.tag(:span, class: 'glyphicon glyphicon-sort')
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
itsf_backend-5.0.0.pre app/extensions/concerns/resource_row/acts_as_list_extensions.rb
itsf_backend-4.2.3 app/extensions/concerns/resource_row/acts_as_list_extensions.rb
itsf_backend-4.2.2 app/extensions/concerns/resource_row/acts_as_list_extensions.rb
itsf_backend-4.2.1 app/extensions/concerns/resource_row/acts_as_list_extensions.rb
itsf_backend-4.2.0 app/extensions/concerns/resource_row/acts_as_list_extensions.rb
itsf_backend-4.0.1 app/extensions/concerns/resource_row/acts_as_list_extensions.rb
itsf_backend-4.0.0 app/extensions/concerns/resource_row/acts_as_list_extensions.rb
itsf_backend-3.1.1 app/extensions/concerns/resource_row/acts_as_list_extensions.rb
itsf_backend-3.1.0 app/extensions/concerns/resource_row/acts_as_list_extensions.rb
itsf_backend-3.0.7 app/extensions/concerns/resource_row/acts_as_list_extensions.rb
itsf_backend-3.0.6 app/extensions/concerns/resource_row/acts_as_list_extensions.rb
itsf_backend-3.0.5 app/extensions/concerns/resource_row/acts_as_list_extensions.rb
itsf_backend-3.0.4 app/extensions/concerns/resource_row/acts_as_list_extensions.rb
itsf_backend-3.0.3 app/extensions/concerns/resource_row/acts_as_list_extensions.rb
itsf_backend-3.0.2 app/extensions/concerns/resource_row/acts_as_list_extensions.rb
itsf_backend-3.0.1 app/extensions/concerns/resource_row/acts_as_list_extensions.rb
itsf_backend-3.0.0 app/extensions/concerns/resource_row/acts_as_list_extensions.rb
itsf_backend-2.2.1 app/extensions/concerns/resource_row/acts_as_list_extensions.rb
itsf_backend-2.2.0 app/extensions/concerns/resource_row/acts_as_list_extensions.rb
itsf_backend-2.1.0 app/extensions/concerns/resource_row/acts_as_list_extensions.rb