Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix archive page url

  • Loading branch information...
commit 332a6faeafa834ea936d145a0e0fd0c700c87bcd 1 parent 583667a
Oriol Gual authored October 06, 2010
8  lib/globalize2/compatibility/archive/archive_page_extensions.rb
@@ -3,8 +3,10 @@ module Archive::ArchivePageExtensions
3 3
     def self.included(base)
4 4
       base.class_eval do
5 5
         def child_url(child)
6  
-          date = child.published_at || Time.now
7  
-        
  6
+
  7
+          @year, @month, @day = $1, ($2 || 1).to_i, ($3 || 1).to_i if child.request and child.request.request_uri =~ %r{/(\d{4})(?:/(\d{2})(?:/(\d{2}))?)?/?$}
  8
+          date = (@year ? Date.new(@year.to_i, @month, @day) : (child.published_at || Time.now))
  9
+
8 10
           if ArchiveYearIndexPage === child
9 11
             clean_url "#{ url }/#{ date.strftime '%Y' }/"
10 12
           elsif ArchiveMonthIndexPage === child
@@ -18,4 +20,4 @@ def child_url(child)
18 20
       end
19 21
     end
20 22
   end
21  
-end
  23
+end

0 notes on commit 332a6fa

Please sign in to comment.
Something went wrong with that request. Please try again.