fixes #1537
fixes #1467
Don't affect location hash when changing setting tabs
fixes #1576

The "params[:order] ||= params.delete(:sort)" is to support existing
links using sort.