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 !
show correct timezone in the public site

git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@1406 
567b1171-46fb-0310-a4c9-b4bef9110e78
technoweenie (author)
Sat Jul 22 15:41:30 -0700 2006
commit  614d0a14228a0fa0cb71511984b1e7113ff7372e
tree    8ad30a2da524df5036851c92dfb5ee52ba377f79
parent  6bb09210b06b5d590017eb54c0b0d35ffd8c94c0
...
16
17
18
19
 
20
21
22
...
16
17
18
 
19
20
21
22
0
@@ -16,7 +16,7 @@ module Admin::ArticlesHelper
0
 
0
   def published_at_for(article)
0
     return 'not published' unless article
0
- format = utc_to_local(article.published_at).year == Time.now.year ? :plain : :standard
0
+ format = article.published_at.year == Time.now.utc.year ? :plain : :standard
0
     article.published? ? utc_to_local(article.published_at).to_s(format) : "not published"
0
   end
0
 
...
11
12
13
14
15
 
 
16
17
18
...
11
12
13
 
 
14
15
16
17
18
0
@@ -11,8 +11,8 @@ module Mephisto
0
           'permalink' => article.permalink,
0
           'url' => article.full_permalink,
0
           'body' => article.send(:body_for_mode, mode),
0
- 'published_at' => article.published_at,
0
- 'updated_at' => article.updated_at,
0
+ 'published_at' => article.site.timezone.utc_to_local(article.published_at),
0
+ 'updated_at' => article.site.timezone.utc_to_local(article.updated_at),
0
           'comments_count' => article.comments_count,
0
           'author' => article.user.to_liquid,
0
           'comments_allowed' => article.comments_allowed?
...
2
3
4
 
5
6
7
8
...
2
3
4
5
6
7
8
9
0
@@ -2,6 +2,7 @@
0
 
0
 {% for article in articles %}
0
   <h2>{{ article.title }}</h2>
0
+ <p><span>{{ article.published_at | format_date: 'standard' }}</span></p>
0
   <p>{{ article | link_to_article }}</p>
0
   <p>{{ article.body }}</p>
0
 {% endfor %}
0
\ No newline at end of file
...
91
92
93
94
95
96
97
98
99
 
 
 
 
 
 
 
 
 
 
 
100
101
102
...
91
92
93
 
 
 
 
 
 
94
95
96
97
98
99
100
101
102
103
104
105
106
107
0
@@ -91,12 +91,17 @@ class MephistoControllerTest < Test::Unit::TestCase
0
 
0
   def test_should_render_liquid_templates_on_home
0
     get_mephisto
0
- assert_tag :tag => 'h1', :content => 'This is the layout'
0
- assert_tag :tag => 'p', :content => 'home'
0
- assert_tag :tag => 'h2', :content => contents(:welcome).title
0
- assert_tag :tag => 'h2', :content => contents(:another).title
0
- assert_tag :tag => 'p', :content => contents(:welcome).excerpt
0
- assert_tag :tag => 'p', :content => contents(:another).body
0
+ assert_tag 'h1', :content => 'This is the layout'
0
+ assert_tag 'p', :content => 'home'
0
+ assert_tag 'h2', :content => contents(:welcome).title
0
+ assert_tag 'h2', :content => contents(:another).title
0
+ assert_tag 'p', :content => contents(:welcome).excerpt
0
+ assert_tag 'p', :content => contents(:another).body
0
+ end
0
+
0
+ def test_should_show_time_in_correct_timezone
0
+ get_mephisto
0
+ assert_tag 'span', :content => assigns(:site).timezone.utc_to_local(contents(:welcome).published_at).to_s(:standard)
0
   end
0
 
0
   def test_should_render_liquid_templates_by_sections

Comments

    No one has commented yet.