diff options
author | Jacopo <beschi.jacopo@gmail.com> | 2016-12-22 09:21:40 +0300 |
---|---|---|
committer | Jacopo <beschi.jacopo@gmail.com> | 2017-03-13 18:36:11 +0300 |
commit | e0fe2834ebe6d9678444c8a10b79ca093f944232 (patch) | |
tree | a2d7c482f7271d8af7ba47e76c9d48a1d3e357f4 /app/controllers/projects/branches_controller.rb | |
parent | 9ed3db915026c6e0cd266a1c276386e3e96d2151 (diff) |
New file from interface on existing branch
Now you can create a new file and select a target_branch != source_branch.
If the file that you want to create already exists on the target branch an error message is shown
A glDropdown is used to select and create a new branch instead of a text field.
Diffstat (limited to 'app/controllers/projects/branches_controller.rb')
-rw-r--r-- | app/controllers/projects/branches_controller.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/app/controllers/projects/branches_controller.rb b/app/controllers/projects/branches_controller.rb index c40f9b7f75f..22714d9c5a4 100644 --- a/app/controllers/projects/branches_controller.rb +++ b/app/controllers/projects/branches_controller.rb @@ -10,15 +10,16 @@ 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 + @branches = Kaminari.paginate_array(@branches).page(params[:page]) unless params[:show_all].present? respond_to do |format| - format.html + format.html do + @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 render json: @branches.map(&:name) end |