From c160aae6269720b6c2f33de0c4b5c04000f3c745 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Fri, 24 Jun 2016 10:06:57 +0100 Subject: Updated compare dropdowns Closes #18891 --- app/views/projects/compare/_form.html.haml | 20 ++++++++------------ app/views/projects/compare/_ref_dropdown.html.haml | 5 +++++ 2 files changed, 13 insertions(+), 12 deletions(-) create mode 100644 app/views/projects/compare/_ref_dropdown.html.haml (limited to 'app/views/projects') diff --git a/app/views/projects/compare/_form.html.haml b/app/views/projects/compare/_form.html.haml index dd590a4b8ec..ea9e99ac518 100644 --- a/app/views/projects/compare/_form.html.haml +++ b/app/views/projects/compare/_form.html.haml @@ -3,14 +3,18 @@ - if params[:to] && params[:from] = link_to 'switch', {from: params[:to], to: params[:from]}, {class: 'commits-compare-switch has-tooltip', title: 'Switch base of comparison'} .form-group - .input-group.inline-input-group + = hidden_field_tag :from, params[:from] + .input-group.inline-input-group.compare-input-group.dropdown %span.input-group-addon from - = text_field_tag :from, params[:from], class: "form-control", required: true + = dropdown_toggle h(params[:from].presence || ''), { toggle: "dropdown", refs_url: refs_namespace_project_path(@project.namespace, @project), field_name: 'from', selected: params[:from] }, { toggle_class: "js-project-refs-dropdown js-compare-dropdown" } + = render "ref_dropdown" = "..." .form-group - .input-group.inline-input-group + = hidden_field_tag :to, params[:to] + .input-group.inline-input-group.compare-input-group.dropdown %span.input-group-addon to - = text_field_tag :to, params[:to], class: "form-control", required: true + = dropdown_toggle h(params[:from].presence || ''), { toggle: "dropdown", refs_url: refs_namespace_project_path(@project.namespace, @project), field_name: 'to', selected: params[:to] }, { toggle_class: "js-project-refs-dropdown js-compare-dropdown" } + = render "ref_dropdown"   = button_tag "Compare", class: "btn btn-create commits-compare-btn" - if @merge_request.present? @@ -19,11 +23,3 @@ = link_to create_mr_path, class: 'prepend-left-10 btn' do = icon("plus") Create Merge Request - -:javascript - var availableTags = #{@project.repository.ref_names.to_json}; - - $("#from, #to").autocomplete({ - source: availableTags, - minLength: 1 - }); diff --git a/app/views/projects/compare/_ref_dropdown.html.haml b/app/views/projects/compare/_ref_dropdown.html.haml new file mode 100644 index 00000000000..30340db469a --- /dev/null +++ b/app/views/projects/compare/_ref_dropdown.html.haml @@ -0,0 +1,5 @@ +.dropdown-menu.dropdown-menu-selectable + = dropdown_title "Switch branch/tag" + = dropdown_filter "Search branches and tags" + = dropdown_content + = dropdown_loading -- cgit v1.2.1