app/helpers/projects_helper.rb
# Return HTML for a sortable header.
Return HTML for a sortable header.
Return HTML for a sortable header .
def sortable_header(title, field_name)
    new_params = params.merge(sort: field_name)
                       .permit(ProjectsController::ALLOWED_QUERY_PARAMS)
    if params[:sort] == field_name && params[:sort_direction] != 'desc'
      new_params[:sort_direction] = 'desc'
    else
      new_params.delete(:sort_direction)
    end
    "<a href=\"#{url_for(new_params)}\" rel=\"nofollow\">#{title}</a>".html_safe
  end
def sortable_header ( title , field_name ) new_params = params . merge ( sort : field_name ) . permit ( ProjectsController :: ALLOWED_QUERY_PARAMS ) if params [ :sort ] == field_name && params [ :sort_direction ] != 'desc' new_params [ :sort_direction ] = 'desc' else new_params . delete ( :sort_direction ) end "<a href=\"#{url_for(new_params)}\" rel=\"nofollow\">#{title}</a>" . html_safe end
Return HTML for a sortable header.
Return HTML for a sortable header .
# The html_safe assertion here allows the HTML of # <a href...> to go through.  This *is* handled for security; # params.merge performs the URL encoding as required, and "title" is # trusted (it's provided by the code, not by a potential attacker). # We use "nofollow" to discourage search engines from following it # rubocop:disable Rails/OutputSafety # rubocop:enable Rails/OutputSafety
title
<not_specific>
field_name
<not_specific>