app/helpers/acts_as_data_table_helper.rb
#
# Generates a link to add/remove a certain scope filter
#
# @param [Hash] options
#   Options to customize the generated link
#
# @option options [String, Symbol] :scope
#   The scope within the given +group+ to be added/removed
#
# @option options [TrueClass, FalseClass] :toggle (false)
#   If set to +true+, the link will automatically remove the filter
#   if it's currently active without having to explicitly set +:remove+
#
# @option options [TrueClass, FalseClass] :remove (false)
#   If set to +true+, the link will always attempt to remove
#   the given +:scope+ within the given +group+ and cannot be used
#   to add it.
#
Generates a link to add/remove a certain scope filter
Generates a link to add / remove a certain scope filter
def scope_filter_link(group, scope, options = {})
    caption         = options.delete(:caption) || scope_filter_caption(group, scope, options[:args])
    surrounding_tag = options.delete(:surrounding)
    remote          = options.delete(:remote)
    args            = options[:args]
    url             = scope_filter_link_url(group, scope, options)
    classes = options[:class].try(:split, ' ') || []
    classes << 'active' if scope && acts_as_data_table_session.active_filter?(group, scope, args)
    options[:class] = classes.join(' ')
    if remote
      link = link_to_remote caption, :url => url, :method => :get, :html => options
    else
      link = link_to caption, url, options
    end
    surrounding_tag ? content_tag(surrounding_tag, link, :class => options[:class]) : link
  end
def scope_filter_link ( group , scope , options = { } ) caption = options . delete ( :caption ) || scope_filter_caption ( group , scope , options [ :args ] ) surrounding_tag = options . delete ( :surrounding ) remote = options . delete ( :remote ) args = options [ :args ] url = scope_filter_link_url ( group , scope , options ) classes = options [ :class ] . try ( :split , ' ' ) || [ ] classes << 'active' if scope && acts_as_data_table_session . active_filter? ( group , scope , args ) options [ :class ] = classes . join ( ' ' ) if remote link = link_to_remote caption , :url => url , :method => :get , :html => options else link = link_to caption , url , options end surrounding_tag ? content_tag ( surrounding_tag , link , :class => options [ :class ] ) : link end
Generates a link to add/remove a certain scope filter
Generates a link to add / remove a certain scope filter
group
scope
options
:remove (false) If set to +true+, the link will always attempt to remove the given +:scope+ within the given +group+ and cannot be used to add it.
: remove ( false ) If set to + true + the link will always attempt to remove the given + : scope + within the given + group + and cannot be used to add it .
options Options to customize the generated link
options Options to customize the generated link