BigW Consortium Gitlab

Commit c160aae6 by Phil Hughes

Updated compare dropdowns

Closes #18891
parent ad806f32
...@@ -67,7 +67,7 @@ class @Project ...@@ -67,7 +67,7 @@ class @Project
selectable: true selectable: true
filterable: true filterable: true
filterByText: true filterByText: true
fieldName: 'ref' fieldName: $dropdown.data('field-name')
renderRow: (ref) -> renderRow: (ref) ->
if ref.header? if ref.header?
$('<li />') $('<li />')
...@@ -87,5 +87,6 @@ class @Project ...@@ -87,5 +87,6 @@ class @Project
toggleLabel: (obj, $el) -> toggleLabel: (obj, $el) ->
$el.text().trim() $el.text().trim()
clicked: (e) -> clicked: (e) ->
unless $dropdown.hasClass('js-compare-dropdown')
$dropdown.closest('form').submit() $dropdown.closest('form').submit()
) )
...@@ -48,9 +48,6 @@ ...@@ -48,9 +48,6 @@
border: 1px solid $dropdown-toggle-border-color; border: 1px solid $dropdown-toggle-border-color;
border-radius: $border-radius-base; border-radius: $border-radius-base;
outline: 0; outline: 0;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
.fa { .fa {
position: absolute; position: absolute;
...@@ -61,6 +58,14 @@ ...@@ -61,6 +58,14 @@
font-size: 10px; font-size: 10px;
} }
.dropdown-toggle-text {
display: block;
min-height: 19px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
&:hover, { &:hover, {
border-color: $dropdown-toggle-hover-border-color; border-color: $dropdown-toggle-hover-border-color;
......
...@@ -632,3 +632,21 @@ pre.light-well { ...@@ -632,3 +632,21 @@ pre.light-well {
width: 300px; 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;
}
}
...@@ -3,14 +3,18 @@ ...@@ -3,14 +3,18 @@
- if params[:to] && params[:from] - 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'} = link_to 'switch', {from: params[:to], to: params[:from]}, {class: 'commits-compare-switch has-tooltip', title: 'Switch base of comparison'}
.form-group .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 %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 .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 %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; &nbsp;
= button_tag "Compare", class: "btn btn-create commits-compare-btn" = button_tag "Compare", class: "btn btn-create commits-compare-btn"
- if @merge_request.present? - if @merge_request.present?
...@@ -19,11 +23,3 @@ ...@@ -19,11 +23,3 @@
= link_to create_mr_path, class: 'prepend-left-10 btn' do = link_to create_mr_path, class: 'prepend-left-10 btn' do
= icon("plus") = icon("plus")
Create Merge Request Create Merge Request
:javascript
var availableTags = #{@project.repository.ref_names.to_json};
$("#from, #to").autocomplete({
source: availableTags,
minLength: 1
});
.dropdown-menu.dropdown-menu-selectable
= dropdown_title "Switch branch/tag"
= dropdown_filter "Search branches and tags"
= dropdown_content
= dropdown_loading
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
- @options && @options.each do |key, value| - @options && @options.each do |key, value|
= hidden_field_tag key, value, id: nil = hidden_field_tag key, value, id: nil
.dropdown .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-menu.dropdown-menu-selectable{ class: ("dropdown-menu-align-right" if local_assigns[:align_right]) }
= dropdown_title "Switch branch/tag" = dropdown_title "Switch branch/tag"
= dropdown_filter "Search branches and tags" = dropdown_filter "Search branches and tags"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment