Skip to content

Commit

Permalink
Don't include an anchor in the page links by default.
Browse files Browse the repository at this point in the history
  • Loading branch information
Manfred committed Apr 5, 2011
1 parent a9b22a2 commit 0ea0e84
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion TODO
@@ -1,2 +1 @@
* Merge Scope and Array methods
* Make it possible to use this pattern: http://www.percona.com/ppc2009/PPC2009_mysql_pagination.pdf
2 changes: 1 addition & 1 deletion lib/peiji_san/view_helper.rb
Expand Up @@ -21,7 +21,7 @@ module ViewHelper
DEFAULT_PEIJI_SAN_OPTIONS = {
# For link_to_page
:page_parameter => :page,
:anchor => :explore,
:anchor => nil,
:current_class => :current,
# For pages_to_link_to
:max_visible => 11,
Expand Down
10 changes: 5 additions & 5 deletions test/view_helper_test.rb
Expand Up @@ -44,11 +44,11 @@ def url_for(options)
include PeijiSan::ViewHelper

it "should return a link for a given page number" do
link_to_page(2, collection).should == '<a href="/collections?page=2#explore">2</a>'
link_to_page(2, collection).should == '<a href="/collections?page=2">2</a>'
end

it "should return a link for a given page number with the specified page parameter" do
link_to_page(2, collection, :page_parameter => 'pagina').should == '<a href="/collections?pagina=2#explore">2</a>'
link_to_page(2, collection, :page_parameter => 'pagina').should == '<a href="/collections?pagina=2">2</a>'
end

it "should return a link for a given page number with the specified anchor" do
Expand All @@ -57,7 +57,7 @@ def url_for(options)

it "should return a link for a given page number and include the original params" do
controller.params[:starts_with] = 'h'
link_to_page(2, collection).should == '<a href="/collections?page=2&amp;starts_with=h#explore">2</a>'
link_to_page(2, collection).should == '<a href="/collections?page=2&amp;starts_with=h">2</a>'
end

it "should return a link which does not include the page GET variable if it's page number 1" do
Expand All @@ -67,12 +67,12 @@ def url_for(options)

it "should return a link with the class current if it's for the currently selected page" do
collection.stubs(:current_page?).with(2).returns(true)
link_to_page(2, collection).should == '<a href="/collections?page=2#explore" class="current">2</a>'
link_to_page(2, collection).should == '<a href="/collections?page=2" class="current">2</a>'
end

it "should return a link with the class current if it's for the currently selected page" do
collection.stubs(:current_page?).with(2).returns(true)
link_to_page(2, collection, :current_class => 'looking_at').should == '<a href="/collections?page=2#explore" class="looking_at">2</a>'
link_to_page(2, collection, :current_class => 'looking_at').should == '<a href="/collections?page=2" class="looking_at">2</a>'
end
end

Expand Down

0 comments on commit 0ea0e84

Please sign in to comment.