Commit 7b1191e39c2f2a2b86ac656833f971cb5419335f
1 parent
f78c0086
Exists in
master
and in
22 other branches
ActionItem31: adding tags and abstract for articles
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@998 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
6 changed files
with
12 additions
and
15 deletions
Show diff stats
app/controllers/my_profile/cms_controller.rb
| ... | ... | @@ -19,7 +19,7 @@ class CmsController < MyProfileController |
| 19 | 19 | end |
| 20 | 20 | |
| 21 | 21 | def edit |
| 22 | - @article = Article.find(params[:id]) | |
| 22 | + @article = profile.articles.find(params[:id]) | |
| 23 | 23 | if request.post? |
| 24 | 24 | @article.last_changed_by = user |
| 25 | 25 | if @article.update_attributes(params[:article]) |
| ... | ... | @@ -32,7 +32,7 @@ class CmsController < MyProfileController |
| 32 | 32 | end |
| 33 | 33 | |
| 34 | 34 | def new |
| 35 | - # FIXME until now, use text/html by default | |
| 35 | + # FIXME need to display a page and let the user choose a type of article. | |
| 36 | 36 | type = params[:type] || 'text/html' |
| 37 | 37 | |
| 38 | 38 | @article = Article.new(params[:article]) | ... | ... |
app/helpers/cms_helper.rb
| 1 | 1 | module CmsHelper |
| 2 | 2 | |
| 3 | - def link_to_edit_article(article) | |
| 4 | - button('edit', _("Edit"), url_for_edit_article(article)) | |
| 5 | - end | |
| 6 | - | |
| 7 | - def url_for_edit_article(article) | |
| 8 | - action = mime_type_to_action_name(article.mime_type) + '_edit' | |
| 9 | - url_for(:action => action, :id => article.id) | |
| 10 | - end | |
| 11 | - | |
| 12 | 3 | def link_to_new_article(mime_type) |
| 13 | 4 | action = mime_type_to_action_name(mime_type) + '_new' |
| 14 | 5 | button('new', _("New %s") % mime_type, :action => action, :parent_id => params[:parent_id]) | ... | ... |
app/models/article.rb
app/views/cms/text_html_new.rhtml
| ... | ... | @@ -6,11 +6,15 @@ |
| 6 | 6 | |
| 7 | 7 | <%= hidden_field_tag('parent_id', params[:parent_id]) if params[:parent_id] %> |
| 8 | 8 | |
| 9 | - <%= f.text_field 'name', :size => '64' %> | |
| 10 | - | |
| 9 | + <%= f.text_field('name', :size => '64') %> | |
| 10 | + | |
| 11 | + <%= f.text_area('abstract', :cols => 64, :rows => 5) %> | |
| 12 | + | |
| 13 | + <%= f.text_field('tag_list', :size => 64, :title => _('Separate tags with commas')) %> | |
| 14 | + | |
| 11 | 15 | <%= f.text_area('body', :cols => 64) %> |
| 12 | 16 | |
| 13 | 17 | <%= design_display_button_submit('save', _('Save')) %> |
| 14 | - <%= design_display_button('cancel', _('Cancel'), :action => 'view', :id => @article) %> | |
| 18 | + <%= design_display_button('cancel', _('Cancel'), :action => (@article.parent ? 'view' : 'index'), :id => @article.parent) %> | |
| 15 | 19 | |
| 16 | 20 | <% end %> | ... | ... |
app/views/cms/view.rhtml
| ... | ... | @@ -58,7 +58,7 @@ |
| 58 | 58 | </li> |
| 59 | 59 | </ul> |
| 60 | 60 | |
| 61 | - <%= link_to_edit_article(@article) %> | |
| 61 | + <%= button('edit', _('Edit'), { :action => 'edit', :id => @article}) %> | |
| 62 | 62 | <%= button('home', _('Use as homepage'), { :action => 'set_home_page', :id => @article }, { :method => :post }) %> |
| 63 | 63 | <% end %> |
| 64 | 64 | <%= @article.to_html %> | ... | ... |
db/migrate/007_create_articles.rb