kaminari 0.14.1 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.codeclimate.yml +19 -0
- data/.document +1 -4
- data/.gitignore +2 -1
- data/.travis.yml +91 -10
- data/CHANGELOG.md +636 -0
- data/CONTRIBUTING.md +22 -0
- data/Gemfile +3 -1
- data/README.md +573 -0
- data/Rakefile +43 -20
- data/gemfiles/active_record_41.gemfile +28 -0
- data/gemfiles/active_record_42.gemfile +28 -0
- data/gemfiles/active_record_50.gemfile +24 -0
- data/gemfiles/active_record_51.gemfile +24 -0
- data/gemfiles/active_record_52.gemfile +24 -0
- data/gemfiles/active_record_60.gemfile +26 -0
- data/gemfiles/active_record_edge.gemfile +33 -0
- data/kaminari.gemspec +23 -28
- data/lib/kaminari/version.rb +3 -1
- data/lib/kaminari.rb +4 -37
- data/misc/bug_report_template.rb +57 -0
- metadata +67 -229
- data/.gemtest +0 -0
- data/.rspec +0 -2
- data/CHANGELOG +0 -351
- data/README.rdoc +0 -295
- data/app/views/kaminari/_first_page.html.erb +0 -11
- data/app/views/kaminari/_first_page.html.haml +0 -9
- data/app/views/kaminari/_first_page.html.slim +0 -10
- data/app/views/kaminari/_gap.html.erb +0 -8
- data/app/views/kaminari/_gap.html.haml +0 -8
- data/app/views/kaminari/_gap.html.slim +0 -9
- data/app/views/kaminari/_last_page.html.erb +0 -11
- data/app/views/kaminari/_last_page.html.haml +0 -9
- data/app/views/kaminari/_last_page.html.slim +0 -10
- data/app/views/kaminari/_next_page.html.erb +0 -11
- data/app/views/kaminari/_next_page.html.haml +0 -9
- data/app/views/kaminari/_next_page.html.slim +0 -10
- data/app/views/kaminari/_page.html.erb +0 -12
- data/app/views/kaminari/_page.html.haml +0 -10
- data/app/views/kaminari/_page.html.slim +0 -11
- data/app/views/kaminari/_paginator.html.erb +0 -23
- data/app/views/kaminari/_paginator.html.haml +0 -18
- data/app/views/kaminari/_paginator.html.slim +0 -19
- data/app/views/kaminari/_prev_page.html.erb +0 -11
- data/app/views/kaminari/_prev_page.html.haml +0 -9
- data/app/views/kaminari/_prev_page.html.slim +0 -10
- data/config/locales/kaminari.yml +0 -19
- data/gemfiles/active_record_30.gemfile +0 -7
- data/gemfiles/active_record_31.gemfile +0 -7
- data/gemfiles/active_record_32.gemfile +0 -7
- data/gemfiles/data_mapper_12.gemfile +0 -12
- data/gemfiles/mongo_mapper.gemfile +0 -7
- data/gemfiles/mongoid_24.gemfile +0 -7
- data/gemfiles/mongoid_30.gemfile +0 -7
- data/gemfiles/sinatra.gemfile +0 -10
- data/lib/generators/kaminari/config_generator.rb +0 -16
- data/lib/generators/kaminari/templates/kaminari_config.rb +0 -10
- data/lib/generators/kaminari/views_generator.rb +0 -118
- data/lib/kaminari/config.rb +0 -49
- data/lib/kaminari/engine.rb +0 -4
- data/lib/kaminari/grape.rb +0 -4
- data/lib/kaminari/helpers/action_view_extension.rb +0 -151
- data/lib/kaminari/helpers/paginator.rb +0 -175
- data/lib/kaminari/helpers/sinatra_helpers.rb +0 -138
- data/lib/kaminari/helpers/tags.rb +0 -95
- data/lib/kaminari/hooks.rb +0 -37
- data/lib/kaminari/models/active_record_extension.rb +0 -22
- data/lib/kaminari/models/active_record_model_extension.rb +0 -20
- data/lib/kaminari/models/active_record_relation_methods.rb +0 -31
- data/lib/kaminari/models/array_extension.rb +0 -60
- data/lib/kaminari/models/configuration_methods.rb +0 -34
- data/lib/kaminari/models/data_mapper_collection_methods.rb +0 -15
- data/lib/kaminari/models/data_mapper_extension.rb +0 -48
- data/lib/kaminari/models/mongo_mapper_extension.rb +0 -18
- data/lib/kaminari/models/mongoid_criteria_methods.rb +0 -23
- data/lib/kaminari/models/mongoid_extension.rb +0 -33
- data/lib/kaminari/models/page_scope_methods.rb +0 -41
- data/lib/kaminari/models/plucky_criteria_methods.rb +0 -18
- data/lib/kaminari/railtie.rb +0 -7
- data/lib/kaminari/sinatra.rb +0 -5
- data/spec/config/config_spec.rb +0 -76
- data/spec/fake_app/active_record/config.rb +0 -3
- data/spec/fake_app/active_record/models.rb +0 -57
- data/spec/fake_app/data_mapper/config.rb +0 -1
- data/spec/fake_app/data_mapper/models.rb +0 -27
- data/spec/fake_app/mongo_mapper/config.rb +0 -2
- data/spec/fake_app/mongo_mapper/models.rb +0 -9
- data/spec/fake_app/mongoid/config.rb +0 -16
- data/spec/fake_app/mongoid/models.rb +0 -22
- data/spec/fake_app/rails_app.rb +0 -55
- data/spec/fake_app/sinatra_app.rb +0 -22
- data/spec/fake_gem.rb +0 -4
- data/spec/helpers/action_view_extension_spec.rb +0 -262
- data/spec/helpers/helpers_spec.rb +0 -135
- data/spec/helpers/sinatra_helpers_spec.rb +0 -170
- data/spec/helpers/tags_spec.rb +0 -140
- data/spec/models/active_record/active_record_relation_methods_spec.rb +0 -30
- data/spec/models/active_record/default_per_page_spec.rb +0 -32
- data/spec/models/active_record/max_per_page_spec.rb +0 -32
- data/spec/models/active_record/scopes_spec.rb +0 -166
- data/spec/models/array_spec.rb +0 -121
- data/spec/models/data_mapper/data_mapper_spec.rb +0 -155
- data/spec/models/mongo_mapper/mongo_mapper_spec.rb +0 -72
- data/spec/models/mongoid/mongoid_spec.rb +0 -110
- data/spec/requests/users_spec.rb +0 -53
- data/spec/spec_helper.rb +0 -32
- data/spec/spec_helper_for_sinatra.rb +0 -35
- data/spec/support/database_cleaner.rb +0 -16
- 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
|
-
'
|
data/config/locales/kaminari.yml
DELETED
@@ -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: "« First"
|
7
|
-
last: "Last »"
|
8
|
-
previous: "‹ Prev"
|
9
|
-
next: "Next ›"
|
10
|
-
truncate: "…"
|
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} - %{last}</b> of <b>%{total}</b> in total"
|
@@ -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 => '../'
|
data/gemfiles/mongoid_24.gemfile
DELETED
data/gemfiles/mongoid_30.gemfile
DELETED
data/gemfiles/sinatra.gemfile
DELETED
@@ -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,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
|
data/lib/kaminari/config.rb
DELETED
@@ -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
|
data/lib/kaminari/engine.rb
DELETED
data/lib/kaminari/grape.rb
DELETED