Commit 40c6d8717573ee892529b5d8398d417e166f14c6

Authored by Dmitriy Zaporozhets
2 parents 4b02f4a2 b2e31692

Merge pull request #2315 from koenpunt/gh-issue-513

Added compare switch
app/assets/images/switch_icon.png 0 → 100644

1.17 KB

app/assets/stylesheets/sections/commits.scss
@@ -300,3 +300,12 @@ @@ -300,3 +300,12 @@
300 color: #fff; 300 color: #fff;
301 font-family: $monospace; 301 font-family: $monospace;
302 } 302 }
  303 +
  304 +
  305 +.commits-compare-switch{
  306 + background: url('switch_icon.png');
  307 + width: 16px;
  308 + height: 18px;
  309 + text-indent: -9999px;
  310 + display: inline-block;
  311 +}
303 \ No newline at end of file 312 \ No newline at end of file
app/views/compare/_form.html.haml
@@ -13,12 +13,16 @@ @@ -13,12 +13,16 @@
13 = text_field_tag :from, params[:from], placeholder: "master", class: "xlarge" 13 = text_field_tag :from, params[:from], placeholder: "master", class: "xlarge"
14 = "..." 14 = "..."
15 = text_field_tag :to, params[:to], placeholder: "aa8b4ef", class: "xlarge" 15 = text_field_tag :to, params[:to], placeholder: "aa8b4ef", class: "xlarge"
  16 + - if params[:to] && params[:from]
  17 + = link_to 'switch', {from: params[:to], to: params[:from]}, {class: 'commits-compare-switch has_tooltip', title: 'Switch base of comparison'}
16 - if @refs_are_same 18 - if @refs_are_same
17 .alert 19 .alert
18 %span Refs are the same 20 %span Refs are the same
19 .actions 21 .actions
20 = submit_tag "Compare", class: "btn primary wide commits-compare-btn" 22 = submit_tag "Compare", class: "btn primary wide commits-compare-btn"
21 23
  24 +
  25 +
22 :javascript 26 :javascript
23 $(function() { 27 $(function() {
24 var availableTags = #{@project.ref_names.to_json}; 28 var availableTags = #{@project.ref_names.to_json};
features/steps/project/project_browse_commits.rb
@@ -32,8 +32,8 @@ class ProjectBrowseCommits < Spinach::FeatureSteps @@ -32,8 +32,8 @@ class ProjectBrowseCommits < Spinach::FeatureSteps
32 end 32 end
33 33
34 And 'I fill compare fields with refs' do 34 And 'I fill compare fields with refs' do
35 - fill_in "from", with: "bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a"  
36 - fill_in "to", with: "8716fc78f3c65bbf7bcf7b574febd583bc5d2812" 35 + fill_in "from", with: "8716fc78f3c65bbf7bcf7b574febd583bc5d2812"
  36 + fill_in "to", with: "bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a"
37 click_button "Compare" 37 click_button "Compare"
38 end 38 end
39 39