Replace will_paginate with kaminari. Fixed foodcoop/users page.

This commit is contained in:
benni 2012-10-08 15:24:32 +02:00
parent 1708df3f6c
commit ab81ef09d5
17 changed files with 162 additions and 64 deletions

View file

@ -20,18 +20,11 @@ module ApplicationHelper
end
# Creates ajax-controlled-links for pagination
# see also the plugin "will_paginate"
def pagination_links_remote(collection, options = {})
per_page = options[:per_page] || @per_page
params = options[:params] || {}
# 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, 'data-remote' => true,
:previous_label => previous_label, :next_label => next_label
paginate collection, :params => params, :remote => true
end
# Link-collection for per_page-options when using the pagination-plugin
@ -42,9 +35,15 @@ module ApplicationHelper
links = per_page_options.map do |per_page|
params.merge!({:per_page => per_page})
per_page == current ? per_page : link_to(per_page, params, :remote => true)
link_class = 'btn'
link_class << ' disabled' if per_page == current
link_to(per_page, params, :remote => true, class: link_class)
end
"Pro Seite: #{links.join(" ")}".html_safe
content_tag :div, class: 'btn-group pull-right' do
links.join.html_safe
end
end
def sort_td_class_helper(param)

View file

@ -9,4 +9,12 @@ module MessagesHelper
end
"<b>#{link_to(h(subject), message)}</b> <span style='color:grey'>#{h(body)}</span>".html_safe
end
def link_to_new_message(options = {})
messages_params = options[:message_params] || nil
link_text = content_tag :id, nil, class: 'icon-envelope'
link_text << " #{options[:text]}" if options[:text].present?
link_to(link_text.html_safe, new_message_path(message: messages_params), class: 'btn',
title: 'Nachricht verschicken')
end
end