diff options
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/.specification | 108 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/CHANGELOG.rdoc (renamed from vendor/plugins/will_paginate/CHANGELOG.rdoc) | 47 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/LICENSE (renamed from vendor/plugins/will_paginate/LICENSE) | 0 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/README.rdoc (renamed from vendor/plugins/will_paginate/README.rdoc) | 5 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/Rakefile (renamed from vendor/plugins/will_paginate/Rakefile) | 17 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/lib/will_paginate.rb (renamed from vendor/plugins/will_paginate/lib/will_paginate.rb) | 26 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/lib/will_paginate/array.rb (renamed from vendor/plugins/will_paginate/lib/will_paginate/array.rb) | 0 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/lib/will_paginate/collection.rb (renamed from vendor/plugins/will_paginate/lib/will_paginate/collection.rb) | 6 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/lib/will_paginate/core_ext.rb (renamed from vendor/plugins/will_paginate/lib/will_paginate/core_ext.rb) | 15 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/lib/will_paginate/finder.rb (renamed from vendor/plugins/will_paginate/lib/will_paginate/finder.rb) | 53 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/lib/will_paginate/named_scope.rb (renamed from vendor/plugins/will_paginate/lib/will_paginate/named_scope.rb) | 70 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/lib/will_paginate/named_scope_patch.rb (renamed from vendor/plugins/will_paginate/lib/will_paginate/named_scope_patch.rb) | 16 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/lib/will_paginate/version.rb (renamed from vendor/plugins/will_paginate/lib/will_paginate/version.rb) | 2 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/lib/will_paginate/view_helpers.rb (renamed from vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb) | 51 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/test/boot.rb (renamed from vendor/plugins/will_paginate/test/boot.rb) | 4 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/test/collection_test.rb (renamed from vendor/plugins/will_paginate/test/collection_test.rb) | 3 | ||||
-rwxr-xr-x | vendor/gems/will_paginate-2.3.15/test/console (renamed from vendor/plugins/will_paginate/test/console) | 0 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/test/database.yml (renamed from vendor/plugins/will_paginate/test/database.yml) | 2 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/test/finder_test.rb (renamed from vendor/plugins/will_paginate/test/finder_test.rb) | 87 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/test/fixtures/admin.rb (renamed from vendor/plugins/will_paginate/test/fixtures/admin.rb) | 0 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/test/fixtures/developer.rb (renamed from vendor/plugins/will_paginate/test/fixtures/developer.rb) | 1 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/test/fixtures/developers_projects.yml (renamed from vendor/plugins/will_paginate/test/fixtures/developers_projects.yml) | 0 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/test/fixtures/project.rb (renamed from vendor/plugins/will_paginate/test/fixtures/project.rb) | 2 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/test/fixtures/projects.yml (renamed from vendor/plugins/will_paginate/test/fixtures/projects.yml) | 0 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/test/fixtures/replies.yml (renamed from vendor/plugins/will_paginate/test/fixtures/replies.yml) | 0 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/test/fixtures/reply.rb (renamed from vendor/plugins/will_paginate/test/fixtures/reply.rb) | 0 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/test/fixtures/schema.rb (renamed from vendor/plugins/will_paginate/test/fixtures/schema.rb) | 0 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/test/fixtures/topic.rb (renamed from vendor/plugins/will_paginate/test/fixtures/topic.rb) | 6 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/test/fixtures/topics.yml (renamed from vendor/plugins/will_paginate/test/fixtures/topics.yml) | 0 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/test/fixtures/user.rb (renamed from vendor/plugins/will_paginate/test/fixtures/user.rb) | 0 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/test/fixtures/users.yml (renamed from vendor/plugins/will_paginate/test/fixtures/users.yml) | 0 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/test/helper.rb (renamed from vendor/plugins/will_paginate/test/helper.rb) | 4 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/test/lib/activerecord_test_case.rb (renamed from vendor/plugins/will_paginate/test/lib/activerecord_test_case.rb) | 7 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/test/lib/activerecord_test_connector.rb (renamed from vendor/plugins/will_paginate/test/lib/activerecord_test_connector.rb) | 13 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/test/lib/load_fixtures.rb (renamed from vendor/plugins/will_paginate/test/lib/load_fixtures.rb) | 0 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/test/lib/view_test_process.rb (renamed from vendor/plugins/will_paginate/test/lib/view_test_process.rb) | 26 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/test/tasks.rake (renamed from vendor/plugins/will_paginate/test/tasks.rake) | 2 | ||||
-rw-r--r-- | vendor/gems/will_paginate-2.3.15/test/view_test.rb (renamed from vendor/plugins/will_paginate/test/view_test.rb) | 22 | ||||
-rw-r--r-- | vendor/plugins/will_paginate/.gitignore | 4 | ||||
-rw-r--r-- | vendor/plugins/will_paginate/.manifest | 49 | ||||
-rw-r--r-- | vendor/plugins/will_paginate/README | 119 | ||||
-rw-r--r-- | vendor/plugins/will_paginate/examples/apple-circle.gif | bin | 178 -> 0 bytes | |||
-rw-r--r-- | vendor/plugins/will_paginate/examples/index.haml | 69 | ||||
-rw-r--r-- | vendor/plugins/will_paginate/examples/index.html | 92 | ||||
-rw-r--r-- | vendor/plugins/will_paginate/examples/pagination.css | 90 | ||||
-rw-r--r-- | vendor/plugins/will_paginate/examples/pagination.sass | 91 | ||||
-rw-r--r-- | vendor/plugins/will_paginate/init.rb | 1 | ||||
-rw-r--r-- | vendor/plugins/will_paginate/test/array_pagination_test.rb | 121 | ||||
-rw-r--r-- | vendor/plugins/will_paginate/test/pagination_test.rb | 146 | ||||
-rw-r--r-- | vendor/plugins/will_paginate/will_paginate.gemspec | 21 |
50 files changed, 470 insertions, 928 deletions
diff --git a/vendor/gems/will_paginate-2.3.15/.specification b/vendor/gems/will_paginate-2.3.15/.specification new file mode 100644 index 000000000..68e2cfca2 --- /dev/null +++ b/vendor/gems/will_paginate-2.3.15/.specification @@ -0,0 +1,108 @@ +--- !ruby/object:Gem::Specification +name: will_paginate +version: !ruby/object:Gem::Version + hash: 29 + prerelease: false + segments: + - 2 + - 3 + - 15 + version: 2.3.15 +platform: ruby +authors: +- "Mislav Marohni\xC4\x87" +- PJ Hyett +autorequire: +bindir: bin +cert_chain: [] + +date: 2010-09-08 00:00:00 +01:00 +default_executable: +dependencies: [] + +description: The will_paginate library provides a simple, yet powerful and extensible API for ActiveRecord pagination and rendering of pagination links in ActionView templates. +email: mislav.marohnic@gmail.com +executables: [] + +extensions: [] + +extra_rdoc_files: +- README.rdoc +- LICENSE +- CHANGELOG.rdoc +files: +- Rakefile +- lib/will_paginate/array.rb +- lib/will_paginate/collection.rb +- lib/will_paginate/core_ext.rb +- lib/will_paginate/finder.rb +- lib/will_paginate/named_scope.rb +- lib/will_paginate/named_scope_patch.rb +- lib/will_paginate/version.rb +- lib/will_paginate/view_helpers.rb +- lib/will_paginate.rb +- test/boot.rb +- test/collection_test.rb +- test/console +- test/database.yml +- test/finder_test.rb +- test/fixtures/admin.rb +- test/fixtures/developer.rb +- test/fixtures/developers_projects.yml +- test/fixtures/project.rb +- test/fixtures/projects.yml +- test/fixtures/replies.yml +- test/fixtures/reply.rb +- test/fixtures/schema.rb +- test/fixtures/topic.rb +- test/fixtures/topics.yml +- test/fixtures/user.rb +- test/fixtures/users.yml +- test/helper.rb +- test/lib/activerecord_test_case.rb +- test/lib/activerecord_test_connector.rb +- test/lib/load_fixtures.rb +- test/lib/view_test_process.rb +- test/tasks.rake +- test/view_test.rb +- README.rdoc +- LICENSE +- CHANGELOG.rdoc +has_rdoc: true +homepage: http://github.com/mislav/will_paginate/wikis +licenses: [] + +post_install_message: +rdoc_options: +- --main +- README.rdoc +- --charset=UTF-8 +require_paths: +- lib +required_ruby_version: !ruby/object:Gem::Requirement + none: false + requirements: + - - ">=" + - !ruby/object:Gem::Version + hash: 3 + segments: + - 0 + version: "0" +required_rubygems_version: !ruby/object:Gem::Requirement + none: false + requirements: + - - ">=" + - !ruby/object:Gem::Version + hash: 3 + segments: + - 0 + version: "0" +requirements: [] + +rubyforge_project: +rubygems_version: 1.3.7 +signing_key: +specification_version: 3 +summary: Pagination for Rails +test_files: [] + diff --git a/vendor/plugins/will_paginate/CHANGELOG.rdoc b/vendor/gems/will_paginate-2.3.15/CHANGELOG.rdoc index 934b60cde..8c4d2c90c 100644 --- a/vendor/plugins/will_paginate/CHANGELOG.rdoc +++ b/vendor/gems/will_paginate-2.3.15/CHANGELOG.rdoc @@ -1,7 +1,52 @@ += 2.3.12, released 2009-12-01 + +* make view helpers "HTML safe" for Rails 2.3.5 with rails_xss plugin + += 2.3.11, released 2009-06-02 + +* fix `enable_actionpack` + += 2.3.10, released 2009-05-21 + +* count_by_sql: don't use table alias with any adapters starting with "oracle" +* Add back "AS count_table" alias to `paginate_by_sql` counter SQL + += 2.3.9, released 2009-05-29 + +* remove "AS count_table" alias from `paginate_by_sql` counter SQL +* Rails 2.3.2 compat: monkeypatch Rails issue #2189 (count breaks has_many :through) +* fix generation of page URLs that contain the "@" character +* check for method existance in a ruby 1.8- and 1.9-compatible way +* load will_paginate view helpers even if ActiveRecord is not loaded + +== 2.3.8, released 2009-03-09 + +* Rails 2.3 compat: query parameter parsing with Rack + +== 2.3.7, released 2009-02-09 + +* Removed all unnecessary &block variables since they cause serious memory damage and lots of subsequent gc runs. + +== 2.3.6, released 2008-10-26 + +* Rails 2.2 fix: stop using `extract_attribute_names_from_match` inernal AR method, it no longer exists + +== 2.3.5, released 2008-10-07 + +* update the backported named_scope implementation for Rails versions older than 2.1 +* break out of scope of paginated_each() yielded block when used on named scopes +* fix paginate(:from) + +== 2.3.4, released 2008-09-16 + +* Removed gem dependency to Active Support (causes trouble with vendored rails). +* Rails 2.1: fix a failing test and a deprecation warning. +* Cope with scoped :select when counting. + == 2.3.3, released 2008-08-29 * Ensure that paginate_by_sql doesn't change the original SQL query. -* RDoc love (now live at http://mislav.caboo.se/static/will_paginate/doc/) +* RDoc love (now live at http://gitrdoc.com/mislav/will_paginate/tree/master) * Rename :prev_label to :previous_label for consistency. old name still functions but is deprecated * ActiveRecord 2.1: Remove :include option from count_all query when it's possible. diff --git a/vendor/plugins/will_paginate/LICENSE b/vendor/gems/will_paginate-2.3.15/LICENSE index 96a48cb3f..96a48cb3f 100644 --- a/vendor/plugins/will_paginate/LICENSE +++ b/vendor/gems/will_paginate-2.3.15/LICENSE diff --git a/vendor/plugins/will_paginate/README.rdoc b/vendor/gems/will_paginate-2.3.15/README.rdoc index 1286a846a..2a52ed307 100644 --- a/vendor/plugins/will_paginate/README.rdoc +++ b/vendor/gems/will_paginate-2.3.15/README.rdoc @@ -87,13 +87,14 @@ contributions or just simply awesome ideas: Chris Wanstrath, Dr. Nic Williams, K. Adam Christensen, Mike Garey, Bence Golda, Matt Aimonetti, Charles Brian Quinn, Desi McAdam, James Coglan, Matijs van Zuijlen, Maria, Brendan Ribera, Todd Willey, Bryan Helmkamp, Jan Berkel, -Lourens Naudé, Rick Olson, Russell Norris, Piotr Usewicz, Chris Eppstein. +Lourens Naudé, Rick Olson, Russell Norris, Piotr Usewicz, Chris Eppstein, +Denis Barushev, Ben Pickles. == Usable pagination in the UI There are some CSS styles to get you started in the "examples/" directory. They -are {showcased online here}[http://mislav.caboo.se/static/will_paginate/]. +are {showcased online here}[http://mislav.uniqpath.com/will_paginate/]. More reading about pagination as design pattern: diff --git a/vendor/plugins/will_paginate/Rakefile b/vendor/gems/will_paginate-2.3.15/Rakefile index 253efd099..6226b1b70 100644 --- a/vendor/plugins/will_paginate/Rakefile +++ b/vendor/gems/will_paginate-2.3.15/Rakefile @@ -32,18 +32,9 @@ desc %{Update ".manifest" with the latest list of project filenames. Respect\ .gitignore by excluding everything that git ignores. Update `files` and\ `test_files` arrays in "*.gemspec" file if it's present.} task :manifest do - list = Dir['**/*'].sort - spec_file = Dir['*.gemspec'].first - list -= [spec_file] if spec_file + list = `git ls-files --full-name --exclude=*.gemspec --exclude=.*`.chomp.split("\n") - File.read('.gitignore').each_line do |glob| - glob = glob.chomp.sub(/^\//, '') - list -= Dir[glob] - list -= Dir["#{glob}/**/*"] if File.directory?(glob) and !File.symlink?(glob) - puts "excluding #{glob}" - end - - if spec_file + if spec_file = Dir['*.gemspec'].first spec = File.read spec_file spec.gsub! /^(\s* s.(test_)?files \s* = \s* )( \[ [^\]]* \] | %w\( [^)]* \) )/mx do assignment = $1 @@ -51,9 +42,9 @@ task :manifest do '%s%%w(%s)' % [assignment, bunch.join(' ')] end - File.open(spec_file, 'w') {|f| f << spec } + File.open(spec_file, 'w') { |f| f << spec } end - File.open('.manifest', 'w') {|f| f << list.join("\n") } + File.open('.manifest', 'w') { |f| f << list.join("\n") } end task :examples do diff --git a/vendor/plugins/will_paginate/lib/will_paginate.rb b/vendor/gems/will_paginate-2.3.15/lib/will_paginate.rb index 1b633f16a..ac30b6586 100644 --- a/vendor/plugins/will_paginate/lib/will_paginate.rb +++ b/vendor/gems/will_paginate-2.3.15/lib/will_paginate.rb @@ -1,4 +1,5 @@ require 'active_support' +require 'will_paginate/core_ext' # = You *will* paginate! # @@ -17,7 +18,7 @@ module WillPaginate # hooks WillPaginate::ViewHelpers into ActionView::Base def enable_actionpack - return if ActionView::Base.instance_methods.include? 'will_paginate' + return if ActionView::Base.instance_methods.include_method? :will_paginate require 'will_paginate/view_helpers' ActionView::Base.send :include, ViewHelpers @@ -35,7 +36,7 @@ module WillPaginate # support pagination on associations a = ActiveRecord::Associations - returning([ a::AssociationCollection ]) { |classes| + [ a::AssociationCollection ].tap { |classes| # detect http://dev.rubyonrails.org/changeset/9230 unless a::HasManyThroughAssociation.superclass == a::HasManyAssociation classes << a::HasManyThroughAssociation @@ -44,6 +45,16 @@ module WillPaginate klass.send :include, Finder::ClassMethods klass.class_eval { alias_method_chain :method_missing, :paginate } end + + # monkeypatch Rails ticket #2189: "count breaks has_many :through" + ActiveRecord::Base.class_eval do + protected + def self.construct_count_options_from_args(*args) + result = super + result[0] = '*' if result[0].is_a?(String) and result[0] =~ /\.\*$/ + result + end + end end # Enable named_scope, a feature of Rails 2.1, even if you have older Rails @@ -68,15 +79,12 @@ module WillPaginate def self.warn(message, callstack = caller) message = 'WillPaginate: ' + message.strip.gsub(/\s+/, ' ') - behavior.call(message, callstack) if behavior && !silenced? - end - - def self.silenced? - ActiveSupport::Deprecation.silenced? + ActiveSupport::Deprecation.warn(message, callstack) end end end -if defined?(Rails) and defined?(ActiveRecord) and defined?(ActionController) - WillPaginate.enable +if defined? Rails + WillPaginate.enable_activerecord if defined? ActiveRecord + WillPaginate.enable_actionpack if defined? ActionController end diff --git a/vendor/plugins/will_paginate/lib/will_paginate/array.rb b/vendor/gems/will_paginate-2.3.15/lib/will_paginate/array.rb index d061d2be9..d061d2be9 100644 --- a/vendor/plugins/will_paginate/lib/will_paginate/array.rb +++ b/vendor/gems/will_paginate-2.3.15/lib/will_paginate/array.rb diff --git a/vendor/plugins/will_paginate/lib/will_paginate/collection.rb b/vendor/gems/will_paginate-2.3.15/lib/will_paginate/collection.rb index ac0153a1b..3ccb4a6aa 100644 --- a/vendor/plugins/will_paginate/lib/will_paginate/collection.rb +++ b/vendor/gems/will_paginate-2.3.15/lib/will_paginate/collection.rb @@ -33,11 +33,9 @@ module WillPaginate # # If you are writing a library that provides a collection which you would like # to conform to this API, you don't have to copy these methods over; simply - # make your plugin/gem dependant on the "mislav-will_paginate" gem: + # make your plugin/gem dependant on this library and do: # - # gem 'mislav-will_paginate' # require 'will_paginate/collection' - # # # WillPaginate::Collection is now available for use class Collection < Array attr_reader :current_page, :per_page, :total_entries, :total_pages @@ -82,7 +80,7 @@ module WillPaginate # # The Array#paginate API has since then changed, but this still serves as a # fine example of WillPaginate::Collection usage. - def self.create(page, per_page, total = nil, &block) + def self.create(page, per_page, total = nil) pager = new(page, per_page, total) yield pager pager diff --git a/vendor/plugins/will_paginate/lib/will_paginate/core_ext.rb b/vendor/gems/will_paginate-2.3.15/lib/will_paginate/core_ext.rb index 32f10f502..3397736b3 100644 --- a/vendor/plugins/will_paginate/lib/will_paginate/core_ext.rb +++ b/vendor/gems/will_paginate-2.3.15/lib/will_paginate/core_ext.rb @@ -1,7 +1,18 @@ require 'set' require 'will_paginate/array' -unless Hash.instance_methods.include? 'except' +# helper to check for method existance in ruby 1.8- and 1.9-compatible way +# because `methods`, `instance_methods` and others return strings in 1.8 and symbols in 1.9 +# +# ['foo', 'bar'].include_method?(:foo) # => true +class Array + def include_method?(name) + name = name.to_sym + !!(find { |item| item.to_sym == name }) + end +end + +unless Hash.instance_methods.include_method? :except Hash.class_eval do # Returns a new hash without the given keys. def except(*keys) @@ -16,7 +27,7 @@ unless Hash.instance_methods.include? 'except' end end -unless Hash.instance_methods.include? 'slice' +unless Hash.instance_methods.include_method? :slice Hash.class_eval do # Returns a new hash with only the given keys. def slice(*keys) diff --git a/vendor/plugins/will_paginate/lib/will_paginate/finder.rb b/vendor/gems/will_paginate-2.3.15/lib/will_paginate/finder.rb index 20d8d76fa..e121c5ff3 100644 --- a/vendor/plugins/will_paginate/lib/will_paginate/finder.rb +++ b/vendor/gems/will_paginate-2.3.15/lib/will_paginate/finder.rb @@ -61,7 +61,7 @@ module WillPaginate # # All other options (+conditions+, +order+, ...) are forwarded to +find+ # and +count+ calls. - def paginate(*args, &block) + def paginate(*args) options = args.pop page, per_page, total_entries = wp_parse_options(options) finder = (options[:finder] || 'find').to_s @@ -79,7 +79,7 @@ module WillPaginate args << find_options # @options_from_last_find = nil - pager.replace send(finder, *args, &block) + pager.replace(send(finder, *args) { |*a| yield(*a) if block_given? }) # magic counting for user convenience: pager.total_entries = wp_count(count_options, args, finder) unless pager.total_entries @@ -96,7 +96,7 @@ module WillPaginate # # See {Faking Cursors in ActiveRecord}[http://weblog.jamisbuck.org/2007/4/6/faking-cursors-in-activerecord] # where Jamis Buck describes this and a more efficient way for MySQL. - def paginated_each(options = {}, &block) + def paginated_each(options = {}) options = { :order => 'id', :page => 1 }.merge options options[:page] = options[:page].to_i options[:total_entries] = 0 # skip the individual count queries @@ -104,7 +104,10 @@ module WillPaginate begin collection = paginate(options) - total += collection.each(&block).size + with_exclusive_scope(:find => {}) do + # using exclusive scope so that the block is yielded in scope-free context + total += collection.each { |item| yield item }.size + end options[:page] += 1 end until collection.size < collection.per_page @@ -138,7 +141,7 @@ module WillPaginate count_query = original_query.sub /\bORDER\s+BY\s+[\w`,\s]+$/mi, '' count_query = "SELECT COUNT(*) FROM (#{count_query})" - unless ['oracle', 'oci'].include?(self.connection.adapter_name.downcase) + unless self.connection.adapter_name =~ /^(oracle|oci$)/i count_query << ' AS count_table' end # perform the count query @@ -152,16 +155,20 @@ module WillPaginate when :paginate, :paginate_by_sql true else - super(method.to_s.sub(/^paginate/, 'find'), include_priv) + super || super(method.to_s.sub(/^paginate/, 'find'), include_priv) end end protected - def method_missing_with_paginate(method, *args, &block) #:nodoc: + def method_missing_with_paginate(method, *args) #:nodoc: # did somebody tried to paginate? if not, let them be unless method.to_s.index('paginate') == 0 - return method_missing_without_paginate(method, *args, &block) + if block_given? + return method_missing_without_paginate(method, *args) { |*a| yield(*a) } + else + return method_missing_without_paginate(method, *args) + end end # paginate finders are really just find_* with limit and offset @@ -174,14 +181,27 @@ module WillPaginate options[:finder] = finder args << options - paginate(*args, &block) + paginate(*args) { |*a| yield(*a) if block_given? } end # Does the not-so-trivial job of finding out the total number of entries # in the database. It relies on the ActiveRecord +count+ method. def wp_count(options, args, finder) excludees = [:count, :order, :limit, :offset, :readonly] - unless options[:select] and options[:select] =~ /^\s*DISTINCT\b/i + excludees << :from unless ActiveRecord::Calculations::CALCULATIONS_OPTIONS.include?(:from) + + # we may be in a model or an association proxy + klass = (@owner and @reflection) ? @reflection.klass : self + + # Use :select from scope if it isn't already present. + options[:select] = scope(:find, :select) unless options[:select] + + if options[:select] and options[:select] =~ /^\s*DISTINCT\b/i + # Remove quoting and check for table_name.*-like statement. + if options[:select].gsub(/[`"]/, '') =~ /\w+\.\*/ + options[:select] = "DISTINCT #{klass.table_name}.#{klass.primary_key}" + end + else excludees << :select # only exclude the select param if it doesn't begin with DISTINCT end @@ -191,13 +211,10 @@ module WillPaginate # merge the hash found in :count # this allows you to specify :select, :order, or anything else just for the count query count_options.update options[:count] if options[:count] - - # we may be in a model or an association proxy - klass = (@owner and @reflection) ? @reflection.klass : self - + # forget about includes if they are irrelevant (Rails 2.1) if count_options[:include] and - klass.private_methods.include?('references_eager_loaded_tables?') and + klass.private_methods.include_method?(:references_eager_loaded_tables?) and !klass.send(:references_eager_loaded_tables?, count_options) count_options.delete :include end @@ -209,16 +226,16 @@ module WillPaginate # scope_out adds a 'with_finder' method which acts like with_scope, if it's present # then execute the count with the scoping provided by the with_finder send(scoper, &counter) - elsif match = /^find_(all_by|by)_([_a-zA-Z]\w*)$/.match(finder) + elsif finder =~ /^find_(all_by|by)_([_a-zA-Z]\w*)$/ # extract conditions from calls like "paginate_by_foo_and_bar" - attribute_names = extract_attribute_names_from_match(match) + attribute_names = $2.split('_and_') conditions = construct_attributes_from_arguments(attribute_names, args) with_scope(:find => { :conditions => conditions }, &counter) else counter.call end - count.respond_to?(:length) ? count.length : count + (!count.is_a?(Integer) && count.respond_to?(:length)) ? count.length : count end def wp_parse_options(options) #:nodoc: diff --git a/vendor/plugins/will_paginate/lib/will_paginate/named_scope.rb b/vendor/gems/will_paginate-2.3.15/lib/will_paginate/named_scope.rb index 6f00cf76a..5a743d7fb 100644 --- a/vendor/plugins/will_paginate/lib/will_paginate/named_scope.rb +++ b/vendor/gems/will_paginate-2.3.15/lib/will_paginate/named_scope.rb @@ -1,27 +1,22 @@ -## stolen from: http://dev.rubyonrails.org/browser/trunk/activerecord/lib/active_record/named_scope.rb?rev=9084 - module WillPaginate # This is a feature backported from Rails 2.1 because of its usefullness not only with will_paginate, # but in other aspects when managing complex conditions that you want to be reusable. module NamedScope # All subclasses of ActiveRecord::Base have two named_scopes: # * <tt>all</tt>, which is similar to a <tt>find(:all)</tt> query, and - # * <tt>scoped</tt>, which allows for the creation of anonymous scopes, on the fly: - # - # Shirt.scoped(:conditions => {:color => 'red'}).scoped(:include => :washing_instructions) + # * <tt>scoped</tt>, which allows for the creation of anonymous scopes, on the fly: <tt>Shirt.scoped(:conditions => {:color => 'red'}).scoped(:include => :washing_instructions)</tt> # # These anonymous scopes tend to be useful when procedurally generating complex queries, where passing # intermediate values (scopes) around as first-class objects is convenient. def self.included(base) base.class_eval do extend ClassMethods - named_scope :all named_scope :scoped, lambda { |scope| scope } end end module ClassMethods - def scopes #:nodoc: + def scopes read_inheritable_attribute(:scopes) || write_inheritable_attribute(:scopes, {}) end @@ -46,7 +41,7 @@ module WillPaginate # Nested finds and calculations also work with these compositions: <tt>Shirt.red.dry_clean_only.count</tt> returns the number of garments # for which these criteria obtain. Similarly with <tt>Shirt.red.dry_clean_only.average(:thread_count)</tt>. # - # All scopes are available as class methods on the ActiveRecord descendent upon which the scopes were defined. But they are also available to + # All scopes are available as class methods on the ActiveRecord::Base descendent upon which the scopes were defined. But they are also available to # <tt>has_many</tt> associations. If, # # class Person < ActiveRecord::Base @@ -76,14 +71,27 @@ module WillPaginate # end # end # - def named_scope(name, options = {}, &block) + # + # For testing complex named scopes, you can examine the scoping options using the + # <tt>proxy_options</tt> method on the proxy itself. + # + # class Shirt < ActiveRecord::Base + # named_scope :colored, lambda { |color| + # { :conditions => { :color => color } } + # } + # end + # + # expected_options = { :conditions => { :colored => 'red' } } + # assert_equal expected_options, Shirt.colored('red').proxy_options + def named_scope(name, options = {}) + name = name.to_sym scopes[name] = lambda do |parent_scope, *args| Scope.new(parent_scope, case options when Hash options when Proc options.call(*args) - end, &block) + end) { |*a| yield(*a) if block_given? } end (class << self; self end).instance_eval do define_method name do |*args| @@ -93,14 +101,20 @@ module WillPaginate end end - class Scope #:nodoc: + class Scope attr_reader :proxy_scope, :proxy_options - [].methods.each { |m| delegate m, :to => :proxy_found unless m =~ /(^__|^nil\?|^send|class|extend|find|count|sum|average|maximum|minimum|paginate)/ } + + [].methods.each do |m| + unless m =~ /(^__|^nil\?|^send|^object_id$|class|extend|^find$|count|sum|average|maximum|minimum|paginate|first|last|empty\?|respond_to\?)/ + delegate m, :to => :proxy_found + end + end + delegate :scopes, :with_scope, :to => :proxy_scope - def initialize(proxy_scope, options, &block) + def initialize(proxy_scope, options) [options[:extend]].flatten.each { |extension| extend extension } if options[:extend] - extend Module.new(&block) if block_given? + extend Module.new { |*args| yield(*args) } if block_given? @proxy_scope, @proxy_options = proxy_scope, options.except(:extend) end @@ -108,18 +122,42 @@ module WillPaginate load_found; self end + def first(*args) + if args.first.kind_of?(Integer) || (@found && !args.first.kind_of?(Hash)) + proxy_found.first(*args) + else + find(:first, *args) + end + end + + def last(*args) + if args.first.kind_of?(Integer) || (@found && !args.first.kind_of?(Hash)) + proxy_found.last(*args) + else + find(:last, *args) + end + end + + def empty? + @found ? @found.empty? : count.zero? + end + + def respond_to?(method, include_private = false) + super || @proxy_scope.respond_to?(method, include_private) + end + protected def proxy_found @found || load_found end private - def method_missing(method, *args, &block) + def method_missing(method, *args) if scopes.include?(method) scopes[method].call(self, *args) else with_scope :find => proxy_options do - proxy_scope.send(method, *args, &block) + proxy_scope.send(method, *args) { |*a| yield(*a) if block_given? } end end end diff --git a/vendor/plugins/will_paginate/lib/will_paginate/named_scope_patch.rb b/vendor/gems/will_paginate-2.3.15/lib/will_paginate/named_scope_patch.rb index bdc1997fc..7daff5922 100644 --- a/vendor/plugins/will_paginate/lib/will_paginate/named_scope_patch.rb +++ b/vendor/gems/will_paginate-2.3.15/lib/will_paginate/named_scope_patch.rb @@ -1,9 +1,7 @@ -## based on http://dev.rubyonrails.org/changeset/9084 - ActiveRecord::Associations::AssociationProxy.class_eval do protected - def with_scope(*args, &block) - @reflection.klass.send :with_scope, *args, &block + def with_scope(*args) + @reflection.klass.send(:with_scope, *args) { |*a| yield(*a) if block_given? } end end @@ -12,11 +10,11 @@ end klass.class_eval do protected alias :method_missing_without_scopes :method_missing_without_paginate - def method_missing_without_paginate(method, *args, &block) + def method_missing_without_paginate(method, *args) if @reflection.klass.scopes.include?(method) - @reflection.klass.scopes[method].call(self, *args, &block) + @reflection.klass.scopes[method].call(self, *args) { |*a| yield(*a) if block_given? } else - method_missing_without_scopes(method, *args, &block) + method_missing_without_scopes(method, *args) { |*a| yield(*a) if block_given? } end end end @@ -25,14 +23,14 @@ end # Rails 1.2.6 ActiveRecord::Associations::HasAndBelongsToManyAssociation.class_eval do protected - def method_missing(method, *args, &block) + def method_missing(method, *args) if @target.respond_to?(method) || (!@reflection.klass.respond_to?(method) && Class.respond_to?(method)) super elsif @reflection.klass.scopes.include?(method) @reflection.klass.scopes[method].call(self, *args) else @reflection.klass.with_scope(:find => { :conditions => @finder_sql, :joins => @join_sql, :readonly => false }) do - @reflection.klass.send(method, *args, &block) + @reflection.klass.send(method, *args) { |*a| yield(*a) if block_given? } end end end diff --git a/vendor/plugins/will_paginate/lib/will_paginate/version.rb b/vendor/gems/will_paginate-2.3.15/lib/will_paginate/version.rb index 6bcd90d66..b7de1ad36 100644 --- a/vendor/plugins/will_paginate/lib/will_paginate/version.rb +++ b/vendor/gems/will_paginate-2.3.15/lib/will_paginate/version.rb @@ -2,7 +2,7 @@ module WillPaginate module VERSION MAJOR = 2 MINOR = 3 - TINY = 3 + TINY = 15 STRING = [MAJOR, MINOR, TINY].join('.') end diff --git a/vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb b/vendor/gems/will_paginate-2.3.15/lib/will_paginate/view_helpers.rb index 9737710ab..48972b6e4 100644 --- a/vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb +++ b/vendor/gems/will_paginate-2.3.15/lib/will_paginate/view_helpers.rb @@ -99,7 +99,7 @@ module WillPaginate options = options.symbolize_keys.reverse_merge WillPaginate::ViewHelpers.pagination_options if options[:prev_label] - WillPaginate::Deprecation::warn(":prev_label view parameter is now :previous_label; the old name has been deprecated.") + WillPaginate::Deprecation::warn(":prev_label view parameter is now :previous_label; the old name has been deprecated", caller) options[:previous_label] = options.delete(:prev_label) end @@ -141,8 +141,15 @@ module WillPaginate # blocks of pagination links sharing the same ID (which is invalid HTML). def paginated_section(*args, &block) pagination = will_paginate(*args).to_s - content = pagination + capture(&block) + pagination - concat content, block.binding + + unless ActionView::Base.respond_to? :erb_variable + concat pagination + yield + concat pagination + else + content = pagination + capture(&block) + pagination + concat(content, block.binding) + end end # Renders a helpful message with numbers of displayed vs. total entries. @@ -175,15 +182,18 @@ module WillPaginate ] end end - + + if respond_to? :safe_helper + safe_helper :will_paginate, :paginated_section, :page_entries_info + end + def self.total_pages_for_collection(collection) #:nodoc: if collection.respond_to?('page_count') and !collection.respond_to?('total_pages') - WillPaginate::Deprecation.warn <<-MSG + WillPaginate::Deprecation.warn %{ You are using a paginated collection of class #{collection.class.name} which conforms to the old API of WillPaginate::Collection by using `page_count`, while the current method name is `total_pages`. Please - upgrade yours or 3rd-party code that provides the paginated collection. - MSG + upgrade yours or 3rd-party code that provides the paginated collection}, caller class << collection def total_pages; page_count; end end @@ -228,6 +238,7 @@ module WillPaginate links.push page_link_or_span(@collection.next_page, 'disabled next_page', @options[:next_label]) html = links.join(@options[:separator]) + html = html.html_safe if html.respond_to? :html_safe @options[:container] ? @template.content_tag(:div, html, html_attributes) : html end @@ -287,6 +298,7 @@ module WillPaginate def page_link_or_span(page, span_class, text = nil) text ||= page.to_s + text = text.html_safe if text.respond_to? :html_safe if page and page != current_page classnames = span_class && span_class.index(' ') && span_class.split(' ', 2).last @@ -315,8 +327,7 @@ module WillPaginate stringified_merge @url_params, @options[:params] if @options[:params] if complex = param_name.index(/[^\w-]/) - page_param = (defined?(CGIMethods) ? CGIMethods : ActionController::AbstractRequest). - parse_query_parameters("#{param_name}=#{page}") + page_param = parse_query_parameters("#{param_name}=#{page}") stringified_merge @url_params, page_param else @@ -327,21 +338,21 @@ module WillPaginate return url if page_one if complex - @url_string = url.sub(%r!((?:\?|&)#{CGI.escape param_name}=)#{page}!, '\1@') + @url_string = url.sub(%r!((?:\?|&)#{CGI.escape param_name}=)#{page}!, "\\1\0") return url else @url_string = url @url_params[param_name] = 3 @template.url_for(@url_params).split(//).each_with_index do |char, i| if char == '3' and url[i, 1] == '2' - @url_string[i] = '@' + @url_string[i] = "\0" break end end end end # finally! - @url_string.sub '@', page.to_s + @url_string.sub "\0", page.to_s end private @@ -379,5 +390,21 @@ module WillPaginate end end end + + def parse_query_parameters(params) + if defined? Rack::Utils + # For Rails > 2.3 + Rack::Utils.parse_nested_query(params) + elsif defined?(ActionController::AbstractRequest) + ActionController::AbstractRequest.parse_query_parameters(params) + elsif defined?(ActionController::UrlEncodedPairParser) + # For Rails > 2.2 + ActionController::UrlEncodedPairParser.parse_query_parameters(params) + elsif defined?(CGIMethods) + CGIMethods.parse_query_parameters(params) + else + raise "unsupported ActionPack version" + end + end end end diff --git a/vendor/plugins/will_paginate/test/boot.rb b/vendor/gems/will_paginate-2.3.15/test/boot.rb index 622fc93c4..5344b0794 100644 --- a/vendor/plugins/will_paginate/test/boot.rb +++ b/vendor/gems/will_paginate-2.3.15/test/boot.rb @@ -15,7 +15,7 @@ else if version gem 'rails', version else - gem 'actionpack' - gem 'activerecord' + gem 'actionpack', '< 3.0.0.a' + gem 'activerecord', '< 3.0.0.a' end end diff --git a/vendor/plugins/will_paginate/test/collection_test.rb b/vendor/gems/will_paginate-2.3.15/test/collection_test.rb index b33609015..a9336bbeb 100644 --- a/vendor/plugins/will_paginate/test/collection_test.rb +++ b/vendor/gems/will_paginate-2.3.15/test/collection_test.rb @@ -2,6 +2,9 @@ require 'helper' require 'will_paginate/array' class ArrayPaginationTest < Test::Unit::TestCase + + def setup ; end + def test_simple collection = ('a'..'e').to_a diff --git a/vendor/plugins/will_paginate/test/console b/vendor/gems/will_paginate-2.3.15/test/console index 3f282f114..3f282f114 100755 --- a/vendor/plugins/will_paginate/test/console +++ b/vendor/gems/will_paginate-2.3.15/test/console diff --git a/vendor/plugins/will_paginate/test/database.yml b/vendor/gems/will_paginate-2.3.15/test/database.yml index 28c543073..b2794c3e1 100644 --- a/vendor/plugins/will_paginate/test/database.yml +++ b/vendor/gems/will_paginate-2.3.15/test/database.yml @@ -17,6 +17,6 @@ mysql: postgres: adapter: postgresql username: mislav - password: mislav + password: database: will_paginate_unittest min_messages: warning diff --git a/vendor/plugins/will_paginate/test/finder_test.rb b/vendor/gems/will_paginate-2.3.15/test/finder_test.rb index ca7afcb08..9e1381a3e 100644 --- a/vendor/plugins/will_paginate/test/finder_test.rb +++ b/vendor/gems/will_paginate-2.3.15/test/finder_test.rb @@ -9,7 +9,7 @@ class FinderTest < ActiveRecordTestCase fixtures :topics, :replies, :users, :projects, :developers_projects def test_new_methods_presence - assert_respond_to_all Topic, %w(per_page paginate paginate_by_sql) + assert_respond_to_all Topic, %w(per_page paginate paginate_by_sql paginate_by_definition_in_class) end def test_simple_paginate @@ -39,6 +39,22 @@ class FinderTest < ActiveRecordTestCase assert_nothing_raised { Topic.paginate :page => 1, :count => nil } end + def test_counting_when_integer_has_length_method + Integer.module_eval { def length; to_s.length; end } + begin + assert_equal 2, 11.length + entries = Developer.paginate :page => 1, :per_page => 5 + assert_equal 11, entries.total_entries + assert_equal 5, entries.size + assert_equal 3, entries.total_pages + ensure + begin + Integer.module_eval { remove_method :length } + rescue + end + end + end + def test_paginate_with_per_page entries = Topic.paginate :page => 1, :per_page => 1 assert_equal 1, entries.size @@ -197,7 +213,7 @@ class FinderTest < ActiveRecordTestCase def test_paginate_with_dynamic_finder expected = [replies(:witty_retort), replies(:spam)] - assert_equal expected, Reply.paginate_by_topic_id(1, :page => 1) + assert_equal expected, Reply.paginate_by_topic_id(1, :page => 1, :order => :created_at) entries = Developer.paginate :conditions => { :salary => 100000 }, :page => 1, :per_page => 5 assert_equal 8, entries.total_entries @@ -261,6 +277,12 @@ class FinderTest < ActiveRecordTestCase assert_equal 1, entries.total_entries, 'only one topic should be found' end end + + def test_named_scope_with_include + project = projects(:active_record) + entries = project.topics.with_replies_starting_with('AR ').paginate(:page => 1, :per_page => 1) + assert_equal 1, entries.size + end ## misc ## @@ -278,11 +300,11 @@ class FinderTest < ActiveRecordTestCase # this functionality is temporarily removed def xtest_pagination_defines_method pager = "paginate_by_created_at" - assert !User.methods.include?(pager), "User methods should not include `#{pager}` method" + assert !User.methods.include_method?(pager), "User methods should not include `#{pager}` method" # paginate! assert 0, User.send(pager, nil, :page => 1).total_entries # the paging finder should now be defined - assert User.methods.include?(pager), "`#{pager}` method should be defined on User" + assert User.methods.include_method?(pager), "`#{pager}` method should be defined on User" end # Is this Rails 2.0? Find out by testing find_all which was removed in [6998] @@ -340,6 +362,12 @@ class FinderTest < ActiveRecordTestCase Developer.paginate :select => 'DISTINCT salary', :page => 2 end + def test_count_with_scoped_select_when_distinct + Developer.stubs(:find).returns([]) + Developer.expects(:count).with(:select => 'DISTINCT users.id').returns(0) + Developer.distinct.paginate :page => 2 + end + def test_should_use_scoped_finders_if_present # scope-out compatibility Topic.expects(:find_best).returns(Array.new(5)) @@ -349,18 +377,15 @@ class FinderTest < ActiveRecordTestCase end def test_paginate_by_sql - assert_respond_to Developer, :paginate_by_sql - Developer.expects(:find_by_sql).with(regexp_matches(/sql LIMIT 3(,| OFFSET) 3/)).returns([]) - Developer.expects(:count_by_sql).with('SELECT COUNT(*) FROM (sql) AS count_table').returns(0) - - entries = Developer.paginate_by_sql 'sql', :page => 2, :per_page => 3 + sql = "SELECT * FROM users WHERE type = 'Developer' ORDER BY id" + entries = Developer.paginate_by_sql(sql, :page => 2, :per_page => 3) + assert_equal 11, entries.total_entries + assert_equal [users(:dev_4), users(:dev_5), users(:dev_6)], entries end def test_paginate_by_sql_respects_total_entries_setting - Developer.expects(:find_by_sql).returns([]) - Developer.expects(:count_by_sql).never - - entries = Developer.paginate_by_sql 'sql', :page => 1, :total_entries => 999 + sql = "SELECT * FROM users" + entries = Developer.paginate_by_sql(sql, :page => 1, :total_entries => 999) assert_equal 999, entries.total_entries end @@ -390,12 +415,11 @@ class FinderTest < ActiveRecordTestCase def test_paginating_finder_doesnt_mangle_options Developer.expects(:find).returns([]) - options = { :page => 1 } - options.expects(:delete).never + options = { :page => 1, :per_page => 2, :foo => 'bar' } options_before = options.dup Developer.paginate(options) - assert_equal options, options_before + assert_equal options_before, options end def test_paginate_by_sql_doesnt_change_original_query @@ -422,8 +446,14 @@ class FinderTest < ActiveRecordTestCase assert_equal 14, Developer.paginated_each(:page => '2') { } end + def test_paginated_each_with_named_scope + assert_equal 2, Developer.poor.paginated_each(:per_page => 1) { + assert_equal 11, Developer.count + } + end + # detect ActiveRecord 2.1 - if ActiveRecord::Base.private_methods.include?('references_eager_loaded_tables?') + if ActiveRecord::Base.private_methods.include_method?(:references_eager_loaded_tables?) def test_removes_irrelevant_includes_in_count Developer.expects(:find).returns([1]) Developer.expects(:count).with({}).returns(0) @@ -439,5 +469,28 @@ class FinderTest < ActiveRecordTestCase :include => :projects, :conditions => 'projects.id > 2' end end + + def test_paginate_from + result = Developer.paginate(:from => 'users', :page => 1, :per_page => 1) + assert_equal 1, result.size + end + + def test_hmt_with_include + # ticket #220 + reply = projects(:active_record).replies.find(:first, :order => 'replies.id') + assert_equal replies(:decisive), reply + + # ticket #223 + Project.find(1, :include => :replies) + + # I cannot reproduce any of the failures from those reports :( + end + + def test_hmt_with_uniq + project = Project.find(1) + result = project.unique_replies.paginate :page => 1, :per_page => 1, + :order => 'replies.id' + assert_equal replies(:decisive), result.first + end end end diff --git a/vendor/plugins/will_paginate/test/fixtures/admin.rb b/vendor/gems/will_paginate-2.3.15/test/fixtures/admin.rb index 1d5e7f36a..1d5e7f36a 100644 --- a/vendor/plugins/will_paginate/test/fixtures/admin.rb +++ b/vendor/gems/will_paginate-2.3.15/test/fixtures/admin.rb diff --git a/vendor/plugins/will_paginate/test/fixtures/developer.rb b/vendor/gems/will_paginate-2.3.15/test/fixtures/developer.rb index 7105355da..0224f4bf8 100644 --- a/vendor/plugins/will_paginate/test/fixtures/developer.rb +++ b/vendor/gems/will_paginate-2.3.15/test/fixtures/developer.rb @@ -7,6 +7,7 @@ class Developer < User end end + named_scope :distinct, :select => 'DISTINCT `users`.*' named_scope :poor, :conditions => ['salary <= ?', 80000], :order => 'salary' def self.per_page() 10 end diff --git a/vendor/plugins/will_paginate/test/fixtures/developers_projects.yml b/vendor/gems/will_paginate-2.3.15/test/fixtures/developers_projects.yml index cee359c7c..cee359c7c 100644 --- a/vendor/plugins/will_paginate/test/fixtures/developers_projects.yml +++ b/vendor/gems/will_paginate-2.3.15/test/fixtures/developers_projects.yml diff --git a/vendor/plugins/will_paginate/test/fixtures/project.rb b/vendor/gems/will_paginate-2.3.15/test/fixtures/project.rb index 0f85ef5ea..7f6d72cd1 100644 --- a/vendor/plugins/will_paginate/test/fixtures/project.rb +++ b/vendor/gems/will_paginate-2.3.15/test/fixtures/project.rb @@ -12,4 +12,6 @@ class Project < ActiveRecord::Base end end end + + has_many :unique_replies, :through => :topics, :source => :replies, :uniq => true end diff --git a/vendor/plugins/will_paginate/test/fixtures/projects.yml b/vendor/gems/will_paginate-2.3.15/test/fixtures/projects.yml index 74f3c32f6..74f3c32f6 100644 --- a/vendor/plugins/will_paginate/test/fixtures/projects.yml +++ b/vendor/gems/will_paginate-2.3.15/test/fixtures/projects.yml diff --git a/vendor/plugins/will_paginate/test/fixtures/replies.yml b/vendor/gems/will_paginate-2.3.15/test/fixtures/replies.yml index 9a83c004a..9a83c004a 100644 --- a/vendor/plugins/will_paginate/test/fixtures/replies.yml +++ b/vendor/gems/will_paginate-2.3.15/test/fixtures/replies.yml diff --git a/vendor/plugins/will_paginate/test/fixtures/reply.rb b/vendor/gems/will_paginate-2.3.15/test/fixtures/reply.rb index ecaf3c1fc..ecaf3c1fc 100644 --- a/vendor/plugins/will_paginate/test/fixtures/reply.rb +++ b/vendor/gems/will_paginate-2.3.15/test/fixtures/reply.rb diff --git a/vendor/plugins/will_paginate/test/fixtures/schema.rb b/vendor/gems/will_paginate-2.3.15/test/fixtures/schema.rb index 8831aad22..8831aad22 100644 --- a/vendor/plugins/will_paginate/test/fixtures/schema.rb +++ b/vendor/gems/will_paginate-2.3.15/test/fixtures/schema.rb diff --git a/vendor/plugins/will_paginate/test/fixtures/topic.rb b/vendor/gems/will_paginate-2.3.15/test/fixtures/topic.rb index 77be0dda2..2dd94955e 100644 --- a/vendor/plugins/will_paginate/test/fixtures/topic.rb +++ b/vendor/gems/will_paginate-2.3.15/test/fixtures/topic.rb @@ -3,4 +3,10 @@ class Topic < ActiveRecord::Base belongs_to :project named_scope :mentions_activerecord, :conditions => ['topics.title LIKE ?', '%ActiveRecord%'] + + named_scope :with_replies_starting_with, lambda { |text| + { :conditions => "replies.content LIKE '#{text}%' ", :include => :replies } + } + + def self.paginate_by_definition_in_class; end end diff --git a/vendor/plugins/will_paginate/test/fixtures/topics.yml b/vendor/gems/will_paginate-2.3.15/test/fixtures/topics.yml index 0a2690473..0a2690473 100644 --- a/vendor/plugins/will_paginate/test/fixtures/topics.yml +++ b/vendor/gems/will_paginate-2.3.15/test/fixtures/topics.yml diff --git a/vendor/plugins/will_paginate/test/fixtures/user.rb b/vendor/gems/will_paginate-2.3.15/test/fixtures/user.rb index 4a57cf079..4a57cf079 100644 --- a/vendor/plugins/will_paginate/test/fixtures/user.rb +++ b/vendor/gems/will_paginate-2.3.15/test/fixtures/user.rb diff --git a/vendor/plugins/will_paginate/test/fixtures/users.yml b/vendor/gems/will_paginate-2.3.15/test/fixtures/users.yml index ed2c03ae1..ed2c03ae1 100644 --- a/vendor/plugins/will_paginate/test/fixtures/users.yml +++ b/vendor/gems/will_paginate-2.3.15/test/fixtures/users.yml diff --git a/vendor/plugins/will_paginate/test/helper.rb b/vendor/gems/will_paginate-2.3.15/test/helper.rb index ad52b1b65..7b55af59c 100644 --- a/vendor/plugins/will_paginate/test/helper.rb +++ b/vendor/gems/will_paginate-2.3.15/test/helper.rb @@ -29,8 +29,8 @@ end # Wrap tests that use Mocha and skip if unavailable. def uses_mocha(test_name) - require 'mocha' unless Object.const_defined?(:Mocha) -rescue LoadError => load_error + require 'mocha' +rescue LoadError $stderr.puts "Skipping #{test_name} tests. `gem install mocha` and try again." else yield diff --git a/vendor/plugins/will_paginate/test/lib/activerecord_test_case.rb b/vendor/gems/will_paginate-2.3.15/test/lib/activerecord_test_case.rb index 8f66ebee4..72a6b16e3 100644 --- a/vendor/plugins/will_paginate/test/lib/activerecord_test_case.rb +++ b/vendor/gems/will_paginate-2.3.15/test/lib/activerecord_test_case.rb @@ -1,6 +1,13 @@ require 'lib/activerecord_test_connector' class ActiveRecordTestCase < Test::Unit::TestCase + if defined?(ActiveSupport::Testing::SetupAndTeardown) + include ActiveSupport::Testing::SetupAndTeardown + end + + if defined?(ActiveRecord::TestFixtures) + include ActiveRecord::TestFixtures + end # Set our fixture path if ActiveRecordTestConnector.able_to_connect self.fixture_path = File.join(File.dirname(__FILE__), '..', 'fixtures') diff --git a/vendor/plugins/will_paginate/test/lib/activerecord_test_connector.rb b/vendor/gems/will_paginate-2.3.15/test/lib/activerecord_test_connector.rb index 0decd8a2f..d3e80e6e3 100644 --- a/vendor/plugins/will_paginate/test/lib/activerecord_test_connector.rb +++ b/vendor/gems/will_paginate-2.3.15/test/lib/activerecord_test_connector.rb @@ -16,16 +16,21 @@ class ActiveRecordTestConnector unless self.connected || !self.able_to_connect setup_connection load_schema - Dependencies.load_paths.unshift FIXTURES_PATH + add_load_path FIXTURES_PATH self.connected = true end rescue Exception => e # errors from ActiveRecord setup - $stderr.puts "\nSkipping ActiveRecord tests: #{e}" - $stderr.puts "Install SQLite3 to run the full test suite for will_paginate.\n\n" + $stderr.puts "\nSkipping ActiveRecord tests: #{e}\n\n" self.able_to_connect = false end private + + def self.add_load_path(path) + dep = defined?(ActiveSupport::Dependencies) ? ActiveSupport::Dependencies : ::Dependencies + autoload_paths = dep.respond_to?(:autoload_paths) ? dep.autoload_paths : dep.load_paths + autoload_paths.unshift path + end def self.setup_connection db = ENV['DB'].blank?? 'sqlite3' : ENV['DB'] @@ -37,6 +42,8 @@ class ActiveRecordTestConnector ActiveRecord::Base.logger = Logger.new(STDOUT) if $0 == 'irb' puts "using #{configuration['adapter']} adapter" unless ENV['DB'].blank? + gem 'sqlite3-ruby' if 'sqlite3' == db + ActiveRecord::Base.establish_connection(configuration) ActiveRecord::Base.configurations = { db => configuration } prepare ActiveRecord::Base.connection diff --git a/vendor/plugins/will_paginate/test/lib/load_fixtures.rb b/vendor/gems/will_paginate-2.3.15/test/lib/load_fixtures.rb index 10d6f4209..10d6f4209 100644 --- a/vendor/plugins/will_paginate/test/lib/load_fixtures.rb +++ b/vendor/gems/will_paginate-2.3.15/test/lib/load_fixtures.rb diff --git a/vendor/plugins/will_paginate/test/lib/view_test_process.rb b/vendor/gems/will_paginate-2.3.15/test/lib/view_test_process.rb index e4e79d571..8da1b71c1 100644 --- a/vendor/plugins/will_paginate/test/lib/view_test_process.rb +++ b/vendor/gems/will_paginate-2.3.15/test/lib/view_test_process.rb @@ -1,3 +1,4 @@ +require 'will_paginate/core_ext' require 'action_controller' require 'action_controller/test_process' @@ -17,6 +18,13 @@ end ActionController::Base.perform_caching = false class WillPaginate::ViewTestCase < Test::Unit::TestCase + if defined?(ActionController::TestCase::Assertions) + include ActionController::TestCase::Assertions + end + if defined?(ActiveSupport::Testing::Deprecation) + include ActiveSupport::Testing::Deprecation + end + def setup super @controller = DummyController.new @@ -42,15 +50,21 @@ class WillPaginate::ViewTestCase < Test::Unit::TestCase locals = { :collection => collection, :options => options } - if defined? ActionView::InlineTemplate - # Rails 2.1 - args = [ ActionView::InlineTemplate.new(@view, @template, locals) ] + unless @view.respond_to? :render_template + # Rails 2.2 + @html_result = ActionView::InlineTemplate.new(@template).render(@view, locals) else - # older Rails versions - args = [nil, @template, nil, locals] + if defined? ActionView::InlineTemplate + # Rails 2.1 + args = [ ActionView::InlineTemplate.new(@view, @template, locals) ] + else + # older Rails versions + args = [nil, @template, nil, locals] + end + + @html_result = @view.render_template(*args) end - @html_result = @view.render_template(*args) @html_document = HTML::Document.new(@html_result, true, false) if block_given? diff --git a/vendor/plugins/will_paginate/test/tasks.rake b/vendor/gems/will_paginate-2.3.15/test/tasks.rake index 05804813f..a0453e609 100644 --- a/vendor/plugins/will_paginate/test/tasks.rake +++ b/vendor/gems/will_paginate-2.3.15/test/tasks.rake @@ -35,7 +35,7 @@ task :test_full => %w(test test_mysql test_postgres) desc %{Test everything with Rails 2.1.x, 2.0.x & 1.2.x gems} task :test_all do all = Rake::Task['test_full'] - versions = %w(2.1.0 2.0.2 1.2.6) + versions = %w(2.3.2 2.2.2 2.1.0 2.0.4 1.2.6) versions.each do |version| ENV['RAILS_VERSION'] = "~> #{version}" all.invoke diff --git a/vendor/plugins/will_paginate/test/view_test.rb b/vendor/gems/will_paginate-2.3.15/test/view_test.rb index bd6b77f82..3777cced7 100644 --- a/vendor/plugins/will_paginate/test/view_test.rb +++ b/vendor/gems/will_paginate-2.3.15/test/view_test.rb @@ -192,13 +192,15 @@ class ViewTest < WillPaginate::ViewTestCase @html_result end - def test_page_entries_info_with_longer_class_name - @template = '<%= page_entries_info collection %>' - collection = ('a'..'z').to_a.paginate - collection.first.stubs(:class).returns(mock('class', :name => 'ProjectType')) + uses_mocha 'class name' do + def test_page_entries_info_with_longer_class_name + @template = '<%= page_entries_info collection %>' + collection = ('a'..'z').to_a.paginate + collection.first.stubs(:class).returns(mock('class', :name => 'ProjectType')) - paginate collection - assert @html_result.index('project types'), "expected <#{@html_result.inspect}> to mention 'project types'" + paginate collection + assert @html_result.index('project types'), "expected <#{@html_result.inspect}> to mention 'project types'" + end end def test_page_entries_info_with_single_page_collection @@ -275,6 +277,14 @@ class ViewTest < WillPaginate::ViewTestCase end end end + + def test_will_paginate_with_atmark_url + @request.symbolized_path_parameters[:action] = "@tag" + renderer = WillPaginate::LinkRenderer.new + + paginate({ :page => 1 }, :renderer=>renderer) + assert_links_match %r[/foo/@tag\?page=\d] + end def test_complex_custom_page_param @request.params :developers => { :page => 2 } diff --git a/vendor/plugins/will_paginate/.gitignore b/vendor/plugins/will_paginate/.gitignore deleted file mode 100644 index 2b437b91c..000000000 --- a/vendor/plugins/will_paginate/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/doc -/rails -*.gem -/coverage diff --git a/vendor/plugins/will_paginate/.manifest b/vendor/plugins/will_paginate/.manifest deleted file mode 100644 index cda4af444..000000000 --- a/vendor/plugins/will_paginate/.manifest +++ /dev/null @@ -1,49 +0,0 @@ -CHANGELOG.rdoc -LICENSE -README.rdoc -Rakefile -examples -examples/apple-circle.gif -examples/index.haml -examples/index.html -examples/pagination.css -examples/pagination.sass -init.rb -lib -lib/will_paginate -lib/will_paginate.rb -lib/will_paginate/array.rb -lib/will_paginate/collection.rb -lib/will_paginate/core_ext.rb -lib/will_paginate/finder.rb -lib/will_paginate/named_scope.rb -lib/will_paginate/named_scope_patch.rb -lib/will_paginate/version.rb -lib/will_paginate/view_helpers.rb -test -test/boot.rb -test/collection_test.rb -test/console -test/database.yml -test/finder_test.rb -test/fixtures -test/fixtures/admin.rb -test/fixtures/developer.rb -test/fixtures/developers_projects.yml -test/fixtures/project.rb -test/fixtures/projects.yml -test/fixtures/replies.yml -test/fixtures/reply.rb -test/fixtures/schema.rb -test/fixtures/topic.rb -test/fixtures/topics.yml -test/fixtures/user.rb -test/fixtures/users.yml -test/helper.rb -test/lib -test/lib/activerecord_test_case.rb -test/lib/activerecord_test_connector.rb -test/lib/load_fixtures.rb -test/lib/view_test_process.rb -test/tasks.rake -test/view_test.rb
\ No newline at end of file diff --git a/vendor/plugins/will_paginate/README b/vendor/plugins/will_paginate/README deleted file mode 100644 index 24bda4085..000000000 --- a/vendor/plugins/will_paginate/README +++ /dev/null @@ -1,119 +0,0 @@ -= WillPaginate - -Pagination is just limiting the number of records displayed. Why should you let -it get in your way while doing more important tasks on your project? This -plugin makes magic happen. Ever wanted to be able to do just this: - - Post.paginate :page => 1 - -... and then render the page links with a single call to a view helper? Well, -now you can. Simply: - - script/plugin install svn://errtheblog.com/svn/plugins/will_paginate - -Ryan Bates made an awesome screencast[http://railscasts.com/episodes/51], check -it out. - - -== Example usage: - -Use a paginate finder in the controller: - - @posts = Post.paginate_by_board_id @board.id, :page => params[:page] - -Yeah, +paginate+ works just like +find+ -- it just doesn't fetch all the -records. Don't forget to tell it which page you want, or it will complain! -Read more on WillPaginate::Finder::ClassMethods. - -Render the posts in your view like you would normally do. When you need to render -pagination, just stick this in: - - <%= will_paginate @posts %> - -You're done. (Copy and paste the example fancy CSS styles from the bottom.) You -can find the option list at WillPaginate::ViewHelpers. - -How does it know how much items to fetch per page? It asks your model by calling -+Post.per_page+. You can define it like this: - - class Post < ActiveRecord::Base - cattr_reader :per_page - @@per_page = 50 - end - -... or like this: - - class Post < ActiveRecord::Base - def self.per_page - 50 - end - end - -... or don't worry about it at all. (WillPaginate defines it to be 30 if missing.) -You can also specify the count explicitly when calling +paginate+: - - @posts = Post.paginate :page => params[:page], :per_page => 50 - -The +paginate+ finder wraps the original finder and returns your resultset that now has -some new properties. You can use the collection as you would with any ActiveRecord -resultset, but WillPaginate view helpers also need that object to be able to render pagination: - - <ol> - <% for post in @posts -%> - <li>Render `post` in some nice way.</li> - <% end -%> - </ol> - - <p>Now let's render us some pagination!</p> - <%= will_paginate @posts %> - - -== Authors, credits, contact! - -REPORT BUGS on Lighthouse: http://err.lighthouseapp.com/projects/466-plugins/overview - -BROWSE SOURCE on Warehouse: http://plugins.require.errtheblog.com/browser/will_paginate - -Want to discuss, request features, ask questions? Join the Google group: -http://groups.google.com/group/will_paginate - - Ruby port by: PJ Hyett, Mislav Marohnić (Sulien) - Original announcement: http://errtheblog.com/post/929 - Original PHP source: http://www.strangerstudios.com/sandbox/pagination/diggstyle.php - Contributors: Chris Wanstrath, Dr. Nic Williams, K. Adam Christensen, - Mike Garey, Bence Golda, Matt Aimonetti, Charles Brian Quinn, - Desi McAdam, James Coglan, Matijs van Zuijlen - -== Want Digg style? - -Copy the following css into your stylesheet for a good start: - - .pagination { - padding: 3px; - margin: 3px; - } - .pagination a { - padding: 2px 5px 2px 5px; - margin: 2px; - border: 1px solid #aaaadd; - text-decoration: none; - color: #000099; - } - .pagination a:hover, .pagination a:active { - border: 1px solid #000099; - color: #000; - } - .pagination span.current { - padding: 2px 5px 2px 5px; - margin: 2px; - border: 1px solid #000099; - font-weight: bold; - background-color: #000099; - color: #FFF; - } - .pagination span.disabled { - padding: 2px 5px 2px 5px; - margin: 2px; - border: 1px solid #eee; - color: #ddd; - } diff --git a/vendor/plugins/will_paginate/examples/apple-circle.gif b/vendor/plugins/will_paginate/examples/apple-circle.gif Binary files differdeleted file mode 100644 index df8cbf7c8..000000000 --- a/vendor/plugins/will_paginate/examples/apple-circle.gif +++ /dev/null diff --git a/vendor/plugins/will_paginate/examples/index.haml b/vendor/plugins/will_paginate/examples/index.haml deleted file mode 100644 index fb41ac8a4..000000000 --- a/vendor/plugins/will_paginate/examples/index.haml +++ /dev/null @@ -1,69 +0,0 @@ -!!! -%html -%head - %title Samples of pagination styling for will_paginate - %link{ :rel => 'stylesheet', :type => 'text/css', :href => 'pagination.css' } - %style{ :type => 'text/css' } - :sass - html - :margin 0 - :padding 0 - :background #999 - :font normal 76% "Lucida Grande", Verdana, Helvetica, sans-serif - body - :margin 2em - :padding 2em - :border 2px solid gray - :background white - :color #222 - h1 - :font-size 2em - :font-weight normal - :margin 0 0 1em 0 - h2 - :font-size 1.4em - :margin 1em 0 .5em 0 - pre - :font-size 13px - :font-family Monaco, "DejaVu Sans Mono", "Bitstream Vera Mono", "Courier New", monospace - -- pagination = '<span class="disabled prev_page">« Previous</span> <span class="current">1</span> <a href="./?page=2" rel="next">2</a> <a href="./?page=3">3</a> <a href="./?page=4">4</a> <a href="./?page=5">5</a> <a href="./?page=6">6</a> <a href="./?page=7">7</a> <a href="./?page=8">8</a> <a href="./?page=9">9</a> <span class="gap">…</span> <a href="./?page=29">29</a> <a href="./?page=30">30</a> <a href="./?page=2" rel="next" class="next_page">Next »</a>' -- pagination_no_page_links = '<span class="disabled prev_page">« Previous</span> <a href="./?page=2" rel="next" class="next_page">Next »</a>' - -%body - %h1 Samples of pagination styling for will_paginate - %p - Find these styles in <b>"examples/pagination.css"</b> of <i>will_paginate</i> library. - There is a Sass version of it for all you sassy people. - %p - Read about good rules for pagination: - %a{ :href => 'http://kurafire.net/log/archive/2007/06/22/pagination-101' } Pagination 101 - %p - %em Warning: - page links below don't lead anywhere (so don't click on them). - - %h2 Unstyled pagination <span style="font-weight:normal">(<i>ewww!</i>)</span> - %div= pagination - - %h2 Digg.com - .digg_pagination= pagination - - %h2 Digg-style, no page links - .digg_pagination= pagination_no_page_links - %p Code that renders this: - %pre= '<code>%s</code>' % %[<%= will_paginate @posts, :page_links => false %>].gsub('<', '<').gsub('>', '>') - - %h2 Digg-style, extra content - .digg_pagination - .page_info Displaying entries <b>1 - 6</b> of <b>180</b> in total - = pagination - %p Code that renders this: - %pre= '<code>%s</code>' % %[<div class="digg_pagination">\n <div clas="page_info">\n <%= page_entries_info @posts %>\n </div>\n <%= will_paginate @posts, :container => false %>\n</div>].gsub('<', '<').gsub('>', '>') - - %h2 Apple.com store - .apple_pagination= pagination - - %h2 Flickr.com - .flickr_pagination - = pagination - .page_info (118 photos) diff --git a/vendor/plugins/will_paginate/examples/index.html b/vendor/plugins/will_paginate/examples/index.html deleted file mode 100644 index 858f7c6f9..000000000 --- a/vendor/plugins/will_paginate/examples/index.html +++ /dev/null @@ -1,92 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html> -</html> -<head> - <title>Samples of pagination styling for will_paginate</title> - <link href='pagination.css' rel='stylesheet' type='text/css' /> - <style type='text/css'> - html { - margin: 0; - padding: 0; - background: #999; - font: normal 76% "Lucida Grande", Verdana, Helvetica, sans-serif; } - - body { - margin: 2em; - padding: 2em; - border: 2px solid gray; - background: white; - color: #222; } - - h1 { - font-size: 2em; - font-weight: normal; - margin: 0 0 1em 0; } - - h2 { - font-size: 1.4em; - margin: 1em 0 .5em 0; } - - pre { - font-size: 13px; - font-family: Monaco, "DejaVu Sans Mono", "Bitstream Vera Mono", "Courier New", monospace; } - </style> -</head> -<body> - <h1>Samples of pagination styling for will_paginate</h1> - <p> - Find these styles in <b>"examples/pagination.css"</b> of <i>will_paginate</i> library. - There is a Sass version of it for all you sassy people. - </p> - <p> - Read about good rules for pagination: - <a href='http://kurafire.net/log/archive/2007/06/22/pagination-101'>Pagination 101</a> - </p> - <p> - <em>Warning:</em> - page links below don't lead anywhere (so don't click on them). - </p> - <h2> - Unstyled pagination <span style="font-weight:normal">(<i>ewww!</i>)</span> - </h2> - <div> - <span class="disabled prev_page">« Previous</span> <span class="current">1</span> <a href="./?page=2" rel="next">2</a> <a href="./?page=3">3</a> <a href="./?page=4">4</a> <a href="./?page=5">5</a> <a href="./?page=6">6</a> <a href="./?page=7">7</a> <a href="./?page=8">8</a> <a href="./?page=9">9</a> <span class="gap">…</span> <a href="./?page=29">29</a> <a href="./?page=30">30</a> <a href="./?page=2" rel="next" class="next_page">Next »</a> - </div> - <h2>Digg.com</h2> - <div class='digg_pagination'> - <span class="disabled prev_page">« Previous</span> <span class="current">1</span> <a href="./?page=2" rel="next">2</a> <a href="./?page=3">3</a> <a href="./?page=4">4</a> <a href="./?page=5">5</a> <a href="./?page=6">6</a> <a href="./?page=7">7</a> <a href="./?page=8">8</a> <a href="./?page=9">9</a> <span class="gap">…</span> <a href="./?page=29">29</a> <a href="./?page=30">30</a> <a href="./?page=2" rel="next" class="next_page">Next »</a> - </div> - <h2>Digg-style, no page links</h2> - <div class='digg_pagination'> - <span class="disabled prev_page">« Previous</span> <a href="./?page=2" rel="next" class="next_page">Next »</a> - </div> - <p>Code that renders this:</p> - <pre> - <code><%= will_paginate @posts, :page_links => false %></code> - </pre> - <h2>Digg-style, extra content</h2> - <div class='digg_pagination'> - <div class='page_info'> - Displaying entries <b>1 - 6</b> of <b>180</b> in total - </div> - <span class="disabled prev_page">« Previous</span> <span class="current">1</span> <a href="./?page=2" rel="next">2</a> <a href="./?page=3">3</a> <a href="./?page=4">4</a> <a href="./?page=5">5</a> <a href="./?page=6">6</a> <a href="./?page=7">7</a> <a href="./?page=8">8</a> <a href="./?page=9">9</a> <span class="gap">…</span> <a href="./?page=29">29</a> <a href="./?page=30">30</a> <a href="./?page=2" rel="next" class="next_page">Next »</a> - </div> - <p>Code that renders this:</p> - <pre> - <code><div class="digg_pagination"> - <div clas="page_info"> - <%= page_entries_info @posts %> - </div> - <%= will_paginate @posts, :container => false %> - </div></code> - </pre> - <h2>Apple.com store</h2> - <div class='apple_pagination'> - <span class="disabled prev_page">« Previous</span> <span class="current">1</span> <a href="./?page=2" rel="next">2</a> <a href="./?page=3">3</a> <a href="./?page=4">4</a> <a href="./?page=5">5</a> <a href="./?page=6">6</a> <a href="./?page=7">7</a> <a href="./?page=8">8</a> <a href="./?page=9">9</a> <span class="gap">…</span> <a href="./?page=29">29</a> <a href="./?page=30">30</a> <a href="./?page=2" rel="next" class="next_page">Next »</a> - </div> - <h2>Flickr.com</h2> - <div class='flickr_pagination'> - <span class="disabled prev_page">« Previous</span> <span class="current">1</span> <a href="./?page=2" rel="next">2</a> <a href="./?page=3">3</a> <a href="./?page=4">4</a> <a href="./?page=5">5</a> <a href="./?page=6">6</a> <a href="./?page=7">7</a> <a href="./?page=8">8</a> <a href="./?page=9">9</a> <span class="gap">…</span> <a href="./?page=29">29</a> <a href="./?page=30">30</a> <a href="./?page=2" rel="next" class="next_page">Next »</a> - <div class='page_info'>(118 photos)</div> - </div> -</body> diff --git a/vendor/plugins/will_paginate/examples/pagination.css b/vendor/plugins/will_paginate/examples/pagination.css deleted file mode 100644 index b55e9779b..000000000 --- a/vendor/plugins/will_paginate/examples/pagination.css +++ /dev/null @@ -1,90 +0,0 @@ -.digg_pagination { - background: white; - /* self-clearing method: */ } - .digg_pagination a, .digg_pagination span { - padding: .2em .5em; - display: block; - float: left; - margin-right: 1px; } - .digg_pagination span.disabled { - color: #999; - border: 1px solid #DDD; } - .digg_pagination span.current { - font-weight: bold; - background: #2E6AB1; - color: white; - border: 1px solid #2E6AB1; } - .digg_pagination a { - text-decoration: none; - color: #105CB6; - border: 1px solid #9AAFE5; } - .digg_pagination a:hover, .digg_pagination a:focus { - color: #003; - border-color: #003; } - .digg_pagination .page_info { - background: #2E6AB1; - color: white; - padding: .4em .6em; - width: 22em; - margin-bottom: .3em; - text-align: center; } - .digg_pagination .page_info b { - color: #003; - background: #6aa6ed; - padding: .1em .25em; } - .digg_pagination:after { - content: "."; - display: block; - height: 0; - clear: both; - visibility: hidden; } - * html .digg_pagination { - height: 1%; } - *:first-child+html .digg_pagination { - overflow: hidden; } - -.apple_pagination { - background: #F1F1F1; - border: 1px solid #E5E5E5; - text-align: center; - padding: 1em; } - .apple_pagination a, .apple_pagination span { - padding: .2em .3em; } - .apple_pagination span.disabled { - color: #AAA; } - .apple_pagination span.current { - font-weight: bold; - background: transparent url(apple-circle.gif) no-repeat 50% 50%; } - .apple_pagination a { - text-decoration: none; - color: black; } - .apple_pagination a:hover, .apple_pagination a:focus { - text-decoration: underline; } - -.flickr_pagination { - text-align: center; - padding: .3em; } - .flickr_pagination a, .flickr_pagination span { - padding: .2em .5em; } - .flickr_pagination span.disabled { - color: #AAA; } - .flickr_pagination span.current { - font-weight: bold; - color: #FF0084; } - .flickr_pagination a { - border: 1px solid #DDDDDD; - color: #0063DC; - text-decoration: none; } - .flickr_pagination a:hover, .flickr_pagination a:focus { - border-color: #003366; - background: #0063DC; - color: white; } - .flickr_pagination .page_info { - color: #aaa; - padding-top: .8em; } - .flickr_pagination .prev_page, .flickr_pagination .next_page { - border-width: 2px; } - .flickr_pagination .prev_page { - margin-right: 1em; } - .flickr_pagination .next_page { - margin-left: 1em; } diff --git a/vendor/plugins/will_paginate/examples/pagination.sass b/vendor/plugins/will_paginate/examples/pagination.sass deleted file mode 100644 index 737a97bee..000000000 --- a/vendor/plugins/will_paginate/examples/pagination.sass +++ /dev/null @@ -1,91 +0,0 @@ -.digg_pagination - :background white - a, span - :padding .2em .5em - :display block - :float left - :margin-right 1px - span.disabled - :color #999 - :border 1px solid #DDD - span.current - :font-weight bold - :background #2E6AB1 - :color white - :border 1px solid #2E6AB1 - a - :text-decoration none - :color #105CB6 - :border 1px solid #9AAFE5 - &:hover, &:focus - :color #003 - :border-color #003 - .page_info - :background #2E6AB1 - :color white - :padding .4em .6em - :width 22em - :margin-bottom .3em - :text-align center - b - :color #003 - :background = #2E6AB1 + 60 - :padding .1em .25em - - /* self-clearing method: - &:after - :content "." - :display block - :height 0 - :clear both - :visibility hidden - * html & - :height 1% - *:first-child+html & - :overflow hidden - -.apple_pagination - :background #F1F1F1 - :border 1px solid #E5E5E5 - :text-align center - :padding 1em - a, span - :padding .2em .3em - span.disabled - :color #AAA - span.current - :font-weight bold - :background transparent url(apple-circle.gif) no-repeat 50% 50% - a - :text-decoration none - :color black - &:hover, &:focus - :text-decoration underline - -.flickr_pagination - :text-align center - :padding .3em - a, span - :padding .2em .5em - span.disabled - :color #AAA - span.current - :font-weight bold - :color #FF0084 - a - :border 1px solid #DDDDDD - :color #0063DC - :text-decoration none - &:hover, &:focus - :border-color #003366 - :background #0063DC - :color white - .page_info - :color #aaa - :padding-top .8em - .prev_page, .next_page - :border-width 2px - .prev_page - :margin-right 1em - .next_page - :margin-left 1em diff --git a/vendor/plugins/will_paginate/init.rb b/vendor/plugins/will_paginate/init.rb deleted file mode 100644 index 838d30ecb..000000000 --- a/vendor/plugins/will_paginate/init.rb +++ /dev/null @@ -1 +0,0 @@ -require 'will_paginate' diff --git a/vendor/plugins/will_paginate/test/array_pagination_test.rb b/vendor/plugins/will_paginate/test/array_pagination_test.rb deleted file mode 100644 index e3eaa0813..000000000 --- a/vendor/plugins/will_paginate/test/array_pagination_test.rb +++ /dev/null @@ -1,121 +0,0 @@ -require File.dirname(__FILE__) + '/helper' -require 'will_paginate' -require 'will_paginate/core_ext' - -class ArrayPaginationTest < Test::Unit::TestCase - def test_simple - collection = ('a'..'e').to_a - - [{ :page => 1, :per_page => 3, :expected => %w( a b c ) }, - { :page => 2, :per_page => 3, :expected => %w( d e ) }, - { :page => 1, :per_page => 5, :expected => %w( a b c d e ) }, - { :page => 3, :per_page => 5, :expected => [] }, - { :page => -1, :per_page => 5, :expected => [] }, - { :page => 1, :per_page => -5, :expected => [] }, - ]. - each do |conditions| - assert_equal conditions[:expected], collection.paginate(conditions.slice(:page, :per_page)) - end - end - - def test_defaults - result = (1..50).to_a.paginate - assert_equal 1, result.current_page - assert_equal 30, result.size - end - - def test_deprecated_api - assert_deprecated 'paginate API' do - result = (1..50).to_a.paginate(2, 10) - assert_equal 2, result.current_page - assert_equal (11..20).to_a, result - assert_equal 50, result.total_entries - end - - assert_deprecated { [].paginate nil } - end - - def test_total_entries_has_precedence - result = %w(a b c).paginate :total_entries => 5 - assert_equal 5, result.total_entries - end - - def test_argument_error_with_params_and_another_argument - assert_raise ArgumentError do - [].paginate({}, 5) - end - end - - def test_paginated_collection - entries = %w(a b c) - collection = create(2, 3, 10) do |pager| - assert_equal entries, pager.replace(entries) - end - - assert_equal entries, collection - assert_respond_to_all collection, %w(page_count each offset size current_page per_page total_entries) - assert_kind_of Array, collection - assert_instance_of Array, collection.entries - assert_equal 3, collection.offset - assert_equal 4, collection.page_count - assert !collection.out_of_bounds? - end - - def test_out_of_bounds - entries = create(2, 3, 2){} - assert entries.out_of_bounds? - - entries = create(0, 3, 2){} - assert entries.out_of_bounds? - - entries = create(1, 3, 2){} - assert !entries.out_of_bounds? - end - - def test_guessing_total_count - entries = create do |pager| - # collection is shorter than limit - pager.replace array - end - assert_equal 8, entries.total_entries - - entries = create(2, 5, 10) do |pager| - # collection is shorter than limit, but we have an explicit count - pager.replace array - end - assert_equal 10, entries.total_entries - - entries = create do |pager| - # collection is the same as limit; we can't guess - pager.replace array(5) - end - assert_equal nil, entries.total_entries - - entries = create do |pager| - # collection is empty; we can't guess - pager.replace array(0) - end - assert_equal nil, entries.total_entries - end - - private - def create(page = 2, limit = 5, total = nil, &block) - WillPaginate::Collection.create(page, limit, total, &block) - end - - def array(size = 3) - Array.new(size) - end - - def collect_deprecations - old_behavior = WillPaginate::Deprecation.behavior - deprecations = [] - WillPaginate::Deprecation.behavior = Proc.new do |message, callstack| - deprecations << message - end - result = yield - [result, deprecations] - ensure - WillPaginate::Deprecation.behavior = old_behavior - end -end diff --git a/vendor/plugins/will_paginate/test/pagination_test.rb b/vendor/plugins/will_paginate/test/pagination_test.rb deleted file mode 100644 index 9d2295399..000000000 --- a/vendor/plugins/will_paginate/test/pagination_test.rb +++ /dev/null @@ -1,146 +0,0 @@ -require File.dirname(__FILE__) + '/helper' -require 'action_controller' -require 'action_controller/test_process' - -ActionController::Routing::Routes.reload rescue nil -ActionController::Routing::Routes.draw do |map| - map.connect ':controller/:action/:id' -end - -ActionController::Base.perform_caching = false - -require 'will_paginate' -WillPaginate.enable_actionpack - -class PaginationTest < Test::Unit::TestCase - - class PaginationController < ActionController::Base - def list_developers - @options = params.delete(:options) || {} - - @developers = (1..11).to_a.paginate( - :page => params[@options[:param_name] || :page] || 1, - :per_page => params[:per_page] || 4 - ) - - render :inline => '<%= will_paginate @developers, @options %>' - end - - protected - def rescue_errors(e) raise e end - def rescue_action(e) raise e end - end - - def setup - @controller = PaginationController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - super - end - - def test_will_paginate - get :list_developers - - entries = assigns :developers - assert entries - assert_equal 4, entries.size - - assert_select 'div.pagination', 1, 'no main DIV' do |el| - assert_select 'a[href]', 3 do |elements| - validate_page_numbers [2,3,2], elements - assert_select elements.last, ':last-child', "Next »" - end - assert_select 'span', 2 - assert_select 'span.disabled:first-child', "« Previous" - assert_select 'span.current', entries.current_page.to_s - end - end - - def test_will_paginate_with_options - get :list_developers, :page => 2, :options => { - :class => 'will_paginate', :prev_label => 'Prev', :next_label => 'Next' - } - assert_response :success - - entries = assigns :developers - assert entries - assert_equal 4, entries.size - - assert_select 'div.will_paginate', 1, 'no main DIV' do - assert_select 'a[href]', 4 do |elements| - validate_page_numbers [nil,nil,3,3], elements - assert_select elements.first, 'a', "Prev" - assert_select elements.last, 'a', "Next" - end - assert_select 'span.current', entries.current_page.to_s - end - end - - def test_will_paginate_preserves_parameters - get :list_developers, :foo => { :bar => 'baz' } - assert_response :success - - assert_select 'div.pagination', 1, 'no main DIV' do - assert_select 'a[href]', 3 do |elements| - elements.each do |el| - assert_match /foo%5Bbar%5D=baz/, el['href'], "THIS IS A BUG in Rails 1.2 which " + - "has been fixed in Rails 2.0." - # there is no need to worry *unless* you too are using hashes in parameters which - # need to be preserved over pages - end - end - end - end - - def test_will_paginate_with_custom_page_param - get :list_developers, :developers_page => 2, :options => { :param_name => :developers_page } - assert_response :success - - entries = assigns :developers - assert entries - assert_equal 4, entries.size - - assert_select 'div.pagination', 1, 'no main DIV' do - assert_select 'a[href]', 4 do |elements| - validate_page_numbers [nil,nil,3,3], elements, :developers_page - end - assert_select 'span.current', entries.current_page.to_s - end - end - - def test_will_paginate_windows - get :list_developers, :page => 6, :per_page => 1, :options => { :inner_window => 2 } - assert_response :success - - entries = assigns :developers - assert entries - assert_equal 1, entries.size - - assert_select 'div.pagination', 1, 'no main DIV' do - assert_select 'a[href]', 10 do |elements| - validate_page_numbers [5,nil,2,4,5,7,8,10,11,7], elements - assert_select elements.first, 'a', "« Previous" - assert_select elements.last, 'a', "Next »" - end - assert_select 'span.current', entries.current_page.to_s - end - end - - def test_no_pagination - get :list_developers, :per_page => 12 - entries = assigns :developers - assert_equal 1, entries.page_count - assert_equal 11, entries.size - - assert_equal '', @response.body - end - -protected - - def validate_page_numbers expected, links, param_name = :page - assert_equal(expected, links.map { |e| - e['href'] =~ /\W#{param_name}=([^&]*)/ - $1 ? $1.to_i : $1 - }) - end -end diff --git a/vendor/plugins/will_paginate/will_paginate.gemspec b/vendor/plugins/will_paginate/will_paginate.gemspec deleted file mode 100644 index 25852605e..000000000 --- a/vendor/plugins/will_paginate/will_paginate.gemspec +++ /dev/null @@ -1,21 +0,0 @@ -Gem::Specification.new do |s| - s.name = 'will_paginate' - s.version = '2.3.3' - s.date = '2008-08-29' - - s.summary = "Most awesome pagination solution for Rails" - s.description = "The will_paginate library provides a simple, yet powerful and extensible API for ActiveRecord pagination and rendering of pagination links in ActionView templates." - - s.authors = ['Mislav Marohnić', 'PJ Hyett'] - s.email = 'mislav.marohnic@gmail.com' - s.homepage = 'http://github.com/mislav/will_paginate/wikis' - - s.has_rdoc = true - s.rdoc_options = ['--main', 'README.rdoc'] - s.rdoc_options << '--inline-source' << '--charset=UTF-8' - s.extra_rdoc_files = ['README.rdoc', 'LICENSE', 'CHANGELOG'] - s.add_dependency 'activesupport', ['>= 1.4.4'] - - s.files = %w(CHANGELOG.rdoc LICENSE README.rdoc Rakefile examples examples/apple-circle.gif examples/index.haml examples/index.html examples/pagination.css examples/pagination.sass init.rb lib lib/will_paginate lib/will_paginate.rb lib/will_paginate/array.rb lib/will_paginate/collection.rb lib/will_paginate/core_ext.rb lib/will_paginate/finder.rb lib/will_paginate/named_scope.rb lib/will_paginate/named_scope_patch.rb lib/will_paginate/version.rb lib/will_paginate/view_helpers.rb test test/boot.rb test/collection_test.rb test/console test/database.yml test/finder_test.rb test/fixtures test/fixtures/admin.rb test/fixtures/developer.rb test/fixtures/developers_projects.yml test/fixtures/project.rb test/fixtures/projects.yml test/fixtures/replies.yml test/fixtures/reply.rb test/fixtures/schema.rb test/fixtures/topic.rb test/fixtures/topics.yml test/fixtures/user.rb test/fixtures/users.yml test/helper.rb test/lib test/lib/activerecord_test_case.rb test/lib/activerecord_test_connector.rb test/lib/load_fixtures.rb test/lib/view_test_process.rb test/tasks.rake test/view_test.rb) - s.test_files = %w(test/boot.rb test/collection_test.rb test/console test/database.yml test/finder_test.rb test/fixtures test/fixtures/admin.rb test/fixtures/developer.rb test/fixtures/developers_projects.yml test/fixtures/project.rb test/fixtures/projects.yml test/fixtures/replies.yml test/fixtures/reply.rb test/fixtures/schema.rb test/fixtures/topic.rb test/fixtures/topics.yml test/fixtures/user.rb test/fixtures/users.yml test/helper.rb test/lib test/lib/activerecord_test_case.rb test/lib/activerecord_test_connector.rb test/lib/load_fixtures.rb test/lib/view_test_process.rb test/tasks.rake test/view_test.rb) -end |