From 41d598ce5004d23c6af7961284cfd9055297ba09 Mon Sep 17 00:00:00 2001 From: Connor Shea Date: Mon, 1 Aug 2016 13:56:56 -0600 Subject: [PATCH] Initial implementation of an async branch dropdown for Revert and Cherry Pick. --- app/assets/stylesheets/framework/modal.scss | 1 - app/controllers/projects/branches_controller.rb | 7 +++++++ app/views/projects/commit/_change.html.haml | 9 ++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/framework/modal.scss b/app/assets/stylesheets/framework/modal.scss index 26ad2870aa0..8374f30d0b2 100644 --- a/app/assets/stylesheets/framework/modal.scss +++ b/app/assets/stylesheets/framework/modal.scss @@ -1,6 +1,5 @@ .modal-body { position: relative; - overflow-y: auto; padding: 15px; .form-actions { diff --git a/app/controllers/projects/branches_controller.rb b/app/controllers/projects/branches_controller.rb index 48fe81b0d74..462d4e461e1 100644 --- a/app/controllers/projects/branches_controller.rb +++ b/app/controllers/projects/branches_controller.rb @@ -15,6 +15,13 @@ class Projects::BranchesController < Projects::ApplicationController 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.json do + render json: @repository.branch_names.to_json + end + end end def recent diff --git a/app/views/projects/commit/_change.html.haml b/app/views/projects/commit/_change.html.haml index d9b800a4ded..f5407bdbc7b 100644 --- a/app/views/projects/commit/_change.html.haml +++ b/app/views/projects/commit/_change.html.haml @@ -17,7 +17,14 @@ .form-group.branch = label_tag 'target_branch', target_label, class: 'control-label' .col-sm-10 - = select_tag "target_branch", project_branches, class: "select2 select2-sm js-target-branch" + .dropdown + = dropdown_toggle @project.default_branch, { toggle: "dropdown", selected: @project.default_branch, ref: @ref, refs_url: branches_namespace_project_path(@project.namespace, @project) }, { toggle_class: "js-project-refs-dropdown js-target-branch" } + .dropdown-menu.dropdown-menu-selectable + = dropdown_title "Switch branch" + = dropdown_filter "Search branches" + = dropdown_content + = dropdown_loading + - if can?(current_user, :push_code, @project) .js-create-merge-request-container .checkbox