kaminari 0.14.1 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +19 -0
  3. data/.document +1 -4
  4. data/.gitignore +2 -1
  5. data/.travis.yml +91 -10
  6. data/CHANGELOG.md +636 -0
  7. data/CONTRIBUTING.md +22 -0
  8. data/Gemfile +3 -1
  9. data/README.md +573 -0
  10. data/Rakefile +43 -20
  11. data/gemfiles/active_record_41.gemfile +28 -0
  12. data/gemfiles/active_record_42.gemfile +28 -0
  13. data/gemfiles/active_record_50.gemfile +24 -0
  14. data/gemfiles/active_record_51.gemfile +24 -0
  15. data/gemfiles/active_record_52.gemfile +24 -0
  16. data/gemfiles/active_record_60.gemfile +26 -0
  17. data/gemfiles/active_record_edge.gemfile +33 -0
  18. data/kaminari.gemspec +23 -28
  19. data/lib/kaminari/version.rb +3 -1
  20. data/lib/kaminari.rb +4 -37
  21. data/misc/bug_report_template.rb +57 -0
  22. metadata +67 -229
  23. data/.gemtest +0 -0
  24. data/.rspec +0 -2
  25. data/CHANGELOG +0 -351
  26. data/README.rdoc +0 -295
  27. data/app/views/kaminari/_first_page.html.erb +0 -11
  28. data/app/views/kaminari/_first_page.html.haml +0 -9
  29. data/app/views/kaminari/_first_page.html.slim +0 -10
  30. data/app/views/kaminari/_gap.html.erb +0 -8
  31. data/app/views/kaminari/_gap.html.haml +0 -8
  32. data/app/views/kaminari/_gap.html.slim +0 -9
  33. data/app/views/kaminari/_last_page.html.erb +0 -11
  34. data/app/views/kaminari/_last_page.html.haml +0 -9
  35. data/app/views/kaminari/_last_page.html.slim +0 -10
  36. data/app/views/kaminari/_next_page.html.erb +0 -11
  37. data/app/views/kaminari/_next_page.html.haml +0 -9
  38. data/app/views/kaminari/_next_page.html.slim +0 -10
  39. data/app/views/kaminari/_page.html.erb +0 -12
  40. data/app/views/kaminari/_page.html.haml +0 -10
  41. data/app/views/kaminari/_page.html.slim +0 -11
  42. data/app/views/kaminari/_paginator.html.erb +0 -23
  43. data/app/views/kaminari/_paginator.html.haml +0 -18
  44. data/app/views/kaminari/_paginator.html.slim +0 -19
  45. data/app/views/kaminari/_prev_page.html.erb +0 -11
  46. data/app/views/kaminari/_prev_page.html.haml +0 -9
  47. data/app/views/kaminari/_prev_page.html.slim +0 -10
  48. data/config/locales/kaminari.yml +0 -19
  49. data/gemfiles/active_record_30.gemfile +0 -7
  50. data/gemfiles/active_record_31.gemfile +0 -7
  51. data/gemfiles/active_record_32.gemfile +0 -7
  52. data/gemfiles/data_mapper_12.gemfile +0 -12
  53. data/gemfiles/mongo_mapper.gemfile +0 -7
  54. data/gemfiles/mongoid_24.gemfile +0 -7
  55. data/gemfiles/mongoid_30.gemfile +0 -7
  56. data/gemfiles/sinatra.gemfile +0 -10
  57. data/lib/generators/kaminari/config_generator.rb +0 -16
  58. data/lib/generators/kaminari/templates/kaminari_config.rb +0 -10
  59. data/lib/generators/kaminari/views_generator.rb +0 -118
  60. data/lib/kaminari/config.rb +0 -49
  61. data/lib/kaminari/engine.rb +0 -4
  62. data/lib/kaminari/grape.rb +0 -4
  63. data/lib/kaminari/helpers/action_view_extension.rb +0 -151
  64. data/lib/kaminari/helpers/paginator.rb +0 -175
  65. data/lib/kaminari/helpers/sinatra_helpers.rb +0 -138
  66. data/lib/kaminari/helpers/tags.rb +0 -95
  67. data/lib/kaminari/hooks.rb +0 -37
  68. data/lib/kaminari/models/active_record_extension.rb +0 -22
  69. data/lib/kaminari/models/active_record_model_extension.rb +0 -20
  70. data/lib/kaminari/models/active_record_relation_methods.rb +0 -31
  71. data/lib/kaminari/models/array_extension.rb +0 -60
  72. data/lib/kaminari/models/configuration_methods.rb +0 -34
  73. data/lib/kaminari/models/data_mapper_collection_methods.rb +0 -15
  74. data/lib/kaminari/models/data_mapper_extension.rb +0 -48
  75. data/lib/kaminari/models/mongo_mapper_extension.rb +0 -18
  76. data/lib/kaminari/models/mongoid_criteria_methods.rb +0 -23
  77. data/lib/kaminari/models/mongoid_extension.rb +0 -33
  78. data/lib/kaminari/models/page_scope_methods.rb +0 -41
  79. data/lib/kaminari/models/plucky_criteria_methods.rb +0 -18
  80. data/lib/kaminari/railtie.rb +0 -7
  81. data/lib/kaminari/sinatra.rb +0 -5
  82. data/spec/config/config_spec.rb +0 -76
  83. data/spec/fake_app/active_record/config.rb +0 -3
  84. data/spec/fake_app/active_record/models.rb +0 -57
  85. data/spec/fake_app/data_mapper/config.rb +0 -1
  86. data/spec/fake_app/data_mapper/models.rb +0 -27
  87. data/spec/fake_app/mongo_mapper/config.rb +0 -2
  88. data/spec/fake_app/mongo_mapper/models.rb +0 -9
  89. data/spec/fake_app/mongoid/config.rb +0 -16
  90. data/spec/fake_app/mongoid/models.rb +0 -22
  91. data/spec/fake_app/rails_app.rb +0 -55
  92. data/spec/fake_app/sinatra_app.rb +0 -22
  93. data/spec/fake_gem.rb +0 -4
  94. data/spec/helpers/action_view_extension_spec.rb +0 -262
  95. data/spec/helpers/helpers_spec.rb +0 -135
  96. data/spec/helpers/sinatra_helpers_spec.rb +0 -170
  97. data/spec/helpers/tags_spec.rb +0 -140
  98. data/spec/models/active_record/active_record_relation_methods_spec.rb +0 -30
  99. data/spec/models/active_record/default_per_page_spec.rb +0 -32
  100. data/spec/models/active_record/max_per_page_spec.rb +0 -32
  101. data/spec/models/active_record/scopes_spec.rb +0 -166
  102. data/spec/models/array_spec.rb +0 -121
  103. data/spec/models/data_mapper/data_mapper_spec.rb +0 -155
  104. data/spec/models/mongo_mapper/mongo_mapper_spec.rb +0 -72
  105. data/spec/models/mongoid/mongoid_spec.rb +0 -110
  106. data/spec/requests/users_spec.rb +0 -53
  107. data/spec/spec_helper.rb +0 -32
  108. data/spec/spec_helper_for_sinatra.rb +0 -35
  109. data/spec/support/database_cleaner.rb +0 -16
  110. data/spec/support/matchers.rb +0 -52
@@ -1,9 +0,0 @@
1
- / Non-link tag that stands for skipped pages...
2
- - available local variables
3
- current_page : a page object for the currently displayed page
4
- total_pages : total number of pages
5
- per_page : number of items to fetch per page
6
- remote : data-remote
7
- span.page.gap
8
- == raw(t 'views.pagination.truncate')
9
- '
@@ -1,11 +0,0 @@
1
- <%# Link to the "Last" page
2
- - available local variables
3
- url: url to the last page
4
- current_page: a page object for the currently displayed page
5
- total_pages: total number of pages
6
- per_page: number of items to fetch per page
7
- remote: data-remote
8
- -%>
9
- <span class="last">
10
- <%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote} %>
11
- </span>
@@ -1,9 +0,0 @@
1
- -# Link to the "Last" page
2
- -# available local variables
3
- -# url: url to the last page
4
- -# current_page: a page object for the currently displayed page
5
- -# total_pages: total number of pages
6
- -# per_page: number of items to fetch per page
7
- -# remote: data-remote
8
- %span.last
9
- = link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote}
@@ -1,10 +0,0 @@
1
- / Link to the "Last" page
2
- - available local variables
3
- url : url to the last page
4
- current_page : a page object for the currently displayed page
5
- total_pages : total number of pages
6
- per_page : number of items to fetch per page
7
- remote : data-remote
8
- span.last
9
- == link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote}
10
- '
@@ -1,11 +0,0 @@
1
- <%# Link to the "Next" page
2
- - available local variables
3
- url: url to the next page
4
- current_page: a page object for the currently displayed page
5
- total_pages: total number of pages
6
- per_page: number of items to fetch per page
7
- remote: data-remote
8
- -%>
9
- <span class="next">
10
- <%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote %>
11
- </span>
@@ -1,9 +0,0 @@
1
- -# Link to the "Next" page
2
- -# available local variables
3
- -# url: url to the next page
4
- -# current_page: a page object for the currently displayed page
5
- -# total_pages: total number of pages
6
- -# per_page: number of items to fetch per page
7
- -# remote: data-remote
8
- %span.next
9
- = link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote
@@ -1,10 +0,0 @@
1
- / Link to the "Next" page
2
- - available local variables
3
- url : url to the next page
4
- current_page : a page object for the currently displayed page
5
- total_pages : total number of pages
6
- per_page : number of items to fetch per page
7
- remote : data-remote
8
- span.next
9
- == link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote
10
- '
@@ -1,12 +0,0 @@
1
- <%# Link showing page number
2
- - available local variables
3
- page: a page object for "this" page
4
- url: url to this page
5
- current_page: a page object for the currently displayed page
6
- total_pages: total number of pages
7
- per_page: number of items to fetch per page
8
- remote: data-remote
9
- -%>
10
- <span class="page<%= ' current' if page.current? %>">
11
- <%= link_to_unless page.current?, page, url, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %>
12
- </span>
@@ -1,10 +0,0 @@
1
- -# Link showing page number
2
- -# available local variables
3
- -# page: a page object for "this" page
4
- -# url: url to this page
5
- -# current_page: a page object for the currently displayed page
6
- -# total_pages: total number of pages
7
- -# per_page: number of items to fetch per page
8
- -# remote: data-remote
9
- %span{:class => "page#{' current' if page.current?}"}
10
- = link_to_unless page.current?, page, url, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil}
@@ -1,11 +0,0 @@
1
- / Link showing page number
2
- - available local variables
3
- page : a page object for "this" page
4
- url : url to this page
5
- current_page : a page object for the currently displayed page
6
- total_pages : total number of pages
7
- per_page : number of items to fetch per page
8
- remote : data-remote
9
- span class="page#{' current' if page.current?}"
10
- == link_to_unless page.current?, page, url, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil}
11
- '
@@ -1,23 +0,0 @@
1
- <%# The container tag
2
- - available local variables
3
- current_page: a page object for the currently displayed page
4
- total_pages: total number of pages
5
- per_page: number of items to fetch per page
6
- remote: data-remote
7
- paginator: the paginator that renders the pagination tags inside
8
- -%>
9
- <%= paginator.render do -%>
10
- <nav class="pagination">
11
- <%= first_page_tag unless current_page.first? %>
12
- <%= prev_page_tag unless current_page.first? %>
13
- <% each_page do |page| -%>
14
- <% if page.left_outer? || page.right_outer? || page.inside_window? -%>
15
- <%= page_tag page %>
16
- <% elsif !page.was_truncated? -%>
17
- <%= gap_tag %>
18
- <% end -%>
19
- <% end -%>
20
- <%= next_page_tag unless current_page.last? %>
21
- <%= last_page_tag unless current_page.last? %>
22
- </nav>
23
- <% end -%>
@@ -1,18 +0,0 @@
1
- -# The container tag
2
- -# available local variables
3
- -# current_page: a page object for the currently displayed page
4
- -# total_pages: total number of pages
5
- -# per_page: number of items to fetch per page
6
- -# remote: data-remote
7
- -# paginator: the paginator that renders the pagination tags inside
8
- = paginator.render do
9
- %nav.pagination
10
- = first_page_tag unless current_page.first?
11
- = prev_page_tag unless current_page.first?
12
- - each_page do |page|
13
- - if page.left_outer? || page.right_outer? || page.inside_window?
14
- = page_tag page
15
- - elsif !page.was_truncated?
16
- = gap_tag
17
- = next_page_tag unless current_page.last?
18
- = last_page_tag unless current_page.last?
@@ -1,19 +0,0 @@
1
- / The container tag
2
- - available local variables
3
- current_page : a page object for the currently displayed page
4
- total_pages : total number of pages
5
- per_page : number of items to fetch per page
6
- remote : data-remote
7
- paginator : the paginator that renders the pagination tags inside
8
-
9
- == paginator.render do
10
- nav.pagination
11
- == first_page_tag unless current_page.first?
12
- == prev_page_tag unless current_page.first?
13
- - each_page do |page|
14
- - if page.left_outer? || page.right_outer? || page.inside_window?
15
- == page_tag page
16
- - elsif !page.was_truncated?
17
- == gap_tag
18
- == next_page_tag unless current_page.last?
19
- == last_page_tag unless current_page.last?
@@ -1,11 +0,0 @@
1
- <%# Link to the "Previous" page
2
- - available local variables
3
- url: url to the previous page
4
- current_page: a page object for the currently displayed page
5
- total_pages: total number of pages
6
- per_page: number of items to fetch per page
7
- remote: data-remote
8
- -%>
9
- <span class="prev">
10
- <%= link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote %>
11
- </span>
@@ -1,9 +0,0 @@
1
- -# Link to the "Previous" page
2
- -# available local variables
3
- -# url: url to the previous page
4
- -# current_page: a page object for the currently displayed page
5
- -# total_pages: total number of pages
6
- -# per_page: number of items to fetch per page
7
- -# remote: data-remote
8
- %span.prev
9
- = link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote
@@ -1,10 +0,0 @@
1
- / Link to the "Previous" page
2
- - available local variables
3
- url : url to the previous page
4
- current_page : a page object for the currently displayed page
5
- total_pages : total number of pages
6
- per_page : number of items to fetch per page
7
- remote : data-remote
8
- span.prev
9
- == link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote
10
- '
@@ -1,19 +0,0 @@
1
- # Sample localization file for Kaminari. You can override these values in your app's locales file if you want.
2
-
3
- en:
4
- views:
5
- pagination:
6
- first: "&laquo; First"
7
- last: "Last &raquo;"
8
- previous: "&lsaquo; Prev"
9
- next: "Next &rsaquo;"
10
- truncate: "&hellip;"
11
- helpers:
12
- page_entries_info:
13
- one_page:
14
- display_entries:
15
- zero: "No %{entry_name} found"
16
- one: "Displaying <b>1</b> %{entry_name}"
17
- other: "Displaying <b>all %{count}</b> %{entry_name}"
18
- more_pages:
19
- display_entries: "Displaying %{entry_name} <b>%{first}&nbsp;-&nbsp;%{last}</b> of <b>%{total}</b> in total"
@@ -1,7 +0,0 @@
1
- source :rubygems
2
-
3
- gem 'railties', '>= 3.0.13'
4
- gem 'activerecord', '>= 3.0.13', :require => 'active_record'
5
- gem 'rspec-rails', '>= 2.0'
6
-
7
- gemspec :path => '../'
@@ -1,7 +0,0 @@
1
- source :rubygems
2
-
3
- gem 'railties', '>= 3.1.5'
4
- gem 'activerecord', '>= 3.1.5', :require => 'active_record'
5
- gem 'rspec-rails', '>= 2.0'
6
-
7
- gemspec :path => '../'
@@ -1,7 +0,0 @@
1
- source :rubygems
2
-
3
- gem 'railties', '>= 3.2.3'
4
- gem 'activerecord', '>= 3.2.3', :require => 'active_record'
5
- gem 'rspec-rails', '>= 2.0'
6
-
7
- gemspec :path => '../'
@@ -1,12 +0,0 @@
1
- source :rubygems
2
-
3
- gem 'railties', '>= 3.2.3'
4
- gem 'dm-core', '>= 1.2.0'
5
- gem 'dm-migrations', '>= 1.2.0'
6
- gem 'dm-aggregates', '>= 1.2.0'
7
- gem 'dm-transactions', '>= 1.2.0'
8
- gem 'dm-active_model', '>= 1.2.0'
9
- gem 'dm-sqlite-adapter', '>= 1.2.0'
10
- gem 'rspec-rails', '>= 2.0'
11
-
12
- gemspec :path => '../'
@@ -1,7 +0,0 @@
1
- source :rubygems
2
-
3
- gem 'railties', '>= 3.2.3'
4
- gem 'mongo_mapper', '>= 0.11.0'
5
- gem 'rspec-rails', '>= 2.0'
6
-
7
- gemspec :path => '../'
@@ -1,7 +0,0 @@
1
- source :rubygems
2
-
3
- gem 'railties', '>= 3.2.3'
4
- gem 'mongoid', '~> 2.4.0'
5
- gem 'rspec-rails', '>= 2.0'
6
-
7
- gemspec :path => '../'
@@ -1,7 +0,0 @@
1
- source :rubygems
2
-
3
- gem 'railties', '>= 3.2.3'
4
- gem 'mongoid', '>= 3.0'
5
- gem 'rspec-rails', '>= 2.0'
6
-
7
- gemspec :path => '../'
@@ -1,10 +0,0 @@
1
- source :rubygems
2
-
3
- gem 'activerecord', '>= 3.2.3', :require => 'active_record'
4
- gem 'sinatra', '>= 1.3'
5
- gem 'padrino-helpers', '>= 0.10.6.c'
6
- gem 'rack-test', '>= 0'
7
- gem 'sinatra-contrib', '>= 1.3'
8
- gem 'nokogiri', '>= 0'
9
-
10
- gemspec :path => '../'
@@ -1,16 +0,0 @@
1
- module Kaminari
2
- module Generators
3
- class ConfigGenerator < Rails::Generators::Base
4
- source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
5
-
6
- desc <<DESC
7
- Description:
8
- Copies Kaminari configuration file to your application's initializer directory.
9
- DESC
10
-
11
- def copy_config_file
12
- template 'kaminari_config.rb', 'config/initializers/kaminari_config.rb'
13
- end
14
- end
15
- end
16
- end
@@ -1,10 +0,0 @@
1
- Kaminari.configure do |config|
2
- # config.default_per_page = 25
3
- # config.max_per_page = nil
4
- # config.window = 4
5
- # config.outer_window = 0
6
- # config.left = 0
7
- # config.right = 0
8
- # config.page_method_name = :page
9
- # config.param_name = :page
10
- end
@@ -1,118 +0,0 @@
1
- module Kaminari
2
- module Generators
3
-
4
- class ViewsGenerator < Rails::Generators::NamedBase
5
- source_root File.expand_path('../../../../app/views/kaminari', __FILE__)
6
-
7
- class_option :template_engine, :type => :string, :aliases => '-e', :desc => 'Template engine for the views. Available options are "erb", "haml", and "slim".'
8
-
9
- def self.banner #:nodoc:
10
- <<-BANNER.chomp
11
- rails g kaminari:views THEME [options]
12
-
13
- Copies all paginator partial templates to your application.
14
- You can choose a template THEME by specifying one from the list below:
15
-
16
- - default
17
- The default one.
18
- This one is used internally while you don't override the partials.
19
- #{themes.map {|t| " - #{t.name}\n#{t.description}"}.join("\n")}
20
- BANNER
21
- end
22
-
23
- desc ''
24
- def copy_or_fetch #:nodoc:
25
- return copy_default_views if file_name == 'default'
26
-
27
- themes = self.class.themes
28
- if theme = themes.detect {|t| t.name == file_name}
29
- download_templates theme
30
- else
31
- say %Q[no such theme: #{file_name}\n avaliable themes: #{themes.map(&:name).join ", "}]
32
- end
33
- end
34
-
35
- private
36
- def self.themes
37
- begin
38
- @themes ||= GitHubApiHelper.get_files_in_master.group_by {|fn, _| fn[0...(fn.index('/') || 0)]}.delete_if {|fn, _| fn.blank?}.map do |name, files|
39
- Theme.new name, files
40
- end
41
- rescue SocketError
42
- []
43
- end
44
- end
45
-
46
- def download_templates(theme)
47
- theme.templates_for(template_engine).each do |template|
48
- say " downloading #{template.name} from kaminari_themes..."
49
- create_file template.name, GitHubApiHelper.get_content_for("#{theme.name}/#{template.name}")
50
- end
51
- end
52
-
53
- def copy_default_views
54
- filename_pattern = File.join self.class.source_root, "*.html.#{template_engine}"
55
- Dir.glob(filename_pattern).map {|f| File.basename f}.each do |f|
56
- copy_file f, "app/views/kaminari/#{f}"
57
- end
58
- end
59
-
60
- def template_engine
61
- options[:template_engine].try(:to_s).try(:downcase) || 'erb'
62
- end
63
- end
64
-
65
- Template = Struct.new(:name, :sha) do
66
- def description?
67
- name == 'DESCRIPTION'
68
- end
69
-
70
- def view?
71
- name =~ /^app\/views\//
72
- end
73
-
74
- def engine #:nodoc:
75
- File.extname(name).sub /^\./, ''
76
- end
77
- end
78
-
79
- class Theme
80
- attr_accessor :name
81
- def initialize(name, templates) #:nodoc:
82
- @name, @templates = name, templates.map {|fn, sha| Template.new fn.sub(/^#{name}\//, ''), sha}
83
- end
84
-
85
- def description #:nodoc:
86
- file = @templates.detect(&:description?)
87
- return "#{' ' * 12}#{name}" unless file
88
- GitHubApiHelper.get_content_for("#{@name}/#{file.name}").chomp.gsub(/^/, ' ' * 12)
89
- end
90
-
91
- def templates_for(template_engine) #:nodoc:
92
- @templates.select {|t| !t.description?}.select {|t| !t.view? || (t.engine == template_engine)}
93
- end
94
- end
95
-
96
- module GitHubApiHelper
97
- def get_files_in_master
98
- master_tree_sha = open('https://api.github.com/repos/amatsuda/kaminari_themes/git/refs/heads/master') do |json|
99
- ActiveSupport::JSON.decode(json)['object']['sha']
100
- end
101
- open('https://api.github.com/repos/amatsuda/kaminari_themes/git/trees/' + master_tree_sha + '?recursive=1') do |json|
102
- blobs = ActiveSupport::JSON.decode(json)['tree'].find_all {|i| i['type'] == 'blob' }
103
- blobs.map do |blob|
104
- [blob['path'], blob['sha']]
105
- end
106
- end
107
- end
108
- module_function :get_files_in_master
109
-
110
- def get_content_for(path)
111
- open('https://api.github.com/repos/amatsuda/kaminari_themes/contents/' + path) do |json|
112
- Base64.decode64(ActiveSupport::JSON.decode(json)['content'])
113
- end
114
- end
115
- module_function :get_content_for
116
- end
117
- end
118
- end
@@ -1,49 +0,0 @@
1
- require 'active_support/configurable'
2
-
3
- module Kaminari
4
- # Configures global settings for Kaminari
5
- # Kaminari.configure do |config|
6
- # config.default_per_page = 10
7
- # end
8
- def self.configure(&block)
9
- yield @config ||= Kaminari::Configuration.new
10
- end
11
-
12
- # Global settings for Kaminari
13
- def self.config
14
- @config
15
- end
16
-
17
- # need a Class for 3.0
18
- class Configuration #:nodoc:
19
- include ActiveSupport::Configurable
20
- config_accessor :default_per_page
21
- config_accessor :max_per_page
22
- config_accessor :window
23
- config_accessor :outer_window
24
- config_accessor :left
25
- config_accessor :right
26
- config_accessor :page_method_name
27
-
28
- def param_name
29
- config.param_name.respond_to?(:call) ? config.param_name.call : config.param_name
30
- end
31
-
32
- # define param_name writer (copied from AS::Configurable)
33
- writer, line = 'def param_name=(value); config.param_name = value; end', __LINE__
34
- singleton_class.class_eval writer, __FILE__, line
35
- class_eval writer, __FILE__, line
36
- end
37
-
38
- # this is ugly. why can't we pass the default value to config_accessor...?
39
- configure do |config|
40
- config.default_per_page = 25
41
- config.max_per_page = nil
42
- config.window = 4
43
- config.outer_window = 0
44
- config.left = 0
45
- config.right = 0
46
- config.page_method_name = :page
47
- config.param_name = :page
48
- end
49
- end
@@ -1,4 +0,0 @@
1
- module Kaminari #:nodoc:
2
- class Engine < ::Rails::Engine #:nodoc:
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- require 'grape'
2
- require 'kaminari'
3
-
4
- Kaminari::Hooks.init