summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-09-12 20:15:10 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-09-12 20:15:10 +0300
commitf774949d3f7676f925c7fc858d462ec2400e43a2 (patch)
tree14633263c1c54f5483be8e4f283ec301fd5abeed
parentedb3368c93c6ff64840ef5cd12f2af30b18b5b52 (diff)
downloadgitlab-ce-f774949d3f7676f925c7fc858d462ec2400e43a2.tar.gz
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
-rw-r--r--app/assets/stylesheets/gitlab_bootstrap/forms.scss7
-rw-r--r--app/helpers/compare_helper.rb12
-rw-r--r--app/views/projects/compare/_form.html.haml45
-rw-r--r--app/views/projects/compare/index.html.haml10
-rw-r--r--app/views/projects/compare/show.html.haml13
-rw-r--r--app/views/projects/issues/_form.html.haml4
6 files changed, 58 insertions, 33 deletions
diff --git a/app/assets/stylesheets/gitlab_bootstrap/forms.scss b/app/assets/stylesheets/gitlab_bootstrap/forms.scss
index 020a0bf7fd5..a2612166c78 100644
--- a/app/assets/stylesheets/gitlab_bootstrap/forms.scss
+++ b/app/assets/stylesheets/gitlab_bootstrap/forms.scss
@@ -6,10 +6,9 @@ form {
}
}
-input {
- &.input-xpadding {
- padding: 6px 10px;
- }
+input.input-xpadding,
+.add-on.input-xpadding {
+ padding: 6px 10px;
}
.control-group {
diff --git a/app/helpers/compare_helper.rb b/app/helpers/compare_helper.rb
new file mode 100644
index 00000000000..55d0d6268ad
--- /dev/null
+++ b/app/helpers/compare_helper.rb
@@ -0,0 +1,12 @@
+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
diff --git a/app/views/projects/compare/_form.html.haml b/app/views/projects/compare/_form.html.haml
index 503b39c0663..ca1ea4073e6 100644
--- a/app/views/projects/compare/_form.html.haml
+++ b/app/views/projects/compare/_form.html.haml
@@ -1,30 +1,21 @@
-%div
- - unless params[:to]
- %p.slead
- 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.
-
-
- = form_tag project_compare_index_path(@project), method: :post do
- .clearfix
- .pull-left
- - 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'}
- = text_field_tag :from, params[:from], placeholder: "from", class: "input-xlarge input-xpadding"
- = "..."
- = 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
-
+= form_tag project_compare_index_path(@project), method: :post do
+ .clearfix
+ .pull-left
+ - 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'}
+ .input-prepend
+ %span.add-on.input-xpadding from
+ = text_field_tag :from, params[:from], class: "span3 input-xpadding"
+ = "..."
+ .input-prepend
+ %span.add-on.input-xpadding to
+ = text_field_tag :to, params[:to], class: "span3 input-xpadding"
+ .pull-left
+ &nbsp;
+ = submit_tag "Compare", class: "btn btn-create commits-compare-btn"
+ - if compare_to_mr_button?
+ = link_to compare_mr_path, class: 'prepend-left-10' do
+ %strong Make a merge request
:javascript
diff --git a/app/views/projects/compare/index.html.haml b/app/views/projects/compare/index.html.haml
index 8f108ed0b08..4745bfbeaaf 100644
--- a/app/views/projects/compare/index.html.haml
+++ b/app/views/projects/compare/index.html.haml
@@ -2,5 +2,15 @@
%h3.page-title
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"
diff --git a/app/views/projects/compare/show.html.haml b/app/views/projects/compare/show.html.haml
index af9273f9315..4be62d36917 100644
--- a/app/views/projects/compare/show.html.haml
+++ b/app/views/projects/compare/show.html.haml
@@ -20,3 +20,16 @@
- unless @diffs.empty?
%h4 Diff
= 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.
diff --git a/app/views/projects/issues/_form.html.haml b/app/views/projects/issues/_form.html.haml
index 957cc5a7e2d..6acad9134d1 100644
--- a/app/views/projects/issues/_form.html.haml
+++ b/app/views/projects/issues/_form.html.haml
@@ -67,8 +67,8 @@
event.preventDefault();
}
})
- .bind( "click", function( event ) {
- $( this ).autocomplete("search", "");
+ .bind("click", function(event) {
+ $(this).autocomplete("search", "");
})
.autocomplete({
minLength: 0,