From: Tom Hughes Date: Wed, 18 Nov 2009 20:21:54 +0000 (+0000) Subject: Replace the existing pagination of changesets in the browser with a X-Git-Tag: live~6988 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/261a93fbbc974400d40b74bca9923887d939ab79 Replace the existing pagination of changesets in the browser with a simple next/previous pagination that avoids the need to count the total number of matches. --- diff --git a/app/controllers/changeset_controller.rb b/app/controllers/changeset_controller.rb index 7573a1803..2834fdae9 100644 --- a/app/controllers/changeset_controller.rb +++ b/app/controllers/changeset_controller.rb @@ -307,11 +307,15 @@ class ChangesetController < ApplicationController @description = t 'changeset.list.description' end - @edit_pages, @edits = paginate(:changesets, - :include => [:user, :changeset_tags], - :conditions => conditions, - :order => "changesets.created_at DESC", - :per_page => 20) + @page = (params[:page] || 1).to_i + @page_size = 20 + + @edits = Changeset.find(:all, + :include => [:user, :changeset_tags], + :conditions => conditions, + :order => "changesets.created_at DESC", + :offset => (@page - 1) * @page_size, + :limit => @page_size) end private diff --git a/app/views/changeset/_changeset_paging_nav.html.erb b/app/views/changeset/_changeset_paging_nav.html.erb index 5a5d94f05..7b99b60ea 100644 --- a/app/views/changeset/_changeset_paging_nav.html.erb +++ b/app/views/changeset/_changeset_paging_nav.html.erb @@ -1,13 +1,17 @@

-<% current_page = @edit_pages.current_page %> - -<%= t'changeset.changeset_paging_nav.showing_page' %> -<%= current_page.number %> (<%= current_page.first_item %><% -if (current_page.first_item < current_page.last_item) # if more than 1 changeset on page - %>-<%= current_page.last_item %><% -end %> -<%= t'changeset.changeset_paging_nav.of'%> <%= @edit_pages.item_count %>) -<% if @edit_pages.page_count > 1 %> - | <%= pagination_links_each(@edit_pages, {}) { |n| link_to(n, params.merge({ :page => n })) } %> + +<% if @page > 1 %> +<%= link_to t('changeset.changeset_paging_nav.previous'), :page => @page - 1 %> +<% else %> +<%= t('changeset.changeset_paging_nav.previous') %> <% end %> + +| <%= t('changeset.changeset_paging_nav.showing_page', :page => @page) %> | + +<% if @edits.size < @page_size %> +<%= t('changeset.changeset_paging_nav.next') %> +<% else %> +<%= link_to t('changeset.changeset_paging_nav.next'), :page => @page + 1 %> +<% end %> +

diff --git a/config/locales/af.yml b/config/locales/af.yml index 28fe71635..2077739f3 100644 --- a/config/locales/af.yml +++ b/config/locales/af.yml @@ -199,9 +199,6 @@ af: no_comment: (geen) no_edits: (geen wysigings) still_editing: (steeds besig met wysiging) - changeset_paging_nav: - of: van - showing_page: Wys bladsy changesets: area: Gebied comment: Opmerking diff --git a/config/locales/be.yml b/config/locales/be.yml index bc79fe842..fdcaf66f0 100644 --- a/config/locales/be.yml +++ b/config/locales/be.yml @@ -188,9 +188,6 @@ be: show_area_box: паказаць мяжу мясцовасці still_editing: (у працэсе рэдагавання) view_changeset_details: Падрабязней пра набор зменаў - changeset_paging_nav: - of: з - showing_page: Паказваецца старонка changesets: area: Мясцовасць comment: Каментар diff --git a/config/locales/br.yml b/config/locales/br.yml index 2eebd93d1..39fea764a 100644 --- a/config/locales/br.yml +++ b/config/locales/br.yml @@ -241,9 +241,6 @@ br: show_area_box: diskouez takad ar voest still_editing: (oc'h aozañ c'hoazh) view_changeset_details: Gwelet munudoù ar strollad kemmoù - changeset_paging_nav: - of: eus - showing_page: O tiskouez ar bajenn changesets: area: Takad comment: Addispleg diff --git a/config/locales/cs.yml b/config/locales/cs.yml index f0977b628..7e6218d55 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -213,9 +213,6 @@ cs: no_comment: (žádný) still_editing: (stále se upravuje) view_changeset_details: Zobrazit detaily sady změn - changeset_paging_nav: - of: z - showing_page: Zobrazuji stranu changesets: area: Oblast comment: Komentář diff --git a/config/locales/de.yml b/config/locales/de.yml index 51e3ff597..0ffb590b9 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -251,9 +251,6 @@ de: show_area_box: Bereich anzeigen still_editing: (in Bearbeitung) view_changeset_details: Details des Changesets - changeset_paging_nav: - of: von - showing_page: Seite changesets: area: Bereich comment: Kommentar diff --git a/config/locales/dsb.yml b/config/locales/dsb.yml index 48965ab5c..806e06d64 100644 --- a/config/locales/dsb.yml +++ b/config/locales/dsb.yml @@ -248,9 +248,6 @@ dsb: show_area_box: wobłuk pokazaś still_editing: (wobźěłujo se) view_changeset_details: Drobnostki sajźbow změnow pokazaś - changeset_paging_nav: - of: z - showing_page: Pokazujo se bok changesets: area: Wurězk comment: Komentar diff --git a/config/locales/el.yml b/config/locales/el.yml index bd3b2677d..e086bf5a5 100644 --- a/config/locales/el.yml +++ b/config/locales/el.yml @@ -186,8 +186,6 @@ el: anonymous: Ανόνυμος show_area_box: δείξε περιοχή κουτιού view_changeset_details: Δες αλλαγή συλλογής λεπτομερειών - changeset_paging_nav: - showing_page: Eμφάνιση σελίδας changesets: area: Περιοχή comment: Σχόλιο diff --git a/config/locales/en.yml b/config/locales/en.yml index 159920ac1..e50ace42a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -241,8 +241,9 @@ en: edit: "edit" changeset: changeset_paging_nav: - showing_page: "Showing page" - of: "of" + showing_page: "Showing page {{page}}" + next: "Next »" + previous: "« Previous" changeset: id: "#{{id}}" still_editing: "(still editing)" diff --git a/config/locales/eo.yml b/config/locales/eo.yml index 460cec79a..4ca92d2f7 100644 --- a/config/locales/eo.yml +++ b/config/locales/eo.yml @@ -222,8 +222,6 @@ eo: no_comment: (neniu) no_edits: (neniaj redaktoj) still_editing: (estas ankoraÅ­ redaktata) - changeset_paging_nav: - showing_page: Montrante paĝon changesets: area: Areo comment: Komento diff --git a/config/locales/es.yml b/config/locales/es.yml index 959b01751..63499879e 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -242,9 +242,6 @@ es: show_area_box: mostrar caja still_editing: (todavía en edición) view_changeset_details: Ver detalles del conjunto de cambios - changeset_paging_nav: - of: de - showing_page: Mostrando página changesets: area: Área comment: Comentario diff --git a/config/locales/fi.yml b/config/locales/fi.yml index 9f90d0d9f..9c22569ab 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -225,9 +225,6 @@ fi: show_area_box: näytä alueen rajat kartalla still_editing: (muokkaus kesken) view_changeset_details: Näytä muutoskokoelman tarkemmat tiedot - changeset_paging_nav: - of: " /" - showing_page: Sivu changesets: area: Alue comment: Kommentti diff --git a/config/locales/fr.yml b/config/locales/fr.yml index e9b3e1bf0..83eaf9a3f 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -246,9 +246,6 @@ fr: show_area_box: afficher la zone de la boîte still_editing: (en cours de modification) view_changeset_details: Afficher les détails du groupe de modifications - changeset_paging_nav: - of: de - showing_page: Affichage de la page changesets: area: Zone comment: Commentaire diff --git a/config/locales/fur.yml b/config/locales/fur.yml index ad58e0638..f81cf8bea 100644 --- a/config/locales/fur.yml +++ b/config/locales/fur.yml @@ -167,9 +167,6 @@ fur: no_edits: (nissun cambiament) still_editing: (ancjemò in cambiament) view_changeset_details: Viôt detais dal grup di cambiaments - changeset_paging_nav: - of: su - showing_page: Daûr a mostrâ la pagjine changesets: area: Aree comment: Coment diff --git a/config/locales/hi.yml b/config/locales/hi.yml index 87a280cda..c6c3ee2a6 100644 --- a/config/locales/hi.yml +++ b/config/locales/hi.yml @@ -174,9 +174,6 @@ hi: no_edits: (कोई संपादित नहीं है) still_editing: (संपादित किया जा रहा है) view_changeset_details: इस changeset के विवरण देखे - changeset_paging_nav: - of: "पृष्ठ गिनती:" - showing_page: "इस पृष्ठ का प्रदर्शन:" changesets: area: क्षेत्र comment: टिप्पणी diff --git a/config/locales/hr.yml b/config/locales/hr.yml index cd7f4c5c5..8f2284236 100644 --- a/config/locales/hr.yml +++ b/config/locales/hr.yml @@ -246,9 +246,6 @@ hr: show_area_box: prikaži okvir područja still_editing: (joÅ¡ uređuje) view_changeset_details: Prikaži detalje changeseta - changeset_paging_nav: - of: od - showing_page: Prikazujem stranicu changesets: area: Područje comment: Komentar diff --git a/config/locales/hsb.yml b/config/locales/hsb.yml index 5d067e023..72249a7a2 100644 --- a/config/locales/hsb.yml +++ b/config/locales/hsb.yml @@ -248,9 +248,6 @@ hsb: show_area_box: wobłuk pokazać still_editing: (wobdźěłuje so hišće) view_changeset_details: Podrobnosće sadźby změnow pokazać - changeset_paging_nav: - of: z - showing_page: Pokazuje so strona changesets: area: Wobłuk comment: Komentar diff --git a/config/locales/hu.yml b/config/locales/hu.yml index ca87bc731..a223e4246 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -243,9 +243,6 @@ hu: show_area_box: területhatároló megjelenítése still_editing: (szerkesztés alatt) view_changeset_details: Módosításcsomag részleteinek megtekintése - changeset_paging_nav: - of: "összesen:" - showing_page: "Jelenlegi oldal:" changesets: area: Terület comment: Megjegyzés diff --git a/config/locales/ia.yml b/config/locales/ia.yml index 7ac46e009..e6e5b19b2 100644 --- a/config/locales/ia.yml +++ b/config/locales/ia.yml @@ -240,9 +240,6 @@ ia: show_area_box: monstrar quadro del area still_editing: (ancora in modification) view_changeset_details: Vider detalios del gruppo de modificationes - changeset_paging_nav: - of: de - showing_page: Monstrante pagina changesets: area: Area comment: Commento diff --git a/config/locales/is.yml b/config/locales/is.yml index 252971ffd..5411411fb 100644 --- a/config/locales/is.yml +++ b/config/locales/is.yml @@ -238,9 +238,6 @@ is: show_area_box: sýna svæðismörk still_editing: (enn að breyta) view_changeset_details: Skoða breytingarsett - changeset_paging_nav: - of: af - showing_page: Sýni síðu changesets: area: Svæði comment: Athugasemd diff --git a/config/locales/it.yml b/config/locales/it.yml index b3947e85a..10fee5415 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -177,9 +177,6 @@ it: show_area_box: visualizza il riquadro dell'area still_editing: (ancora in modifica) view_changeset_details: Visualizza i dettagli del gruppo di modifiche - changeset_paging_nav: - of: di - showing_page: Visualizzata la pagina changesets: area: Area comment: Commento diff --git a/config/locales/ja.yml b/config/locales/ja.yml index f29bdd00c..1f8505cbb 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -230,8 +230,6 @@ ja: show_area_box: 領域境界を表示 still_editing: (まだ編集中です) view_changeset_details: 変更セットの詳細表示 - changeset_paging_nav: - showing_page: ページ表示 changesets: area: 領域 comment: コメント diff --git a/config/locales/mk.yml b/config/locales/mk.yml index 5bb7e9ad2..727715819 100644 --- a/config/locales/mk.yml +++ b/config/locales/mk.yml @@ -240,9 +240,6 @@ mk: show_area_box: прикажи рамка на површина still_editing: (сè уште уредува) view_changeset_details: Преглед на детали од измените - changeset_paging_nav: - of: од - showing_page: Приказ на страница changesets: area: Површина comment: Коментар diff --git a/config/locales/nds.yml b/config/locales/nds.yml index af6e57385..6a508e03d 100644 --- a/config/locales/nds.yml +++ b/config/locales/nds.yml @@ -138,9 +138,6 @@ nds: no_comment: (keen) no_edits: (keen Ännern) still_editing: (noch an’t Ännern) - changeset_paging_nav: - of: von - showing_page: an’t Sied weddergeven changesets: area: Rebeed comment: Kommentar diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 26158191a..fdf60fb61 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -242,9 +242,6 @@ nl: show_area_box: toon rechthoek still_editing: (nog aan het bewerken) view_changeset_details: Details wijzigingenset weergeven - changeset_paging_nav: - of: van - showing_page: Bezig met weergeven van pagina changesets: area: Gebied comment: Opmerking diff --git a/config/locales/no.yml b/config/locales/no.yml index 390c536ac..f55b08f93 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -237,9 +237,6 @@ show_area_box: vis boks for omrÃ¥de still_editing: (redigerer forsatt) view_changeset_details: Vis detaljer for endringssett - changeset_paging_nav: - of: av - showing_page: Viser side changesets: area: OmrÃ¥de comment: Kommentar diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 501c9eee6..6570f2b91 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -236,9 +236,6 @@ pl: show_area_box: pokaż prostokąt zawierający still_editing: (nadal edytowany) view_changeset_details: Zobacz szczegóły changesetu - changeset_paging_nav: - of: z - showing_page: Widoczna jest strona changesets: area: Obszar comment: Komentarz diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index 63b9bad0a..c58b8aa8e 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -244,9 +244,6 @@ pt-BR: show_area_box: exibir limite da área still_editing: (ainda editando) view_changeset_details: Ver detalhes das alterações - changeset_paging_nav: - of: de - showing_page: Exibindo página changesets: area: Área comment: Comentário diff --git a/config/locales/ro.yml b/config/locales/ro.yml index 2acbea238..965d5351c 100644 --- a/config/locales/ro.yml +++ b/config/locales/ro.yml @@ -210,9 +210,6 @@ ro: show_area_box: afișează chenarul zonei still_editing: (încă se editează) view_changeset_details: Vizualizare detalii set de schimbări - changeset_paging_nav: - of: din - showing_page: Se afișează pagina changesets: area: Zonă comment: Comentariu diff --git a/config/locales/ru.yml b/config/locales/ru.yml index a1f710446..fb54a36b8 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -242,9 +242,6 @@ ru: show_area_box: Показать рамку, охватывающую область пакета правок still_editing: (ещё редактируется) view_changeset_details: Просмотреть подробности пакета правок - changeset_paging_nav: - of: из - showing_page: Страница changesets: area: Область comment: Комментарий diff --git a/config/locales/sl.yml b/config/locales/sl.yml index 70ab615b8..6a67387b1 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -212,9 +212,6 @@ sl: show_area_box: prikaži pravokotno področje still_editing: (Å¡e ureja) view_changeset_details: Ogled podrobnosti paketa sprememb - changeset_paging_nav: - of: od - showing_page: Prikaz strani changesets: area: Področje comment: Komentar diff --git a/config/locales/sv.yml b/config/locales/sv.yml index 4447a9790..aebe07a21 100644 --- a/config/locales/sv.yml +++ b/config/locales/sv.yml @@ -233,9 +233,6 @@ sv: no_comment: (ingen) no_edits: (inga ändringar) still_editing: (redigerar fortfarande) - changeset_paging_nav: - of: av - showing_page: Visar sida changesets: area: Area comment: Kommentar diff --git a/config/locales/vi.yml b/config/locales/vi.yml index 29ae03ee3..afca8e75b 100644 --- a/config/locales/vi.yml +++ b/config/locales/vi.yml @@ -240,9 +240,6 @@ vi: show_area_box: hiện hộp vùng still_editing: (đang mở) view_changeset_details: Xem chi tiết của bộ thay đổi - changeset_paging_nav: - of: trong - showing_page: Đang hiện trang changesets: area: Vùng comment: Miêu tả diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index 09bc53176..eb5e0f51f 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -172,8 +172,6 @@ zh-CN: show_area_box: 显示区域窗口 still_editing: (仍在编辑中) view_changeset_details: 查看详细变更 - changeset_paging_nav: - showing_page: 显示网页 changesets: area: 区域 comment: 评论 diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index 538265aa9..78bf0d539 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -227,9 +227,6 @@ zh-TW: show_area_box: 顯示區域方塊 still_editing: (尚在編輯) view_changeset_details: 檢視變更組合詳細資訊 - changeset_paging_nav: - of: / - showing_page: 正在顯示頁面 changesets: area: 區域 comment: 註解