Merge pull request #3003 from diasp/will-paginate-bootstrap
mobile: added will paginate for bootstrap
This commit is contained in:
commit
39ee27acf0
5 changed files with 46 additions and 6 deletions
|
|
@ -17,7 +17,7 @@
|
|||
- if @contacts.size > 0
|
||||
- for contact in @contacts
|
||||
= render 'people/person', :person => contact.person, :contact => contact
|
||||
= will_paginate @contacts
|
||||
= will_paginate @contacts, :renderer => WillPaginate::ActionView::BootstrapLinkRenderer
|
||||
- else
|
||||
%h3.no_contacts
|
||||
= t('.no_contacts')
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@
|
|||
- @group_days.each do |day, notes|
|
||||
%li
|
||||
.notification_day_header
|
||||
= day
|
||||
%span.label
|
||||
= day
|
||||
%ul.notifications_for_day
|
||||
- notes.each do |note|
|
||||
.stream_element{:data=>{:guid => note.id}, :class => "#{note.unread ? 'unread' : ''}"}
|
||||
|
|
@ -21,4 +22,4 @@
|
|||
.time
|
||||
= time_ago_in_words(note.created_at)
|
||||
|
||||
= will_paginate @notifications
|
||||
= will_paginate @notifications, :renderer => WillPaginate::ActionView::BootstrapLinkRenderer
|
||||
|
|
|
|||
|
|
@ -32,5 +32,5 @@
|
|||
- for hash in @hashes
|
||||
= render :partial => 'people/person', :locals => hash
|
||||
|
||||
= will_paginate @people
|
||||
= will_paginate @people, :renderer => WillPaginate::ActionView::BootstrapLinkRenderer
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1,32 @@
|
|||
require 'will_paginate/array'
|
||||
|
||||
# Optional for Bootstrap :renderer => WillPaginate::ActionView::BootstrapLinkRenderer
|
||||
# https://github.com/yrgoldteeth/bootstrap-will_paginate
|
||||
|
||||
module WillPaginate
|
||||
module ActionView
|
||||
def will_paginate(collection = nil, options = { :renderer => WillPaginate::ActionView::LinkRenderer } )
|
||||
super.try :html_safe
|
||||
end
|
||||
|
||||
class BootstrapLinkRenderer < LinkRenderer
|
||||
protected
|
||||
|
||||
def html_container(html)
|
||||
tag :div, tag(:ul, html), container_attributes
|
||||
end
|
||||
|
||||
def page_number(page)
|
||||
tag :li, link(page, page, :rel => rel_value(page)), :class => ('active' if page == current_page)
|
||||
end
|
||||
|
||||
def gap
|
||||
tag :li, link(super, '#'), :class => 'disabled'
|
||||
end
|
||||
|
||||
def previous_or_next_page(page, text, classname)
|
||||
tag :li, link(text, page || '#'), :class => [classname[0..3], classname, ('disabled' unless page)].join(' ')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -601,9 +601,17 @@ select {
|
|||
|
||||
.navbar-fixed-top {
|
||||
position: fixed !important;
|
||||
|
||||
max-height: 45px !important;
|
||||
min-height: 45px !important;
|
||||
height: 45px !important;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
.notifications {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.notification_day_header {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue