Pagination for history and latest changes. (#1396)

* Pagination for history and latest changes

* New footer for historical pages

* Fix pagination on history view.

* Do not directly use git adapter

* History view: allow selecting from different pages

* Use log_pagination_options to determine latest changes parameters

* Fix JS pageFullPath
This commit is contained in:
Dawa Ometto
2019-08-21 23:28:49 +02:00
committed by GitHub
parent 29a8b893f1
commit 976f55e1b2
18 changed files with 186 additions and 139 deletions
+17
View File
@@ -701,6 +701,23 @@ context "Frontend with lotr" do
assert_match /not so big smelly creatures/, last_response.body
end
test 'editable pages have footer' do
get 'Bilbo-Baggings'
assert_equal last_response.body.include?('delete-link'), false
assert_equal last_response.body.include?('page-info-toggle'), false
end
test 'show specific revision of page' do
old_sha = '5bc1aaec6149e854078f1d0f8b71933bbc6c2e43'
page = 'Bilbo-Baggins'
get "#{page}/#{old_sha}"
assert last_response.ok?
assert_equal last_response.body.include?('delete-link'), false
assert_equal last_response.body.include?('page-info-toggle'), false
assert last_response.body.include?('This version of the page was edited by <b>Tom Preston-Werner</b> at 2010-04-07')
assert last_response.body.include?("<a href=\"/Bilbo-Baggins.md\">View the most recent version.</a></p>")
end
test "show revision of specific file" do
old_sha = "df26e61e707116f81ebc6b935ec6d1676b7e96c4"
update_sha = "f803c64d11407b23797325e3843f3f378b78f611"
+5 -5
View File
@@ -13,16 +13,16 @@ context "Precious::Views::LatestChanges" do
@path = cloned_testpath("examples/lotr.git")
@wiki = Gollum::Wiki.new(@path)
Precious::App.set(:gollum_path, @path)
Precious::App.set(:wiki_options, {:latest_changes_count => 10})
Precious::App.set(:wiki_options, {:pagination_count => 10})
end
test "displays_latest_changes" do
get('/gollum/latest_changes')
body = last_response.body
assert body.include?("<span class=\"float-left col-2\"><a href=\"javascript:void(0)\">\n Charles Pence\n</a>\n</span>"), "/latest_changes should include Author Charles Pence"
assert body.include?('1db89eb'), "/latest_changes should include the :latest_changes_count commit"
assert !body.include?('a8ad3c0'), "/latest_changes should not include more than latest_changes_count commits"
assert body.include?("Charles Pence</span>"), "/latest_changes should include Author Charles Pence"
assert body.include?('1db89eb'), "/latest_changes should include the :pagination_count commit"
assert !body.include?('a8ad3c0'), "/latest_changes should not include more than :pagination_count commits"
assert body.include?('<a href="Data-Two.csv/874f597a5659b4c3b153674ea04e406ff393975e">Data-Two.csv</a>'), "/latest_changes include links to modified files in #{body}"
assert body.include?('<a href="Hobbit.md/874f597a5659b4c3b153674ea04e406ff393975e">Hobbit.md</a>'), "/latest_changes should include links to modified pages in #{body}"
end