mirror of
https://github.com/mcasimir/kaminari-bootstrap.git
synced 2022-11-09 13:46:52 -05:00
initial commit
This commit is contained in:
parent
ab5dfd072b
commit
489dbeb319
16 changed files with 241 additions and 82 deletions
15
Gemfile
15
Gemfile
|
@ -1,14 +1,9 @@
|
|||
source "http://rubygems.org"
|
||||
# Add dependencies required to use your gem here.
|
||||
# Example:
|
||||
# gem "activesupport", ">= 2.3.5"
|
||||
|
||||
# Add dependencies to develop your gem here.
|
||||
# Include everything needed to run rake, tests, features, etc.
|
||||
group :development do
|
||||
gem "shoulda", ">= 0"
|
||||
gem "rdoc", "~> 3.12"
|
||||
gem "bundler", "~> 1.0.0"
|
||||
gem 'rails'
|
||||
gem 'kaminari'
|
||||
|
||||
group :development do
|
||||
gem "bundler"
|
||||
gem "jeweler", "~> 1.8.4"
|
||||
gem "rcov", ">= 0"
|
||||
end
|
||||
|
|
98
Gemfile.lock
Normal file
98
Gemfile.lock
Normal file
|
@ -0,0 +1,98 @@
|
|||
GEM
|
||||
remote: http://rubygems.org/
|
||||
specs:
|
||||
actionmailer (3.2.7)
|
||||
actionpack (= 3.2.7)
|
||||
mail (~> 2.4.4)
|
||||
actionpack (3.2.7)
|
||||
activemodel (= 3.2.7)
|
||||
activesupport (= 3.2.7)
|
||||
builder (~> 3.0.0)
|
||||
erubis (~> 2.7.0)
|
||||
journey (~> 1.0.4)
|
||||
rack (~> 1.4.0)
|
||||
rack-cache (~> 1.2)
|
||||
rack-test (~> 0.6.1)
|
||||
sprockets (~> 2.1.3)
|
||||
activemodel (3.2.7)
|
||||
activesupport (= 3.2.7)
|
||||
builder (~> 3.0.0)
|
||||
activerecord (3.2.7)
|
||||
activemodel (= 3.2.7)
|
||||
activesupport (= 3.2.7)
|
||||
arel (~> 3.0.2)
|
||||
tzinfo (~> 0.3.29)
|
||||
activeresource (3.2.7)
|
||||
activemodel (= 3.2.7)
|
||||
activesupport (= 3.2.7)
|
||||
activesupport (3.2.7)
|
||||
i18n (~> 0.6)
|
||||
multi_json (~> 1.0)
|
||||
arel (3.0.2)
|
||||
builder (3.0.0)
|
||||
erubis (2.7.0)
|
||||
git (1.2.5)
|
||||
hike (1.2.1)
|
||||
i18n (0.6.0)
|
||||
jeweler (1.8.4)
|
||||
bundler (~> 1.0)
|
||||
git (>= 1.2.5)
|
||||
rake
|
||||
rdoc
|
||||
journey (1.0.4)
|
||||
json (1.7.4)
|
||||
kaminari (0.13.0)
|
||||
actionpack (>= 3.0.0)
|
||||
activesupport (>= 3.0.0)
|
||||
railties (>= 3.0.0)
|
||||
mail (2.4.4)
|
||||
i18n (>= 0.4.0)
|
||||
mime-types (~> 1.16)
|
||||
treetop (~> 1.4.8)
|
||||
mime-types (1.19)
|
||||
multi_json (1.3.6)
|
||||
polyglot (0.3.3)
|
||||
rack (1.4.1)
|
||||
rack-cache (1.2)
|
||||
rack (>= 0.4)
|
||||
rack-ssl (1.3.2)
|
||||
rack
|
||||
rack-test (0.6.1)
|
||||
rack (>= 1.0)
|
||||
rails (3.2.7)
|
||||
actionmailer (= 3.2.7)
|
||||
actionpack (= 3.2.7)
|
||||
activerecord (= 3.2.7)
|
||||
activeresource (= 3.2.7)
|
||||
activesupport (= 3.2.7)
|
||||
bundler (~> 1.0)
|
||||
railties (= 3.2.7)
|
||||
railties (3.2.7)
|
||||
actionpack (= 3.2.7)
|
||||
activesupport (= 3.2.7)
|
||||
rack-ssl (~> 1.3.2)
|
||||
rake (>= 0.8.7)
|
||||
rdoc (~> 3.4)
|
||||
thor (>= 0.14.6, < 2.0)
|
||||
rake (0.9.2.2)
|
||||
rdoc (3.12)
|
||||
json (~> 1.4)
|
||||
sprockets (2.1.3)
|
||||
hike (~> 1.2)
|
||||
rack (~> 1.0)
|
||||
tilt (~> 1.1, != 1.3.0)
|
||||
thor (0.15.4)
|
||||
tilt (1.3.3)
|
||||
treetop (1.4.10)
|
||||
polyglot
|
||||
polyglot (>= 0.3.1)
|
||||
tzinfo (0.3.33)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
bundler
|
||||
jeweler (~> 1.8.4)
|
||||
kaminari
|
||||
rails
|
30
README.md
Normal file
30
README.md
Normal file
|
@ -0,0 +1,30 @@
|
|||
# kaminari-bootstrap
|
||||
|
||||
Rails engine to use kaminari views with Twitter Bootstrap markup.
|
||||
|
||||
``` rb
|
||||
gem 'twitter-bootstrap'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Copyright (c) 2012 mcasimir
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
19
README.rdoc
19
README.rdoc
|
@ -1,19 +0,0 @@
|
|||
= kaminari-bootstrap
|
||||
|
||||
Description goes here.
|
||||
|
||||
== Contributing to kaminari-bootstrap
|
||||
|
||||
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
||||
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
||||
* Fork the project.
|
||||
* Start a feature/bugfix branch.
|
||||
* Commit and push until you are happy with your contribution.
|
||||
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
||||
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
||||
|
||||
== Copyright
|
||||
|
||||
Copyright (c) 2012 mcasimir. See LICENSE.txt for
|
||||
further details.
|
||||
|
29
Rakefile
29
Rakefile
|
@ -23,31 +23,4 @@ Jeweler::Tasks.new do |gem|
|
|||
gem.authors = ["mcasimir"]
|
||||
# dependencies defined in Gemfile
|
||||
end
|
||||
Jeweler::RubygemsDotOrgTasks.new
|
||||
|
||||
require 'rake/testtask'
|
||||
Rake::TestTask.new(:test) do |test|
|
||||
test.libs << 'lib' << 'test'
|
||||
test.pattern = 'test/**/test_*.rb'
|
||||
test.verbose = true
|
||||
end
|
||||
|
||||
require 'rcov/rcovtask'
|
||||
Rcov::RcovTask.new do |test|
|
||||
test.libs << 'test'
|
||||
test.pattern = 'test/**/test_*.rb'
|
||||
test.verbose = true
|
||||
test.rcov_opts << '--exclude "gems/*"'
|
||||
end
|
||||
|
||||
task :default => :test
|
||||
|
||||
require 'rdoc/task'
|
||||
Rake::RDocTask.new do |rdoc|
|
||||
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
||||
|
||||
rdoc.rdoc_dir = 'rdoc'
|
||||
rdoc.title = "kaminari-bootstrap #{version}"
|
||||
rdoc.rdoc_files.include('README*')
|
||||
rdoc.rdoc_files.include('lib/**/*.rb')
|
||||
end
|
||||
Jeweler::RubygemsDotOrgTasks.new
|
13
app/views/kaminari/_first_page.html.erb
Normal file
13
app/views/kaminari/_first_page.html.erb
Normal file
|
@ -0,0 +1,13 @@
|
|||
<%# 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
|
||||
-%>
|
||||
<% unless current_page.first? -%>
|
||||
<li>
|
||||
<%= link_to raw(t 'views.pagination.first'), url, {:remote => remote} %>
|
||||
</li>
|
||||
<% end -%>
|
8
app/views/kaminari/_gap.html.erb
Normal file
8
app/views/kaminari/_gap.html.erb
Normal file
|
@ -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
|
||||
-%>
|
||||
<li class="page gap disabled"><a href="javascript:void(0)"><%= raw(t 'views.pagination.truncate') %></a></li>
|
13
app/views/kaminari/_last_page.html.erb
Normal file
13
app/views/kaminari/_last_page.html.erb
Normal file
|
@ -0,0 +1,13 @@
|
|||
<%# 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
|
||||
-%>
|
||||
<% unless current_page.last? -%>
|
||||
<li>
|
||||
<%= link_to raw(t 'views.pagination.last'), url, {:remote => remote} %>
|
||||
</li>
|
||||
<% end -%>
|
14
app/views/kaminari/_next_page.html.erb
Normal file
14
app/views/kaminari/_next_page.html.erb
Normal file
|
@ -0,0 +1,14 @@
|
|||
<%# 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
|
||||
-%>
|
||||
|
||||
<% unless current_page.last? -%>
|
||||
<li>
|
||||
<%= link_to raw(t 'views.pagination.next'), url, :remote => remote, :rel => 'next' %>
|
||||
</li>
|
||||
<% end -%>
|
12
app/views/kaminari/_page.html.erb
Normal file
12
app/views/kaminari/_page.html.erb
Normal file
|
@ -0,0 +1,12 @@
|
|||
<%# 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
|
||||
-%>
|
||||
<li class="page<%= ' active' if page.current? %>">
|
||||
<%= link_to page, (page.current? ? 'javascript:void(0)' : url), opts = {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %>
|
||||
</li>
|
27
app/views/kaminari/_paginator.html.erb
Normal file
27
app/views/kaminari/_paginator.html.erb
Normal file
|
@ -0,0 +1,27 @@
|
|||
<%# 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
|
||||
-%>
|
||||
<%= paginator.render do -%>
|
||||
<nav class="pagination">
|
||||
<% if num_pages > 0 -%>
|
||||
<ul>
|
||||
<%= first_page_tag unless current_page.first? %>
|
||||
<%= prev_page_tag unless current_page.first? %>
|
||||
<% each_page do |page| -%>
|
||||
<% if page.left_outer? || page.right_outer? || page.inside_window? -%>
|
||||
<%= page_tag page %>
|
||||
<% elsif !page.was_truncated? -%>
|
||||
<%= gap_tag %>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<%= next_page_tag unless current_page.last? %>
|
||||
<%= last_page_tag unless current_page.last? %>
|
||||
</ul>
|
||||
<% end -%>
|
||||
</nav>
|
||||
<% end -%>
|
13
app/views/kaminari/_prev_page.html.erb
Normal file
13
app/views/kaminari/_prev_page.html.erb
Normal file
|
@ -0,0 +1,13 @@
|
|||
<%# 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
|
||||
-%>
|
||||
<% unless current_page.first? -%>
|
||||
<li>
|
||||
<%= link_to raw(t 'views.pagination.previous'), url, :remote => remote, :rel => 'prev' %>
|
||||
</li>
|
||||
<% end -%>
|
7
lib/kaminari_bootstrap.rb
Normal file
7
lib/kaminari_bootstrap.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
require 'kaminari'
|
||||
require 'rails'
|
||||
|
||||
module KaminariBootstrap
|
||||
class Engine < ::Rails::Engine
|
||||
end
|
||||
end
|
|
@ -1,18 +0,0 @@
|
|||
require 'rubygems'
|
||||
require 'bundler'
|
||||
begin
|
||||
Bundler.setup(:default, :development)
|
||||
rescue Bundler::BundlerError => e
|
||||
$stderr.puts e.message
|
||||
$stderr.puts "Run `bundle install` to install missing gems"
|
||||
exit e.status_code
|
||||
end
|
||||
require 'test/unit'
|
||||
require 'shoulda'
|
||||
|
||||
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
||||
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
||||
require 'kaminari-bootstrap'
|
||||
|
||||
class Test::Unit::TestCase
|
||||
end
|
|
@ -1,7 +0,0 @@
|
|||
require 'helper'
|
||||
|
||||
class TestKaminariBootstrap < Test::Unit::TestCase
|
||||
should "probably rename this file and start testing for real" do
|
||||
flunk "hey buddy, you should probably rename this file and start testing for real"
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue