app/helpers/extensions_helper.rb
#
# Generates a link to the current page with a parameter to sort extensions in
# a particular way.
#
# @param linked_text [String] the contents of the +a+ tag
# @param ordering [String] the name of the ordering
#
# @example
#   link_to_sorted_extensions 'Recently Updated', 'recently_updated'
#
# @return [String] the generated anchor tag
#
Generates a link to the current page with a parameter to sort extensions in
a particular way.
Generates a link to the current page with a parameter to sort extensions in a particular way .
def link_to_sorted_extensions(linked_text, ordering)
    if params[:order] == ordering
      link_to linked_text, params.to_unsafe_h.except(:order), class: 'button radius secondary tiny active'
    else
      link_to linked_text, params.to_unsafe_h.merge(order: ordering), class: 'button radius secondary tiny'
    end
  end
def link_to_sorted_extensions ( linked_text , ordering ) if params [ :order ] == ordering link_to linked_text , params . to_unsafe_h . except ( :order ) , class : 'button radius secondary tiny active' else link_to linked_text , params . to_unsafe_h . merge ( order : ordering ) , class : 'button radius secondary tiny' end end
Generates a link to the current page with a parameter to sort extensions in
a particular way.
Generates a link to the current page with a parameter to sort extensions in a particular way .
the generated anchor tag
the generated anchor tag
String
linked_text
the contents of the +a+ tag
the contents of the + a + tag
ordering
the name of the ordering
the name of the ordering
example
link_to_sorted_extensions 'Recently Updated', 'recently_updated'
link_to_sorted_extensions ' Recently Updated ' ' recently_updated '