diff --git a/Gemfile b/Gemfile index 9d71905..2cbc521 100644 --- a/Gemfile +++ b/Gemfile @@ -1,13 +1,10 @@ source "http://rubygems.org" -# Declare your gem's dependencies in bootstrap-kaminari-views.gemspec. +# Declare your gem's dependencies in dvl-kaminari-views.gemspec. # Bundler will treat runtime dependencies like base dependencies, and # development dependencies will be added by default to the :development group. gemspec -# jquery-rails is used by the dummy application -gem "jquery-rails" - # Declare any dependencies that are still in development here instead of in # your gemspec. These might include edge Rails or gems from your path or # Git. Remember to move these dependencies to your gemspec before releasing diff --git a/MIT-LICENSE b/MIT-LICENSE deleted file mode 100644 index 406f17b..0000000 --- a/MIT-LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright 2012 YOURNAME - -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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..0fcc046 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +## Dvl Kaminari Views + +Integrates Kaminari and [dvl-core](https://github.com/dobtco/dvl-core). + +### Usage + +```rb +# Gemfile +gem 'kaminari' +gem 'dvl-kaminari-views' +``` + +### License + +[MIT](http://dobtco.mit-license.org/) diff --git a/README.rdoc b/README.rdoc deleted file mode 100644 index 4a9cb49..0000000 --- a/README.rdoc +++ /dev/null @@ -1,50 +0,0 @@ -= Bootstrap Kaminari Views - -{Gem Version}[http://badge.fury.io/rb/bootstrap-kaminari-views] - -Basic Gem for quick default inclusion of {Kaminari}[https://github.com/amatsuda/kaminari] theme compatible with {Twitter Bootstrap 2.0}[http://getbootstrap.com/2.3.2/] and {Twitter Bootstrap 3.0}[http://getbootstrap.com] - -= Usage - -Ensure your gemfile contains - - gem 'kaminari' - gem 'bootstrap-kaminari-views' - -Render Pagination with a theme - - = paginate @posts, :theme => 'twitter-bootstrap' - - = paginate @posts, :theme => 'twitter-bootstrap-3' - -Render with specific pagination classes - - = paginate @posts, :theme => 'twitter-bootstrap-3', - :pagination_class => "pagination-sm" - -Render with specific pagination classes - - = paginate @posts, :theme => 'twitter-bootstrap', - :pagination_class => "pagination-small pagination-centered" - -== Default Options - -If you want to use one or more options as the default across your app, you can override the helper method in your +application_helper.rb+ file: - - - module ApplicationHelper - - def paginate objects, options = {} - options.reverse_merge!( theme: 'twitter-bootstrap' ) - - super( objects, options ) - end - - end - - -= Credits - -{Kaminari}[https://github.com/amatsuda/kaminari] - For making an awesome gem - -{twitter-bootstrap-kaminari-views}[https://github.com/gabetax/twitter-bootstrap-kaminari-views] - Non Gemified Implementation diff --git a/Rakefile b/Rakefile deleted file mode 100644 index c34f93e..0000000 --- a/Rakefile +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env rake -begin - require 'bundler/setup' -rescue LoadError - puts 'You must `gem install bundler` and `bundle install` to run rake tasks' -end -begin - require 'rdoc/task' -rescue LoadError - require 'rdoc/rdoc' - require 'rake/rdoctask' - RDoc::Task = Rake::RDocTask -end - -RDoc::Task.new(:rdoc) do |rdoc| - rdoc.rdoc_dir = 'rdoc' - rdoc.title = 'BootstrapKaminariViews' - rdoc.options << '--line-numbers' - rdoc.rdoc_files.include('README.rdoc') - rdoc.rdoc_files.include('lib/**/*.rb') -end - - - - -Bundler::GemHelper.install_tasks - -require 'rake/testtask' - -Rake::TestTask.new(:test) do |t| - t.libs << 'lib' - t.libs << 'test' - t.pattern = 'test/**/*_test.rb' - t.verbose = false -end - - -task :default => :test diff --git a/app/helpers/dvl_kaminari_helper.rb b/app/helpers/dvl_kaminari_helper.rb new file mode 100644 index 0000000..767a8b1 --- /dev/null +++ b/app/helpers/dvl_kaminari_helper.rb @@ -0,0 +1,9 @@ +module DvlKaminariHelper + def paginate(objects, options = {}) + super(objects, options.reverse_merge( + theme: 'dvl', + window: 3, + outer_window: 2 + )) + end +end diff --git a/app/views/kaminari/dvl/_gap.html.erb b/app/views/kaminari/dvl/_gap.html.erb new file mode 100644 index 0000000..78f1046 --- /dev/null +++ b/app/views/kaminari/dvl/_gap.html.erb @@ -0,0 +1 @@ +
  • diff --git a/app/views/kaminari/dvl/_next_page.html.erb b/app/views/kaminari/dvl/_next_page.html.erb new file mode 100644 index 0000000..fd8e347 --- /dev/null +++ b/app/views/kaminari/dvl/_next_page.html.erb @@ -0,0 +1,7 @@ +<% if current_page.last? %> +
  • +<% else %> +
  • + <%= link_to '→'.html_safe, url, :rel => 'next', :remote => remote %> +
  • +<% end %> diff --git a/app/views/kaminari/dvl/_page.html.erb b/app/views/kaminari/dvl/_page.html.erb new file mode 100644 index 0000000..7d53f17 --- /dev/null +++ b/app/views/kaminari/dvl/_page.html.erb @@ -0,0 +1,9 @@ +<% if page.current? %> +
  • + <%= page %> +
  • +<% else %> +
  • + <%= link_to page, url, opts = {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %> +
  • +<% end %> diff --git a/app/views/kaminari/dvl/_paginator.html.erb b/app/views/kaminari/dvl/_paginator.html.erb new file mode 100644 index 0000000..528db37 --- /dev/null +++ b/app/views/kaminari/dvl/_paginator.html.erb @@ -0,0 +1,17 @@ +<% pagination_class ||= "" %> + +<%= paginator.render do -%> + +<% end -%> diff --git a/app/views/kaminari/dvl/_prev_page.html.erb b/app/views/kaminari/dvl/_prev_page.html.erb new file mode 100644 index 0000000..84b9391 --- /dev/null +++ b/app/views/kaminari/dvl/_prev_page.html.erb @@ -0,0 +1,7 @@ +<% if current_page.first? %> +
  • +<% else %> +
  • + <%= link_to '←'.html_safe, url, :rel => 'prev', :remote => remote %> +
  • +<% end %> diff --git a/app/views/kaminari/twitter-bootstrap-3/_first_page.html.erb b/app/views/kaminari/twitter-bootstrap-3/_first_page.html.erb deleted file mode 100644 index f7e9846..0000000 --- a/app/views/kaminari/twitter-bootstrap-3/_first_page.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -<%# 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? %> -
  • - <%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote %> -
  • -<% end %> \ No newline at end of file diff --git a/app/views/kaminari/twitter-bootstrap-3/_gap.html.erb b/app/views/kaminari/twitter-bootstrap-3/_gap.html.erb deleted file mode 100644 index 2bcc522..0000000 --- a/app/views/kaminari/twitter-bootstrap-3/_gap.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -<%# 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 --%> -
  • <%= raw(t 'views.pagination.truncate') %>
  • \ No newline at end of file diff --git a/app/views/kaminari/twitter-bootstrap-3/_last_page.html.erb b/app/views/kaminari/twitter-bootstrap-3/_last_page.html.erb deleted file mode 100644 index e27c2a7..0000000 --- a/app/views/kaminari/twitter-bootstrap-3/_last_page.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -<%# 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? %> - -<% end %> diff --git a/app/views/kaminari/twitter-bootstrap-3/_next_page.html.erb b/app/views/kaminari/twitter-bootstrap-3/_next_page.html.erb deleted file mode 100644 index 7bccfdc..0000000 --- a/app/views/kaminari/twitter-bootstrap-3/_next_page.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -<%# 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? %> -
  • - <%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote %> -
  • -<% end %> diff --git a/app/views/kaminari/twitter-bootstrap-3/_page.html.erb b/app/views/kaminari/twitter-bootstrap-3/_page.html.erb deleted file mode 100644 index 3cf4a8e..0000000 --- a/app/views/kaminari/twitter-bootstrap-3/_page.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -<%# 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} %> -
  • diff --git a/app/views/kaminari/twitter-bootstrap-3/_paginator.html.erb b/app/views/kaminari/twitter-bootstrap-3/_paginator.html.erb deleted file mode 100644 index 1fb25e2..0000000 --- a/app/views/kaminari/twitter-bootstrap-3/_paginator.html.erb +++ /dev/null @@ -1,24 +0,0 @@ -<%# 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 --%> -<%- pagination_class ||= '' %> -<%= paginator.render do -%> - -<% end -%> diff --git a/app/views/kaminari/twitter-bootstrap-3/_prev_page.html.erb b/app/views/kaminari/twitter-bootstrap-3/_prev_page.html.erb deleted file mode 100644 index 336073b..0000000 --- a/app/views/kaminari/twitter-bootstrap-3/_prev_page.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -<%# 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? %> - -<% end %> diff --git a/app/views/kaminari/twitter-bootstrap/_first_page.html.erb b/app/views/kaminari/twitter-bootstrap/_first_page.html.erb deleted file mode 100644 index f7e9846..0000000 --- a/app/views/kaminari/twitter-bootstrap/_first_page.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -<%# 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? %> -
  • - <%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote %> -
  • -<% end %> \ No newline at end of file diff --git a/app/views/kaminari/twitter-bootstrap/_gap.html.erb b/app/views/kaminari/twitter-bootstrap/_gap.html.erb deleted file mode 100644 index 2bcc522..0000000 --- a/app/views/kaminari/twitter-bootstrap/_gap.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -<%# 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 --%> -
  • <%= raw(t 'views.pagination.truncate') %>
  • \ No newline at end of file diff --git a/app/views/kaminari/twitter-bootstrap/_last_page.html.erb b/app/views/kaminari/twitter-bootstrap/_last_page.html.erb deleted file mode 100644 index e27c2a7..0000000 --- a/app/views/kaminari/twitter-bootstrap/_last_page.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -<%# 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? %> - -<% end %> diff --git a/app/views/kaminari/twitter-bootstrap/_next_page.html.erb b/app/views/kaminari/twitter-bootstrap/_next_page.html.erb deleted file mode 100644 index 7bccfdc..0000000 --- a/app/views/kaminari/twitter-bootstrap/_next_page.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -<%# 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? %> -
  • - <%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote %> -
  • -<% end %> diff --git a/app/views/kaminari/twitter-bootstrap/_page.html.erb b/app/views/kaminari/twitter-bootstrap/_page.html.erb deleted file mode 100644 index 3cf4a8e..0000000 --- a/app/views/kaminari/twitter-bootstrap/_page.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -<%# 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} %> -
  • diff --git a/app/views/kaminari/twitter-bootstrap/_paginator.html.erb b/app/views/kaminari/twitter-bootstrap/_paginator.html.erb deleted file mode 100644 index 9482ec6..0000000 --- a/app/views/kaminari/twitter-bootstrap/_paginator.html.erb +++ /dev/null @@ -1,27 +0,0 @@ -<%# 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 --%> -<% pagination_class ||= "" %> - -<%= paginator.render do -%> - -<% end -%> diff --git a/app/views/kaminari/twitter-bootstrap/_prev_page.html.erb b/app/views/kaminari/twitter-bootstrap/_prev_page.html.erb deleted file mode 100644 index 336073b..0000000 --- a/app/views/kaminari/twitter-bootstrap/_prev_page.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -<%# 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? %> - -<% end %> diff --git a/bootstrap-kaminari-views.gemspec b/bootstrap-kaminari-views.gemspec deleted file mode 100644 index 5dd0684..0000000 --- a/bootstrap-kaminari-views.gemspec +++ /dev/null @@ -1,22 +0,0 @@ -$:.push File.expand_path("../lib", __FILE__) - -# Maintain your gem's version: -require "bootstrap-kaminari-views/version" - -# Describe your gem and declare its dependencies: -Gem::Specification.new do |s| - s.name = "bootstrap-kaminari-views" - s.version = BootstrapKaminariViews::VERSION - s.authors = ["Matenia Rossides"] - s.email = ["matenia@gmail.com"] - s.homepage = "http://github.com/matenia/bootstrap-kaminari-views" - s.summary = "Bootstrap-ify pagination with Kaminari" - s.description = "Bootstrap-ify pagination with Kaminari - Compatible with Bootstrap 2.x, 3.x" - - s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"] - - s.add_dependency "rails", ">= 3.1" - s.add_dependency "kaminari", ">= 0.13" - - s.add_development_dependency "sqlite3" -end diff --git a/dvl-kaminari-views.gemspec b/dvl-kaminari-views.gemspec new file mode 100644 index 0000000..712456a --- /dev/null +++ b/dvl-kaminari-views.gemspec @@ -0,0 +1,20 @@ +$:.push File.expand_path("../lib", __FILE__) + +# Maintain your gem's version: +require "dvl-kaminari-views/version" + +# Describe your gem and declare its dependencies: +Gem::Specification.new do |s| + s.name = "dvl-kaminari-views" + s.version = DvlKaminariViews::VERSION + s.authors = ["Adam Becker"] + s.email = ["adam@dobt.co"] + s.homepage = "http://github.com/dobtco/dvl-kaminari-views" + s.summary = "Integrates Kaminari and dvl-core." + s.description = "Integrates Kaminari and dvl-core." + + s.license = 'MIT' + s.files = `git ls-files`.split("\n") + + s.add_dependency "kaminari", ">= 0.13" +end diff --git a/lib/bootstrap-kaminari-views/version.rb b/lib/bootstrap-kaminari-views/version.rb deleted file mode 100644 index 5adc44f..0000000 --- a/lib/bootstrap-kaminari-views/version.rb +++ /dev/null @@ -1,3 +0,0 @@ -module BootstrapKaminariViews - VERSION = "0.0.5" -end diff --git a/lib/bootstrap-kaminari-views.rb b/lib/dvl-kaminari-views.rb similarity index 57% rename from lib/bootstrap-kaminari-views.rb rename to lib/dvl-kaminari-views.rb index 480eced..66167f9 100644 --- a/lib/bootstrap-kaminari-views.rb +++ b/lib/dvl-kaminari-views.rb @@ -1,4 +1,4 @@ -module BootstrapKaminariViews +module DvlKaminariViews class Engine < Rails::Engine end end diff --git a/lib/dvl-kaminari-views/version.rb b/lib/dvl-kaminari-views/version.rb new file mode 100644 index 0000000..c069ad0 --- /dev/null +++ b/lib/dvl-kaminari-views/version.rb @@ -0,0 +1,3 @@ +module DvlKaminariViews + VERSION = '0.0.2' +end diff --git a/lib/tasks/bootstrap-kaminari-views_tasks.rake b/lib/tasks/bootstrap-kaminari-views_tasks.rake deleted file mode 100644 index 691dbf8..0000000 --- a/lib/tasks/bootstrap-kaminari-views_tasks.rake +++ /dev/null @@ -1,4 +0,0 @@ -# desc "Explaining what the task does" -# task :bootstrap-kaminari-views do -# # Task goes here -# end diff --git a/script/release b/script/release new file mode 100755 index 0000000..9b385a9 --- /dev/null +++ b/script/release @@ -0,0 +1,38 @@ +#!/bin/sh +# Tag and push a release. + +set -e + +# Make sure we're in the project root. + +cd $(dirname "$0")/.. + +# Build a new gem archive. + +rm -rf dvl-kaminari-views-*.gem +gem build -q dvl-kaminari-views.gemspec + +# Make sure we're on the master branch. + +(git branch | grep -q '* master') || { + echo "Only release from the master branch." + exit 1 +} + +# Figure out what version we're releasing. + +tag=v`ls dvl-kaminari-views-*.gem | sed 's/^dvl-kaminari-views-\(.*\)\.gem$/\1/'` + +# Make sure we haven't released this version before. + +git fetch -t origin + +(git tag -l | grep -q "$tag") && { + echo "Whoops, there's already a '${tag}' tag." + exit 1 +} + +# Tag it and bag it. + +gem push dvl-kaminari-views-*.gem && git tag "$tag" && + git push origin master && git push origin "$tag"