Merge branch 'fix-branches-dropdown-initial-state' into 'master'

Fix branches page dropdown sort initial state

## What does this MR do?
Add 'Name' as the initial state for the branches dropdown filter

## Are there points in the code the reviewer needs to double check?
Shouldn't be

## Why was this MR needed?
Prevent dropdown from being rendered without an initial state

## What are the relevant issue numbers?
Closes #20753 

## Screenshots (if relevant)
Before:
![Screen_Shot_2016-08-10_at_2.26.59_PM](/uploads/e13725c90d1e870e0b08c3bff9234c4e/Screen_Shot_2016-08-10_at_2.26.59_PM.png)

After:
![Screen_Shot_2016-08-10_at_2.26.45_PM](/uploads/cd4957902ee1ebb74ac6e93b18c8ed02/Screen_Shot_2016-08-10_at_2.26.45_PM.png)

## Does this MR meet the acceptance criteria?

- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- Tests
  - [x] All builds are passing
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

See merge request !5761
This commit is contained in:
Rémy Coutable 2016-08-11 08:29:59 +00:00
commit b6c9567adb
2 changed files with 3 additions and 1 deletions

View file

@ -24,6 +24,7 @@ v 8.11.0 (unreleased)
- Add "No one can push" as an option for protected branches. !5081
- Improve performance of AutolinkFilter#text_parse by using XPath
- Add experimental Redis Sentinel support !1877
- Fix branches page dropdown sort initial state (ClemMakesApps)
- Environments have an url to link to
- Update `timeago` plugin to use multiple string/locale settings
- Remove unused images (ClemMakesApps)

View file

@ -1,12 +1,13 @@
class Projects::BranchesController < Projects::ApplicationController
include ActionView::Helpers::SanitizeHelper
include SortingHelper
# Authorize
before_action :require_non_empty_project
before_action :authorize_download_code!
before_action :authorize_push_code!, only: [:new, :create, :destroy]
def index
@sort = params[:sort].presence || 'name'
@sort = params[:sort].presence || sort_value_name
@branches = BranchesFinder.new(@repository, params).execute
@branches = Kaminari.paginate_array(@branches).page(params[:page])