Skip to content

Loading…

Twitter Bootstrap #2

Closed
wants to merge 1 commit into from

2 participants

@bishopandco

ERB Templates added.

Michael Bishop adds twitter theme ea7cdff
@amatsuda
Owner

Finally merged #8 which is compatible with the Bootstrap 2.0. Thank you very much!

@amatsuda amatsuda closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 23, 2011
  1. adds twitter theme

    Michael Bishop committed
View
1 twitter/DESCRIPTION
@@ -0,0 +1 @@
+Attempts to line up with the markup strategy of Twitter Bootstrap.
View
10 twitter/app/views/kaminari/_first_page.html.erb
@@ -0,0 +1,10 @@
+<%# Link to the "First" page
+ - available local variables
+ url: url to the first page
+ current_page: a page object for the currently displayed page
+ num_pages: total number of pages
+ per_page: number of items to fetch per page
+ remote: data-remote
+ -%>
+<%= link_to raw(t 'views.pagination.first'), url, :remote => remote %>
+
View
8 twitter/app/views/kaminari/_gap.html.erb
@@ -0,0 +1,8 @@
+<%# Non-link tag that stands for skipped pages...
+ - available local variables
+ current_page: a page object for the currently displayed page
+ num_pages: total number of pages
+ per_page: number of items to fetch per page
+ remote: data-remote
+-%>
+<a><%= raw(t 'views.pagination.truncate') %></a>
View
10 twitter/app/views/kaminari/_last_page.html.erb
@@ -0,0 +1,10 @@
+<%# Link to the "Last" page
+ - available local variables
+ url: url to the last page
+ current_page: a page object for the currently displayed page
+ num_pages: total number of pages
+ per_page: number of items to fetch per page
+ remote: data-remote
+-%>
+
+<%= link_to raw(t 'views.pagination.last'), url, {:remote => remote} %>
View
10 twitter/app/views/kaminari/_next_page.html.erb
@@ -0,0 +1,10 @@
+<%# Link to the "Next" page
+ - available local variables
+ url: url to the next page
+ current_page: a page object for the currently displayed page
+ num_pages: total number of pages
+ per_page: number of items to fetch per page
+ remote: data-remote
+-%>
+
+<%= link_to raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote, :class => "next" %>
View
10 twitter/app/views/kaminari/_page.html.erb
@@ -0,0 +1,10 @@
+<%# Link showing page number
+ - available local variables
+ page: a page object for "this" page
+ url: url to this page
+ current_page: a page object for the currently displayed page
+ num_pages: total number of pages
+ per_page: number of items to fetch per page
+ remote: data-remote
+ -%>
+<%= link_to page, url, opts = {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %>
View
46 twitter/app/views/kaminari/_paginator.html.erb
@@ -0,0 +1,46 @@
+<%# The container tag
+ - available local variables
+ current_page: a page object for the currently displayed page
+ num_pages: total number of pages
+ per_page: number of items to fetch per page
+ remote: data-remote
+ paginator: the paginator that renders the pagination tags inside
+ -%>
+ <% unless num_pages == 1 %>
+<div class="pagination">
+ <ul>
+ <% if current_page.first? %>
+ <%= content_tag(:li, paginator.first_page_tag, :class => "prev disabled") %>
+ <%= content_tag(:li, paginator.prev_page_tag, :class => "disabled") %>
+ <% else %>
+ <%= content_tag(:li, paginator.first_page_tag, :class => "prev") %>
+ <%= content_tag(:li, paginator.prev_page_tag) %>
+
+ <% end %>
+
+ <% paginator.each_page do |page| %>
+
+ <% if page.left_outer? || page.right_outer? || page.inside_window? %>
+ <% if page == current_page %>
+ <%= content_tag(:li, paginator.page_tag(page), :class => "active") %>
+ <% else %>
+ <%= content_tag(:li, paginator.page_tag(page)) %>
+ <% end %>
+ <% elsif !page.was_truncated? %>
+ <%= content_tag(:li, paginator.gap_tag, :class => "disabled") %>
+ <% end %>
+
+ <% end %>
+
+ <% if current_page.last? %>
+ <%= content_tag(:li, paginator.next_page_tag, :class => "disabled") %>
+ <%= content_tag(:li, paginator.last_page_tag, :class => "disabled next") %>
+ <% else %>
+ <%= content_tag(:li, paginator.next_page_tag) %>
+ <%= content_tag(:li, paginator.last_page_tag, :class => "next") %>
+ <% end %>
+
+
+ </ul>
+</div>
+<% end %>
View
10 twitter/app/views/kaminari/_prev_page.html.erb
@@ -0,0 +1,10 @@
+<%# Link to the "Previous" page
+ - available local variables
+ url: url to the previous page
+ current_page: a page object for the currently displayed page
+ num_pages: total number of pages
+ per_page: number of items to fetch per page
+ remote: data-remote
+-%>
+<%= link_to raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote, :class => "prev" %>
+
Something went wrong with that request. Please try again.