BigW Consortium Gitlab

Commit c160aae6 by Phil Hughes

Updated compare dropdowns

Closes #18891
parent ad806f32
......@@ -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()
)
......@@ -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;
......
......@@ -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;
}
}
......@@ -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
});
.dropdown-menu.dropdown-menu-selectable
= dropdown_title "Switch branch/tag"
= dropdown_filter "Search branches and tags"
= dropdown_content
= dropdown_loading
......@@ -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"
......
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