public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/technoweenie/mephisto.git
Click here to lend your support to: mephisto and make a donation at www.pledgie.com !
fixes to archive section

git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@2136 
567b1171-46fb-0310-a4c9-b4bef9110e78
technoweenie (author)
Sun Sep 10 01:56:13 -0700 2006
commit  4d4c2cd985b0e66568a430e170fb51de1049c7ea
tree    35d5c8772c688875976bcee0bca17f6b0db65550
parent  c99011e25addbe95727e18f088e54ec293e02fb8
...
75
76
77
78
79
 
 
 
 
 
 
 
 
 
 
80
81
82
...
75
76
77
 
 
78
79
80
81
82
83
84
85
86
87
88
89
90
0
@@ -75,8 +75,16 @@ class MephistoController < ApplicationController
0
     end
0
 
0
     def dispatch_archives
0
- @articles = @section.articles.find_all_in_month(@dispatch_path.shift, @dispatch_path.shift, :include => :user)
0
- render_liquid_template_for(:archive, 'articles' => @articles, 'archive_date' => (@articles.first.published_at rescue nil))
0
+ year = @dispatch_path.shift
0
+ month = @dispatch_path.shift
0
+ if year
0
+ month ||= '1'
0
+ else
0
+ year = Time.now.utc.year
0
+ month = Time.now.utc.month
0
+ end
0
+ @articles = @section.articles.find_all_in_month(year, month, :include => :user)
0
+ render_liquid_template_for(:archive, 'articles' => @articles, 'archive_date' => Time.utc(year, month))
0
     end
0
 
0
     def dispatch_search
...
66
67
68
69
70
71
72
73
74
75
76
77
...
66
67
68
 
 
 
 
 
 
69
70
71
0
@@ -66,12 +66,6 @@ class Article < Content
0
 
0
   class << self
0
     def find_all_in_month(year, month, options = {})
0
- if year
0
- month ||= '1'
0
- else
0
- year = Time.now.utc.year
0
- month = Time.now.utc.month
0
- end
0
       find(:all, options.merge(:order => 'contents.published_at DESC', :conditions => ["contents.published_at <= ? AND contents.published_at BETWEEN ? AND ?",
0
         Time.now.utc, *Time.delta(year.to_i, month.to_i)]))
0
     end
...
11
12
13
14
 
15
16
17
...
11
12
13
 
14
15
16
17
0
@@ -11,7 +11,7 @@ module Mephisto
0
         @source = source
0
         @current = current
0
         @section_liquid = [:id, :name, :path].inject({}) { |h, k| h.update k.to_s => @source.send(k) }
0
- @section_liquid[:articles_count] = @source.send(:read_attribute, :articles_count)
0
+ @section_liquid['articles_count'] = @source.send(:read_attribute, :articles_count)
0
       end
0
 
0
       def before_method(method)
...
242
243
244
245
 
246
247
248
...
242
243
244
 
245
246
247
248
0
@@ -242,7 +242,7 @@ class MephistoControllerTest < Test::Unit::TestCase
0
   def test_should_show_monthly_entries
0
     date = Time.now.utc - 4.days
0
     dispatch "archives/#{date.year}/#{date.month}"
0
- assert_models_equal [contents(:welcome), contents(:about), contents(:site_map), contents(:another)], assigns(:articles)
0
+ assert_models_equal [contents(:welcome), contents(:another)], assigns(:articles)
0
   end
0
   
0
   protected
...
13
14
15
16
 
17
18
 
 
19
20
21
...
13
14
15
 
16
17
18
19
20
21
22
23
0
@@ -13,9 +13,11 @@ class SectionDropTest < Test::Unit::TestCase
0
   end
0
 
0
   def test_should_expose_section_fields
0
- [:id, :name, :path, :articles_count].each do |attr|
0
+ [:id, :name, :path].each do |attr|
0
       assert_equal sections(:home).send(attr), Mephisto::Liquid::SectionDrop.new(sections(:home)).before_method(attr)
0
     end
0
+
0
+ assert_equal sections(:home).send(:read_attribute, :articles_count), Mephisto::Liquid::SectionDrop.new(sections(:home)).before_method(:articles_count)
0
   end
0
   
0
   def test_should_report_section_types

Comments

    No one has commented yet.