Sha256: b8b05012fcb85768e5423082903b10d89716ca0b5f9f2298f55070d9d0e3105f

Contents?: true

Size: 801 Bytes

Versions: 8

Compression:

Stored size: 801 Bytes

Contents

module ActiveScaffold::Helpers
  module SortableHelpers
    def sort_params
      options = {
        :tag => 'tr', 
        :url => {:action => :reorder, :controller => controller_name },
        :format => '/^[^_-](?:[A-Za-z0-9_-]*)-(.*)-row$/',
        :with => "Sortable.serialize(#{active_scaffold_tbody_id.to_json})"
      }
      additional_params = [:parent_controller, :eid, :controller].reject {|param| params[param].blank?}
      options[:with] = additional_params.inject(options[:with]) do |string, param|
        "#{string} + '&#{param}=' + encodeURIComponent('#{escape_javascript params[param]}')"
      end
      options.merge! active_scaffold_config.sortable.options

      [active_scaffold_tbody_id, options]
    end

    def list_row_class(record)
      'sortable'
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
active_scaffold_sortable_vho-3.1.1 lib/active_scaffold/helpers/sortable_helpers.rb
active_scaffold_sortable_vho-3.1.0 lib/active_scaffold/helpers/sortable_helpers.rb
active_scaffold_sortable-3.1.2 lib/active_scaffold/helpers/sortable_helpers.rb
active_scaffold_sortable-3.1.1 lib/active_scaffold/helpers/sortable_helpers.rb
active_scaffold_sortable-3.1.0 lib/active_scaffold/helpers/sortable_helpers.rb
active_scaffold_sortable-3.0.2 lib/active_scaffold/helpers/sortable_helpers.rb
active_scaffold_sortable_vho-3.0.1 lib/active_scaffold/helpers/sortable_helpers.rb
active_scaffold_sortable_vho-3.0.0 lib/active_scaffold/helpers/sortable_helpers.rb