summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2012-12-20 06:15:39 -0800
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2012-12-20 06:15:39 -0800
commit40c6d8717573ee892529b5d8398d417e166f14c6 (patch)
treebd2611af5ebd0d32f27cf907ea5f8c7f141eaaed
parent4b02f4a22d2c7f10418c9202bb718dab185e6d82 (diff)
parentb2e31692a51318171e110f01363af782129b7ce7 (diff)
downloadgitlab-ce-40c6d8717573ee892529b5d8398d417e166f14c6.tar.gz
Merge pull request #2315 from koenpunt/gh-issue-513
Added compare switch
-rw-r--r--app/assets/images/switch_icon.pngbin0 -> 1203 bytes
-rw-r--r--app/assets/stylesheets/sections/commits.scss9
-rw-r--r--app/views/compare/_form.html.haml4
-rw-r--r--features/steps/project/project_browse_commits.rb4
4 files changed, 15 insertions, 2 deletions
diff --git a/app/assets/images/switch_icon.png b/app/assets/images/switch_icon.png
new file mode 100644
index 00000000000..7c11f206593
--- /dev/null
+++ b/app/assets/images/switch_icon.png
Binary files differ
diff --git a/app/assets/stylesheets/sections/commits.scss b/app/assets/stylesheets/sections/commits.scss
index aaf9254755a..12c0a17b1e0 100644
--- a/app/assets/stylesheets/sections/commits.scss
+++ b/app/assets/stylesheets/sections/commits.scss
@@ -300,3 +300,12 @@
color: #fff;
font-family: $monospace;
}
+
+
+.commits-compare-switch{
+ background: url('switch_icon.png');
+ width: 16px;
+ height: 18px;
+ text-indent: -9999px;
+ display: inline-block;
+} \ No newline at end of file
diff --git a/app/views/compare/_form.html.haml b/app/views/compare/_form.html.haml
index 07f1c818e4d..123c1c457f8 100644
--- a/app/views/compare/_form.html.haml
+++ b/app/views/compare/_form.html.haml
@@ -13,12 +13,16 @@
= text_field_tag :from, params[:from], placeholder: "master", class: "xlarge"
= "..."
= text_field_tag :to, params[:to], placeholder: "aa8b4ef", class: "xlarge"
+ - 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'}
- if @refs_are_same
.alert
%span Refs are the same
.actions
= submit_tag "Compare", class: "btn primary wide commits-compare-btn"
+
+
:javascript
$(function() {
var availableTags = #{@project.ref_names.to_json};
diff --git a/features/steps/project/project_browse_commits.rb b/features/steps/project/project_browse_commits.rb
index 6bf164e2c8f..2c03ce14fc1 100644
--- a/features/steps/project/project_browse_commits.rb
+++ b/features/steps/project/project_browse_commits.rb
@@ -32,8 +32,8 @@ class ProjectBrowseCommits < Spinach::FeatureSteps
end
And 'I fill compare fields with refs' do
- fill_in "from", with: "bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a"
- fill_in "to", with: "8716fc78f3c65bbf7bcf7b574febd583bc5d2812"
+ fill_in "from", with: "8716fc78f3c65bbf7bcf7b574febd583bc5d2812"
+ fill_in "to", with: "bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a"
click_button "Compare"
end