diff options
author | Dimitrie Hoekstra <dimitrie@gitlab.com> | 2017-03-17 17:04:51 +0000 |
---|---|---|
committer | Dimitrie Hoekstra <dimitrie@gitlab.com> | 2017-03-17 17:04:51 +0000 |
commit | b6bab6ce47813c67ea1e2c7d4fde7d9e320da99c (patch) | |
tree | 6c1b7db2aeebc5756c73842cffef22df655cc820 /app/controllers/projects/branches_controller.rb | |
parent | 116efdaf128ddcccc30fb82615cd964b35cacc53 (diff) | |
parent | bb1620aaf712c22c61fda098260f481ad79a05e2 (diff) | |
download | gitlab-ce-focus-mode-board.tar.gz |
Merge branch 'master' into 'focus-mode-board'focus-mode-board
# Conflicts:
# app/views/shared/issuable/_filter.html.haml
Diffstat (limited to 'app/controllers/projects/branches_controller.rb')
-rw-r--r-- | app/controllers/projects/branches_controller.rb | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/app/controllers/projects/branches_controller.rb b/app/controllers/projects/branches_controller.rb index c40f9b7f75f..840405f38cb 100644 --- a/app/controllers/projects/branches_controller.rb +++ b/app/controllers/projects/branches_controller.rb @@ -10,16 +10,19 @@ class Projects::BranchesController < Projects::ApplicationController def index @sort = params[:sort].presence || sort_value_name @branches = BranchesFinder.new(@repository, params).execute - @branches = Kaminari.paginate_array(@branches).page(params[:page]) - - @max_commits = @branches.reduce(0) do |memo, branch| - diverging_commit_counts = repository.diverging_commit_counts(branch) - [memo, diverging_commit_counts[:behind], diverging_commit_counts[:ahead]].max - end respond_to do |format| - format.html + format.html do + paginate_branches + @refs_pipelines = @project.pipelines.latest_successful_for_refs(@branches.map(&:name)) + + @max_commits = @branches.reduce(0) do |memo, branch| + diverging_commit_counts = repository.diverging_commit_counts(branch) + [memo, diverging_commit_counts[:behind], diverging_commit_counts[:ahead]].max + end + end format.json do + paginate_branches unless params[:show_all] render json: @branches.map(&:name) end end @@ -90,6 +93,10 @@ class Projects::BranchesController < Projects::ApplicationController end end + def paginate_branches + @branches = Kaminari.paginate_array(@branches).page(params[:page]) + end + def url_to_autodeploy_setup(project, branch_name) namespace_project_new_blob_path( project.namespace, |