Commit 289857af429678e45da70980e86533c335254229

Authored by AntonioTerceiro
1 parent acbf97a0

ActionItem21: checkpoint



git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@965 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/my_profile/cms/text_html.rb
... ... @@ -2,7 +2,9 @@ class CmsController
2 2  
3 3 def text_html_new
4 4 @article = Article.new(params[:article])
5   - @article.parent = profile.articles.find(params[:parent_id])
  5 + if params[:parent_id]
  6 + @article.parent = profile.articles.find(params[:parent_id])
  7 + end
6 8 @article.profile = profile
7 9 if request.post?
8 10 if @article.save
... ...
app/models/article.rb
... ... @@ -36,7 +36,7 @@ class Article < ActiveRecord::Base
36 36 end
37 37  
38 38 def mime_type_description
39   - _('Text document')
  39 + _('HTML Text document')
40 40 end
41 41  
42 42 def title
... ...
app/views/cms/new.rhtml
  1 +<p>
  2 + <%= _('Choose the type of article:') %>
  3 +</p>
  4 +
  5 +<ul>
1 6 <% CmsController.available_types.each do |item| %>
2   - <%= link_to_new_article(item) %>
  7 + <li><%= link_to_new_article(item) %></li>
3 8 <% end %>
  9 +</ul>
... ...
app/views/cms/text_html_new.rhtml
... ... @@ -2,7 +2,7 @@
2 2  
3 3 <% labelled_form_for 'article', @article do |f| %>
4 4  
5   - <%= hidden_field_tag 'parent_id', params[:parent_id] %>
  5 + <%= hidden_field_tag('parent_id', params[:parent_id]) if params[:parent_id] %>
6 6  
7 7 <%= f.text_field 'name' %>
8 8  
... ...