bootstrap_pager 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +18 -0
- data/.idea/encodings.xml +5 -0
- data/.idea/misc.xml +5 -0
- data/.idea/modules.xml +9 -0
- data/.idea/pager.iml +50 -0
- data/.idea/scopes/scope_settings.xml +5 -0
- data/.idea/vcs.xml +7 -0
- data/Gemfile +4 -0
- data/LICENSE +20 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +307 -0
- data/Rakefile +42 -0
- data/app/assets/javascripts/infinitescroll.js +8 -0
- data/app/helpers/pager_helper.rb +5 -0
- data/app/views/pager/_first_page.html.erb +11 -0
- data/app/views/pager/_first_page.html.haml +9 -0
- data/app/views/pager/_first_page.html.slim +10 -0
- data/app/views/pager/_gap.html.erb +8 -0
- data/app/views/pager/_gap.html.haml +8 -0
- data/app/views/pager/_gap.html.slim +10 -0
- data/app/views/pager/_last_page.html.erb +11 -0
- data/app/views/pager/_last_page.html.haml +9 -0
- data/app/views/pager/_last_page.html.slim +10 -0
- data/app/views/pager/_next_page.html.erb +11 -0
- data/app/views/pager/_next_page.html.haml +9 -0
- data/app/views/pager/_next_page.html.slim +10 -0
- data/app/views/pager/_page.html.erb +14 -0
- data/app/views/pager/_page.html.haml +11 -0
- data/app/views/pager/_page.html.slim +13 -0
- data/app/views/pager/_paginator.html.erb +25 -0
- data/app/views/pager/_paginator.html.haml +19 -0
- data/app/views/pager/_paginator.html.slim +20 -0
- data/app/views/pager/_prev_page.html.erb +11 -0
- data/app/views/pager/_prev_page.html.haml +9 -0
- data/app/views/pager/_prev_page.html.slim +10 -0
- data/bootstrap_pager.gemspec +36 -0
- data/config/locales/pager.yml +19 -0
- data/gemfiles/active_record_30.gemfile +9 -0
- data/gemfiles/active_record_31.gemfile +7 -0
- data/gemfiles/active_record_32.gemfile +10 -0
- data/gemfiles/active_record_40.gemfile +8 -0
- data/gemfiles/active_record_edge.gemfile +11 -0
- data/gemfiles/data_mapper_12.gemfile +15 -0
- data/gemfiles/mongo_mapper.gemfile +10 -0
- data/gemfiles/mongoid_24.gemfile +7 -0
- data/gemfiles/mongoid_30.gemfile +12 -0
- data/gemfiles/sinatra_13.gemfile +13 -0
- data/gemfiles/sinatra_14.gemfile +13 -0
- data/lib/bootstrap_pager/config.rb +51 -0
- data/lib/bootstrap_pager/grape.rb +4 -0
- data/lib/bootstrap_pager/helpers/action_view_extension.rb +152 -0
- data/lib/bootstrap_pager/helpers/paginator.rb +186 -0
- data/lib/bootstrap_pager/helpers/sinatra_helpers.rb +144 -0
- data/lib/bootstrap_pager/helpers/tags.rb +96 -0
- data/lib/bootstrap_pager/hooks.rb +41 -0
- data/lib/bootstrap_pager/models/active_record_extension.rb +22 -0
- data/lib/bootstrap_pager/models/active_record_model_extension.rb +20 -0
- data/lib/bootstrap_pager/models/active_record_relation_methods.rb +29 -0
- data/lib/bootstrap_pager/models/array_extension.rb +58 -0
- data/lib/bootstrap_pager/models/configuration_methods.rb +48 -0
- data/lib/bootstrap_pager/models/data_mapper_collection_methods.rb +15 -0
- data/lib/bootstrap_pager/models/data_mapper_extension.rb +48 -0
- data/lib/bootstrap_pager/models/mongo_mapper_extension.rb +18 -0
- data/lib/bootstrap_pager/models/mongoid_criteria_methods.rb +23 -0
- data/lib/bootstrap_pager/models/mongoid_extension.rb +33 -0
- data/lib/bootstrap_pager/models/page_scope_methods.rb +70 -0
- data/lib/bootstrap_pager/models/plucky_criteria_methods.rb +18 -0
- data/lib/bootstrap_pager/railtie.rb +7 -0
- data/lib/bootstrap_pager/sinatra.rb +5 -0
- data/lib/bootstrap_pager/version.rb +3 -0
- data/lib/bootstrap_pager.rb +38 -0
- data/lib/generators/pager/config_generator.rb +16 -0
- data/lib/generators/pager/templates/pager_config.rb +10 -0
- data/lib/generators/pager/views_generator.rb +118 -0
- data/spec/config/config_spec.rb +91 -0
- data/spec/fake_app/active_record/config.rb +3 -0
- data/spec/fake_app/active_record/models.rb +57 -0
- data/spec/fake_app/data_mapper/config.rb +7 -0
- data/spec/fake_app/data_mapper/models.rb +27 -0
- data/spec/fake_app/log/development.log +832 -0
- data/spec/fake_app/mongo_mapper/config.rb +2 -0
- data/spec/fake_app/mongo_mapper/models.rb +9 -0
- data/spec/fake_app/mongoid/config.rb +16 -0
- data/spec/fake_app/mongoid/models.rb +22 -0
- data/spec/fake_app/rails_app.rb +67 -0
- data/spec/fake_app/sinatra_app.rb +22 -0
- data/spec/fake_gem.rb +4 -0
- data/spec/helpers/action_view_extension_spec.rb +292 -0
- data/spec/helpers/helpers_spec.rb +135 -0
- data/spec/helpers/sinatra_helpers_spec.rb +170 -0
- data/spec/helpers/tags_spec.rb +140 -0
- data/spec/models/active_record/active_record_relation_methods_spec.rb +47 -0
- data/spec/models/active_record/default_per_page_spec.rb +32 -0
- data/spec/models/active_record/max_pages_spec.rb +23 -0
- data/spec/models/active_record/max_per_page_spec.rb +32 -0
- data/spec/models/active_record/scopes_spec.rb +242 -0
- data/spec/models/array_spec.rb +150 -0
- data/spec/models/data_mapper/data_mapper_spec.rb +207 -0
- data/spec/models/mongo_mapper/mongo_mapper_spec.rb +84 -0
- data/spec/models/mongoid/mongoid_spec.rb +126 -0
- data/spec/requests/users_spec.rb +53 -0
- data/spec/spec_helper.rb +33 -0
- data/spec/spec_helper_for_sinatra.rb +34 -0
- data/spec/support/database_cleaner.rb +16 -0
- data/spec/support/matchers.rb +52 -0
- data/vendor/assets/javascripts/jquery.infinitescroll.js +814 -0
- data/vendor/assets/javascripts/jquery.infinitescroll.min.js +1 -0
- metadata +311 -0
@@ -0,0 +1,52 @@
|
|
1
|
+
RSpec::Matchers.define :contain_tag do |klass|
|
2
|
+
match do |collection|
|
3
|
+
if @num.blank?
|
4
|
+
collection.any? {|tag| tag.is_a? klass}
|
5
|
+
else
|
6
|
+
(@count = collection.count {|tag| tag.is_a? klass}) == @num
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def count(num)
|
11
|
+
@num = num
|
12
|
+
self
|
13
|
+
end
|
14
|
+
|
15
|
+
description do
|
16
|
+
"contain #{@num || 'any'} instance(s) of #{klass.name}"
|
17
|
+
end
|
18
|
+
failure_message_for_should do |collection|
|
19
|
+
"expected #{@num || 'any'} instance(s) of #{klass.name} but was #{@count}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
RSpec::Matchers.define :contain_tag_old do |count|
|
24
|
+
match do |collection|
|
25
|
+
(@count = collection.count {|tag| tag.is_a? @klass}) == count
|
26
|
+
end
|
27
|
+
|
28
|
+
def instance_of(klass)
|
29
|
+
@klass = klass
|
30
|
+
self
|
31
|
+
end
|
32
|
+
alias :instances_of :instance_of
|
33
|
+
|
34
|
+
description do
|
35
|
+
"contain #{count || 'any'} instance(s) of #{@klass.name}"
|
36
|
+
end
|
37
|
+
failure_message_for_should do |collection|
|
38
|
+
"expected #{count || 'any'} instance(s) of #{@klass.name} but was #{@count}"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
RSpec::Matchers.define :skip do |num|
|
43
|
+
match do |criteria|
|
44
|
+
criteria.instance_variable_get('@options')[:skip] == num
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
RSpec::Matchers.define :offset do |num|
|
49
|
+
match do |collection|
|
50
|
+
collection.offset_value == num
|
51
|
+
end
|
52
|
+
end
|