Unobtrusive pagination_links_remote

This commit is contained in:
benni 2011-06-10 11:43:56 +02:00
parent c173cf4a6a
commit a47d4b1f0e
3 changed files with 9 additions and 4 deletions

View File

@ -22,15 +22,14 @@ module ApplicationHelper
def pagination_links_remote(collection, options = {})
per_page = options[:per_page] || @per_page
params = options[:params] || {}
update = options[:update] || nil
# Translations
previous_label = '« ' + "Vorherige"
next_label = "Nächste" + ' »'
# Merge other url-options for will_paginate
params = params.merge({:per_page => per_page})
will_paginate collection, { :params => params, :remote => true, :update => update,
:previous_label => previous_label, :next_label => next_label, }
will_paginate collection, :params => params, 'data-remote' => remote,
:previous_label => previous_label, :next_label => next_label
end
# Link-collection for per_page-options when using the pagination-plugin

View File

@ -9,7 +9,7 @@
%p
Beachte dabei den <em>Unterschied zwischen Gruppe und Bestellgruppe</em>:
Eine Bestellgruppe hat ein Konto und kann Essen bestellen. In einer
%em= link_to 'Arbeisgruppe', admin_workgroups_path
%em= link_to 'Arbeitsgruppe', admin_workgroups_path
(z.b. 'Soritiergruppe')
koordinieren sich die Mitglieder mittels Aufgaben und Nachrichten.
Nutzer_innen können immer nur einer Bestellgruppe, aber beliebig vielen anderen Gruppen angehören.

View File

@ -60,6 +60,12 @@ $(function() {
document.location.href = newLocation;
}
});
// Remote paginations
$('div.pagination[data-remote] a').live('click', function() {
$.getScript($(this).attr('href'));
return false;
});
});