summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/assets/javascripts/project.js.coffee5
-rw-r--r--app/assets/stylesheets/framework/dropdowns.scss11
-rw-r--r--app/assets/stylesheets/pages/projects.scss18
-rw-r--r--app/views/projects/compare/_form.html.haml20
-rw-r--r--app/views/projects/compare/_ref_dropdown.html.haml5
-rw-r--r--app/views/shared/_ref_switcher.html.haml2
6 files changed, 43 insertions, 18 deletions
diff --git a/app/assets/javascripts/project.js.coffee b/app/assets/javascripts/project.js.coffee
index 3288c801388..01b08103dcb 100644
--- a/app/assets/javascripts/project.js.coffee
+++ b/app/assets/javascripts/project.js.coffee
@@ -67,7 +67,7 @@ class @Project
selectable: true
filterable: true
filterByText: true
- fieldName: 'ref'
+ fieldName: $dropdown.data('field-name')
renderRow: (ref) ->
if ref.header?
$('<li />')
@@ -87,5 +87,6 @@ class @Project
toggleLabel: (obj, $el) ->
$el.text().trim()
clicked: (e) ->
- $dropdown.closest('form').submit()
+ unless $dropdown.hasClass('js-compare-dropdown')
+ $dropdown.closest('form').submit()
)
diff --git a/app/assets/stylesheets/framework/dropdowns.scss b/app/assets/stylesheets/framework/dropdowns.scss
index d4e900f80ef..f4edafb2560 100644
--- a/app/assets/stylesheets/framework/dropdowns.scss
+++ b/app/assets/stylesheets/framework/dropdowns.scss
@@ -48,9 +48,6 @@
border: 1px solid $dropdown-toggle-border-color;
border-radius: $border-radius-base;
outline: 0;
- text-overflow: ellipsis;
- white-space: nowrap;
- overflow: hidden;
.fa {
position: absolute;
@@ -61,6 +58,14 @@
font-size: 10px;
}
+ .dropdown-toggle-text {
+ display: block;
+ min-height: 19px;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ overflow: hidden;
+ }
+
&:hover, {
border-color: $dropdown-toggle-hover-border-color;
diff --git a/app/assets/stylesheets/pages/projects.scss b/app/assets/stylesheets/pages/projects.scss
index bce4aac3334..4e722542fc6 100644
--- a/app/assets/stylesheets/pages/projects.scss
+++ b/app/assets/stylesheets/pages/projects.scss
@@ -632,3 +632,21 @@ pre.light-well {
width: 300px;
}
}
+
+.compare-input-group {
+ &.input-group .input-group-addon {
+ @media (min-width: $screen-sm-min) {
+ width: 1%;
+ }
+ }
+
+ .dropdown-menu-toggle {
+ width: 100%;
+ border-top-left-radius: 0;
+ border-bottom-left-radius: 0;
+ }
+
+ .dropdown-menu {
+ width: 300px;
+ }
+}
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"
&nbsp;
= 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
diff --git a/app/views/shared/_ref_switcher.html.haml b/app/views/shared/_ref_switcher.html.haml
index ea7162d4d63..73e805ffea4 100644
--- a/app/views/shared/_ref_switcher.html.haml
+++ b/app/views/shared/_ref_switcher.html.haml
@@ -6,7 +6,7 @@
- @options && @options.each do |key, value|
= hidden_field_tag key, value, id: nil
.dropdown
- = dropdown_toggle dropdown_toggle_text, { toggle: "dropdown", selected: dropdown_toggle_text, ref: @ref, refs_url: refs_namespace_project_path(@project.namespace, @project) }, { toggle_class: "js-project-refs-dropdown" }
+ = dropdown_toggle dropdown_toggle_text, { toggle: "dropdown", selected: dropdown_toggle_text, field_name: 'ref', ref: @ref, refs_url: refs_namespace_project_path(@project.namespace, @project) }, { toggle_class: "js-project-refs-dropdown" }
.dropdown-menu.dropdown-menu-selectable{ class: ("dropdown-menu-align-right" if local_assigns[:align_right]) }
= dropdown_title "Switch branch/tag"
= dropdown_filter "Search branches and tags"