Commit 52abcfe22262e4fc7488f42fd6f6d24efe6f8091

Authored by Joenio Costa
Committed by Daniela Feitosa
1 parent fcd1069b

More flexibility to themes

- separating the fields date, author and comment link
- adding new div inner main content div

(ActionItem1997)
app/helpers/content_viewer_helper.rb
@@ -22,9 +22,14 @@ module ContentViewerHelper @@ -22,9 +22,14 @@ module ContentViewerHelper
22 end 22 end
23 comments = '' 23 comments = ''
24 unless args[:no_comments] || !article.accept_comments 24 unless args[:no_comments] || !article.accept_comments
25 - comments = ("- %s") % link_to_comments(article) 25 + comments = (" - %s") % link_to_comments(article)
26 end 26 end
27 - title << content_tag('span', _("%s, by %s %s") % [show_date(article.published_at), link_to(article.author_name, article.author.url), comments], :class => 'created-at') 27 + title << content_tag('span',
  28 + content_tag('span', show_date(article.published_at), :class => 'date') +
  29 + content_tag('span', [_(", by %s") % link_to(article.author_name, article.author.url)], :class => 'author') +
  30 + content_tag('span', comments, :class => 'comments'),
  31 + :class => 'created-at'
  32 + )
28 end 33 end
29 title 34 title
30 end 35 end
app/views/layouts/application-ng.rhtml
@@ -66,8 +66,10 @@ @@ -66,8 +66,10 @@
66 <div id="navigation-end"></div> 66 <div id="navigation-end"></div>
67 </div><!-- end id="navigation" --> 67 </div><!-- end id="navigation" -->
68 <div id="content"> 68 <div id="content">
69 - <%= insert_boxes(yield) %>  
70 - <br style='clear: both'/> 69 + <div id="content-inner">
  70 + <%= insert_boxes(yield) %>
  71 + <br style='clear: both'/>
  72 + </div><!-- end id="content-inner" -->
71 </div><!-- end id="content" --> 73 </div><!-- end id="content" -->
72 </div><!-- end id="wrap-2" --> 74 </div><!-- end id="wrap-2" -->
73 </div><!-- end id="wrap-1" --> 75 </div><!-- end id="wrap-1" -->
test/unit/content_viewer_helper_test.rb
@@ -16,13 +16,13 @@ class ContentViewerHelperTest &lt; Test::Unit::TestCase @@ -16,13 +16,13 @@ class ContentViewerHelperTest &lt; Test::Unit::TestCase
16 blog = fast_create(Blog, :name => 'Blog test', :profile_id => profile.id) 16 blog = fast_create(Blog, :name => 'Blog test', :profile_id => profile.id)
17 post = TextileArticle.create!(:name => 'post test', :profile => profile, :parent => blog) 17 post = TextileArticle.create!(:name => 'post test', :profile => profile, :parent => blog)
18 result = article_title(post) 18 result = article_title(post)
19 - assert_match /#{show_date(post.published_at)}, by .*#{profile.identifier}/, result 19 + assert_match /<span class="date">#{show_date(post.published_at)}<\/span><span class="author">, by .*#{profile.identifier}/, result
20 end 20 end
21 21
22 should 'not display published-at for non-blog posts' do 22 should 'not display published-at for non-blog posts' do
23 article = TextileArticle.create!(:name => 'article for test', :profile => profile) 23 article = TextileArticle.create!(:name => 'article for test', :profile => profile)
24 result = article_title(article) 24 result = article_title(article)
25 - assert_no_match /#{show_date(article.published_at)}, by .*#{profile.identifier}/, result 25 + assert_no_match /<span class="date">#{show_date(article.published_at)}<\/span><span class="author">, by .*#{profile.identifier}/, result
26 end 26 end
27 27
28 should 'create link on title of blog posts' do 28 should 'create link on title of blog posts' do