From 9916e8d6dc66b0a4f71bf88bae55d8077204b5f6 Mon Sep 17 00:00:00 2001 From: Koen Punt Date: Thu, 20 Dec 2012 14:39:39 +0100 Subject: [PATCH 1/3] Updated test to match with switched commits Added compare switch --- app/assets/stylesheets/sections/commits.scss | 9 +++++++++ app/views/compare/_form.html.haml | 3 +++ features/steps/project/project_browse_commits.rb | 4 ++-- 3 files changed, 14 insertions(+), 2 deletions(-) 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..088b6ad9158 100644 --- a/app/views/compare/_form.html.haml +++ b/app/views/compare/_form.html.haml @@ -13,12 +13,15 @@ = text_field_tag :from, params[:from], placeholder: "master", class: "xlarge" = "..." = text_field_tag :to, params[:to], placeholder: "aa8b4ef", class: "xlarge" + = 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 -- GitLab From d11f9a632c19b6579bc9d0a676208c38a357fb57 Mon Sep 17 00:00:00 2001 From: Koen Punt Date: Thu, 20 Dec 2012 14:42:05 +0100 Subject: [PATCH 2/3] only show switch if from and to are set --- app/views/compare/_form.html.haml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/compare/_form.html.haml b/app/views/compare/_form.html.haml index 088b6ad9158..123c1c457f8 100644 --- a/app/views/compare/_form.html.haml +++ b/app/views/compare/_form.html.haml @@ -13,7 +13,8 @@ = text_field_tag :from, params[:from], placeholder: "master", class: "xlarge" = "..." = text_field_tag :to, params[:to], placeholder: "aa8b4ef", class: "xlarge" - = link_to 'switch', {from: params[:to], to: params[:from]}, {class: 'commits-compare-switch has_tooltip', title: 'Switch base of comparison'} + - 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 -- GitLab From b2e31692a51318171e110f01363af782129b7ce7 Mon Sep 17 00:00:00 2001 From: Koen Punt Date: Thu, 20 Dec 2012 14:58:07 +0100 Subject: [PATCH 3/3] Added icon --- app/assets/images/switch_icon.png | Bin 0 -> 1203 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 app/assets/images/switch_icon.png diff --git a/app/assets/images/switch_icon.png b/app/assets/images/switch_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..7c11f20659367c4f3371c27d9f1b2a37cf89dab9 GIT binary patch literal 1203 zcmeAS@N?(olHy`uVBq!ia0y~yU=UznU=ZS9V_;wivX0AQU|^6eag8Vm&QB{TPb^Ah za7@WhN>%X8O-xS>N=;0uEIgTN!@$6-k{J?F65;D(m7Jfemk3g$SCL!500K7l6$OdO z*{LN8NvY|XdA3ULckfqH$V{%1*XSQL?vFu&J=B z$SufCElE_U$j!+swyLmI0-I}l#hD=EpgRf0Gw!Z$#{Ilm}X!Bo#!H`&0@ zP{GVh&(Orw%*;?n!N|bSNZ-In-@r`Q(8S8r%*x1I0Sc7t6l{u8(yW49+@N+9rKH&^ zWt5Z@Sn2DRmzV368|&p4rRy77T3Uk4Ff!6DN=ef#uFNY*tkBIXR)(42l3JWxlvz-c znV+WsGBGhJzqG_wNeOCfMQ#Dy*t}wBFeT^b>Q^Kd=o{)8fV>3pYi@zBFMg%Dxp39R zB|)hO_hL1;IHa;5RX-@TIKQ+gIW;IXO&R2-0xRdD)WnkfqLBRj99Sp@WaO9R7iZ)b zC^!e3DQNg6CTHe>1T?`qe0{Av^NLFn^O93NU2K&qatrh_GgGWA99^7UU0qF0jGSEz z4PA|#oQw^f98FEloGr}F3=J(|dR_99OLJ56N?>|Z5PHpU>IEeRP=Hvuq!wkCrKY$Q z<>xAZJ#CeV+bza8&4cPq!R;0koO<=`6m0ZCQHvDSFrgq9HxLt?DnTjKP63hhQ}a@6 zm5P+??O5_M)fgBURXtrCLn>}1&9N+2V^(eGY;+t-INwcblKWms{czq#4D zdFD*X!=h`}tl@ERHrikJw~GJ7-Oj5F3*097`Z)ZupLIn}VISWS!Rqht{>qDqwcX`r z=a;ML)#Z8f_N{bdQFdpSTY^PPf?3j|COZwuss7 z=aaSi!nT^xA$srqeYLmwLzbL6efso)Lx(>7d3?NIW1FFoQ5