From a650c0eab8bae8438dbcf6080be2fec4c7c986a8 Mon Sep 17 00:00:00 2001 From: Nathan Lowe Date: Sat, 10 Jan 2015 12:15:06 -0500 Subject: [PATCH] Sort `/pages` alphabetically Previously, the 'All Pages' view was not sorted alphabetically. We need to sort on the lowercase version of the page names so that lowercase names do not end up at the bottom of the list and are instead mixed in alphabetically, as they should be. Patches test/test_latest_changes_view.rb to include changes needed to test alphabetical sorting. --- lib/gollum/app.rb | 1 + test/examples/lotr.git/logs/HEAD | 1 + test/examples/lotr.git/logs/refs/heads/master | 1 + .../15/ffb242d2f9d49112afaac25aff0eaebc32ca04 | Bin 0 -> 71 bytes .../46/deec372646f3eb641c459b1a1a63599e20988b | Bin 0 -> 543 bytes .../7b/dfe65face6f7cf9877d8c1d8c1dd974a63745e | Bin 0 -> 182 bytes .../f5/9001ceaca4caaaa24fb1b8da3deaaf7f42893a | 3 +++ test/examples/lotr.git/refs/heads/master | 2 +- test/test_app.rb | 1 + test/test_latest_changes_view.rb | 5 +++-- 10 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 test/examples/lotr.git/objects/15/ffb242d2f9d49112afaac25aff0eaebc32ca04 create mode 100644 test/examples/lotr.git/objects/46/deec372646f3eb641c459b1a1a63599e20988b create mode 100644 test/examples/lotr.git/objects/7b/dfe65face6f7cf9877d8c1d8c1dd974a63745e create mode 100644 test/examples/lotr.git/objects/f5/9001ceaca4caaaa24fb1b8da3deaaf7f42893a diff --git a/lib/gollum/app.rb b/lib/gollum/app.rb index c26b3bb0..0292b127 100644 --- a/lib/gollum/app.rb +++ b/lib/gollum/app.rb @@ -450,6 +450,7 @@ module Precious wiki = Gollum::Wiki.new(settings.gollum_path, wiki_options) @results = wiki.pages @results += wiki.files if settings.wiki_options[:show_all] + @results = @results.sort_by { |p| p.name.downcase } # Sort Results alphabetically, fixes 922 @ref = wiki.ref mustache :pages end diff --git a/test/examples/lotr.git/logs/HEAD b/test/examples/lotr.git/logs/HEAD index 64e98b35..2b0e49e0 100644 --- a/test/examples/lotr.git/logs/HEAD +++ b/test/examples/lotr.git/logs/HEAD @@ -8,3 +8,4 @@ cfea406f5f77afc7fb673a43e97721234385b1bd 629aa678272b017a4d136d35e77ac94d80b08dc 629aa678272b017a4d136d35e77ac94d80b08dc2 7d6aeab8b84c895f21f6c66b84a457b0fced9693 Daniel Kimsey 1352501984 -0500 push 7d6aeab8b84c895f21f6c66b84a457b0fced9693 563cc3701db990caf63e4ce9c3697a062890ca48 James Dabbs 1361843315 -0500 push 563cc3701db990caf63e4ce9c3697a062890ca48 874f597a5659b4c3b153674ea04e406ff393975e Charles Pence 1363478075 -0400 push +874f597a5659b4c3b153674ea04e406ff393975e 7bdfe65face6f7cf9877d8c1d8c1dd974a63745e Nathan Lowe 1421012322 -0500 push diff --git a/test/examples/lotr.git/logs/refs/heads/master b/test/examples/lotr.git/logs/refs/heads/master index 64e98b35..2b0e49e0 100644 --- a/test/examples/lotr.git/logs/refs/heads/master +++ b/test/examples/lotr.git/logs/refs/heads/master @@ -8,3 +8,4 @@ cfea406f5f77afc7fb673a43e97721234385b1bd 629aa678272b017a4d136d35e77ac94d80b08dc 629aa678272b017a4d136d35e77ac94d80b08dc2 7d6aeab8b84c895f21f6c66b84a457b0fced9693 Daniel Kimsey 1352501984 -0500 push 7d6aeab8b84c895f21f6c66b84a457b0fced9693 563cc3701db990caf63e4ce9c3697a062890ca48 James Dabbs 1361843315 -0500 push 563cc3701db990caf63e4ce9c3697a062890ca48 874f597a5659b4c3b153674ea04e406ff393975e Charles Pence 1363478075 -0400 push +874f597a5659b4c3b153674ea04e406ff393975e 7bdfe65face6f7cf9877d8c1d8c1dd974a63745e Nathan Lowe 1421012322 -0500 push diff --git a/test/examples/lotr.git/objects/15/ffb242d2f9d49112afaac25aff0eaebc32ca04 b/test/examples/lotr.git/objects/15/ffb242d2f9d49112afaac25aff0eaebc32ca04 new file mode 100644 index 0000000000000000000000000000000000000000..498640a0f89b3a255ff5e1ac7cda5d6bf9d7b7ce GIT binary patch literal 71 zcmV-N0J#5n0ZYosPf{>7XNXG7J-jYYp**ozAu&%OKPN?@JUlJVyel^~@9^d# dh4PGih2qqrveXm>*P_(Cl+0p1E&w0Z7;iT^AJG5+ literal 0 HcmV?d00001 diff --git a/test/examples/lotr.git/objects/46/deec372646f3eb641c459b1a1a63599e20988b b/test/examples/lotr.git/objects/46/deec372646f3eb641c459b1a1a63599e20988b new file mode 100644 index 0000000000000000000000000000000000000000..d5591af9854ab93bfc396655e92a6d8fc50145da GIT binary patch literal 543 zcmV+)0^t340V^p=O;s>6GG#C{FfcPQQE`mYPa(P=kCc zbpwi0lQZ*6!GW-9oBWHpVLuXmxEcd*nf$c8^Y&K;RAo?RN=i;@v0hOML)DouwWq6H zZEt9V@0M_`v|AAIO9x_MP-aQK~wzIA(yPO(7M#JlC^m!uYfRK2-n#JcaHtHP?S%Xb?TPh#_) z+}8|K<&m100#Q{vL*{17+K72JA9x#;#Ch^-Ga@Tts)939Qj-!18CH~^SX`o;TUt_* h4|d(x35@5~EIGAmk^jaWw`^anuXpOS0s!P0@|PNG4K@G( literal 0 HcmV?d00001 diff --git a/test/examples/lotr.git/objects/7b/dfe65face6f7cf9877d8c1d8c1dd974a63745e b/test/examples/lotr.git/objects/7b/dfe65face6f7cf9877d8c1d8c1dd974a63745e new file mode 100644 index 0000000000000000000000000000000000000000..8053682c23907c240556a96f15209deb4149a9ff GIT binary patch literal 182 zcmV;n07?IN0iBLpYQr!P0Q;>|>;+o%SVNE^l?R4-aFhs0AMe^a2u()iz3lW(# zGU`yPOD;vvihgD82Run;+Tf?Z7;eI4ezm_89@9!~`6_+AgF$PwvCc&J)Lv_K(Q8ro ktyq1JBM6@YJ578-y&h=UXUZ(C&;n;aq-~S>2VB@t9hhTSAOHXW literal 0 HcmV?d00001 diff --git a/test/examples/lotr.git/objects/f5/9001ceaca4caaaa24fb1b8da3deaaf7f42893a b/test/examples/lotr.git/objects/f5/9001ceaca4caaaa24fb1b8da3deaaf7f42893a new file mode 100644 index 00000000..7e4dd7a9 --- /dev/null +++ b/test/examples/lotr.git/objects/f5/9001ceaca4caaaa24fb1b8da3deaaf7f42893a @@ -0,0 +1,3 @@ +x A + ֝ +\HN /f(xz*ˠ G%ςPCaHN?^Ѕ][m%QEvh \ No newline at end of file diff --git a/test/examples/lotr.git/refs/heads/master b/test/examples/lotr.git/refs/heads/master index 115b865a..81879653 100644 --- a/test/examples/lotr.git/refs/heads/master +++ b/test/examples/lotr.git/refs/heads/master @@ -1 +1 @@ -874f597a5659b4c3b153674ea04e406ff393975e +7bdfe65face6f7cf9877d8c1d8c1dd974a63745e diff --git a/test/test_app.rb b/test/test_app.rb index 68c590e9..f4f8c19e 100644 --- a/test/test_app.rb +++ b/test/test_app.rb @@ -619,6 +619,7 @@ context "Frontend with lotr" do assert !body.include?("Boromir"), "/pages should NOT include the page 'Boromir'" assert body.include?("Mordor"), "/pages should include the folder 'Mordor'" assert !body.include?("Eye Of Sauron"), "/pages should NOT include the page 'Eye Of Sauron'" + assert !body.match(/(Zamin).+(roast\-mutton)/m), "/pages should be sorted alphabetically" end test "/pages/Mordor/" do diff --git a/test/test_latest_changes_view.rb b/test/test_latest_changes_view.rb index 4883b223..fe6d08de 100644 --- a/test/test_latest_changes_view.rb +++ b/test/test_latest_changes_view.rb @@ -19,9 +19,10 @@ context "Precious::Views::LatestChanges" do test "displays_latest_changes" do get('/latest_changes') body = last_response.body + assert body.include?('Charles Pence'), "/latest_changes should include the Author Charles Pence" - assert body.include?('60f12f4'), "/latest_changes should include the :latest_changes_count commit" - assert !body.include?('0ed8cbe'), "/latest_changes should not include more than latest_changes_count commits" + assert body.include?('a8ad3c0'), "/latest_changes should include the :latest_changes_count commit" + assert !body.include?('60f12f4'), "/latest_changes should not include more than latest_changes_count commits" assert body.include?('Data-Two.csv'), "/latest_changes include links to modified files in #{body}" assert body.include?('Hobbit.md'), "/latest_changes should include links to modified pages in #{body}" end