Commit 9db7323146985267a4dd71596a77a2d4101a0093

Authored by AntonioTerceiro
1 parent 92a1dd6b

ActionItem158: displaying the description of the folders


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1793 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/models/folder.rb
... ... @@ -17,6 +17,7 @@ class Folder < Article
17 17 include ActionView::Helpers::UrlHelper
18 18 include ActionController::UrlWriter
19 19 def to_html
  20 + content_tag('div', body) +
20 21 content_tag('ul', children.map { |child| content_tag('li', link_to(child.name, child.url)) }, :class => 'folder-listing')
21 22 end
22 23  
... ...
app/views/cms/_folder.rhtml
1 1  
2 2 <%# TODO add Textile help here %>
  3 +<%= render :file => 'shared/tiny_mce' %>
3 4  
4 5 <%= f.text_field('name', :size => '64') %>
5 6  
  7 +<%= labelled_form_field(_('Description:'), text_area(:article, :body, :cols => 64)) %>
... ...
app/views/cms/_textile_article.rhtml
... ... @@ -3,7 +3,5 @@
3 3  
4 4 <%= f.text_field('name', :size => '64') %>
5 5  
6   -<%= f.text_area('abstract', :cols => 64, :rows => 5) %>
7   -
8 6 <%= f.text_area('body', :cols => 64) %>
9 7  
... ...
app/views/cms/_tiny_mce_article.rhtml
... ... @@ -3,7 +3,5 @@
3 3  
4 4 <%= f.text_field('name', :size => '64') %>
5 5  
6   -<%= f.text_area('abstract', :cols => 64, :rows => 5) %>
7   -
8 6 <%= f.text_area('body', :cols => 64) %>
9 7  
... ...
test/unit/folder_test.rb
... ... @@ -30,6 +30,13 @@ class FolderTest &lt; ActiveSupport::TestCase
30 30 assert_match(/<li><a href=".*\/testuser\/f\/otherarticle">otherarticle<\/a><\/li>/, f.to_html)
31 31 end
32 32  
  33 + should 'show text body in HTML content' do
  34 + p = create_user('testuser').person
  35 + f = Folder.create!(:name => 'f', :profile => p, :body => 'this-is-the-text')
  36 +
  37 + assert_match(/this-is-the-text/, f.to_html)
  38 + end
  39 +
33 40 should 'identify as folder' do
34 41 assert Folder.new.folder?, 'folder must identity itself as folder'
35 42 end
... ...