BigW Consortium Gitlab

Commit f774949d by Dmitriy Zaporozhets

Compare page improved

* Show new merge request button from compare page * Show message if user selected same branches * Show message if compared branches are the same * Prepend inputs with from/to labels
parent edb3368c
...@@ -6,10 +6,9 @@ form { ...@@ -6,10 +6,9 @@ form {
} }
} }
input { input.input-xpadding,
&.input-xpadding { .add-on.input-xpadding {
padding: 6px 10px; padding: 6px 10px;
}
} }
.control-group { .control-group {
......
module CompareHelper
def compare_to_mr_button?
params[:from].present? && params[:to].present? &&
@repository.branch_names.include?(params[:from]) &&
@repository.branch_names.include?(params[:to]) &&
!@refs_are_same
end
def compare_mr_path
new_project_merge_request_path(@project, merge_request: {source_branch: params[:from], target_branch: params[:to]})
end
end
%div = form_tag project_compare_index_path(@project), method: :post do
- unless params[:to] .clearfix
%p.slead .pull-left
Fill input field with commit id like - if params[:to] && params[:from]
%code.label-branch 4eedf23 = link_to 'switch', {from: params[:to], to: params[:from]}, {class: 'commits-compare-switch has_tooltip', title: 'Switch base of comparison'}
or branch/tag name like .input-prepend
%code.label-branch master %span.add-on.input-xpadding from
and press compare button for the commits list and a code diff. = text_field_tag :from, params[:from], class: "span3 input-xpadding"
%br = "..."
Changes are shown <b>from</b> the version in the first field <b>to</b> the version in the second field. .input-prepend
%span.add-on.input-xpadding to
= text_field_tag :to, params[:to], class: "span3 input-xpadding"
= form_tag project_compare_index_path(@project), method: :post do .pull-left
.clearfix &nbsp;
.pull-left = submit_tag "Compare", class: "btn btn-create commits-compare-btn"
- if params[:to] && params[:from] - if compare_to_mr_button?
= link_to 'switch', {from: params[:to], to: params[:from]}, {class: 'commits-compare-switch has_tooltip', title: 'Switch base of comparison'} = link_to compare_mr_path, class: 'prepend-left-10' do
= text_field_tag :from, params[:from], placeholder: "from", class: "input-xlarge input-xpadding" %strong Make a merge request
= "..."
= text_field_tag :to, params[:to], placeholder: "to", class: "input-xlarge input-xpadding"
.pull-left
&nbsp;
= submit_tag "Compare", class: "btn btn-create commits-compare-btn"
- if @refs_are_same
.alert
%span Refs are the same
:javascript :javascript
......
...@@ -2,5 +2,15 @@ ...@@ -2,5 +2,15 @@
%h3.page-title %h3.page-title
Compare View Compare View
%p.slead
Compare branches, tags or commit ranges.
%br
Fill input field with commit id like
%code.label-branch 4eedf23
or branch/tag name like
%code.label-branch master
and press compare button for the commits list and a code diff.
%br
Changes are shown <b>from</b> the version in the first field <b>to</b> the version in the second field.
= render "form" = render "form"
...@@ -20,3 +20,16 @@ ...@@ -20,3 +20,16 @@
- unless @diffs.empty? - unless @diffs.empty?
%h4 Diff %h4 Diff
= render "projects/commits/diffs", diffs: @diffs, project: @project = render "projects/commits/diffs", diffs: @diffs, project: @project
- else
.light-well
%center
%h4
There isn't anything to compare.
%p.slead
- if params[:to] == params[:from]
You'll need to use different branch names to get a valid comparison.
- else
%span.label-branch #{params[:from]}
and
%span.label-branch #{params[:to]}
are the same.
...@@ -67,8 +67,8 @@ ...@@ -67,8 +67,8 @@
event.preventDefault(); event.preventDefault();
} }
}) })
.bind( "click", function( event ) { .bind("click", function(event) {
$( this ).autocomplete("search", ""); $(this).autocomplete("search", "");
}) })
.autocomplete({ .autocomplete({
minLength: 0, minLength: 0,
......
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