diff --git a/app/controllers/my_profile/cms_controller.rb b/app/controllers/my_profile/cms_controller.rb index ebd95ea..91a9565 100644 --- a/app/controllers/my_profile/cms_controller.rb +++ b/app/controllers/my_profile/cms_controller.rb @@ -19,7 +19,7 @@ class CmsController < MyProfileController end def edit - @article = Article.find(params[:id]) + @article = profile.articles.find(params[:id]) if request.post? @article.last_changed_by = user if @article.update_attributes(params[:article]) @@ -32,7 +32,7 @@ class CmsController < MyProfileController end def new - # FIXME until now, use text/html by default + # FIXME need to display a page and let the user choose a type of article. type = params[:type] || 'text/html' @article = Article.new(params[:article]) diff --git a/app/helpers/cms_helper.rb b/app/helpers/cms_helper.rb index fb3a795..9b9aa5e 100644 --- a/app/helpers/cms_helper.rb +++ b/app/helpers/cms_helper.rb @@ -1,14 +1,5 @@ module CmsHelper - def link_to_edit_article(article) - button('edit', _("Edit"), url_for_edit_article(article)) - end - - def url_for_edit_article(article) - action = mime_type_to_action_name(article.mime_type) + '_edit' - url_for(:action => action, :id => article.id) - end - def link_to_new_article(mime_type) action = mime_type_to_action_name(mime_type) + '_new' button('new', _("New %s") % mime_type, :action => action, :parent_id => params[:parent_id]) diff --git a/app/models/article.rb b/app/models/article.rb index 608d9f7..65eb58a 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -8,6 +8,7 @@ class Article < ActiveRecord::Base belongs_to :last_changed_by, :class_name => Person.name, :foreign_key => 'last_changed_by_id' acts_as_taggable + N_('Tag list') acts_as_filesystem diff --git a/app/views/cms/text_html_new.rhtml b/app/views/cms/text_html_new.rhtml index b9723bc..66485d4 100644 --- a/app/views/cms/text_html_new.rhtml +++ b/app/views/cms/text_html_new.rhtml @@ -6,11 +6,15 @@ <%= hidden_field_tag('parent_id', params[:parent_id]) if params[:parent_id] %> - <%= f.text_field 'name', :size => '64' %> - + <%= f.text_field('name', :size => '64') %> + + <%= f.text_area('abstract', :cols => 64, :rows => 5) %> + + <%= f.text_field('tag_list', :size => 64, :title => _('Separate tags with commas')) %> + <%= f.text_area('body', :cols => 64) %> <%= design_display_button_submit('save', _('Save')) %> - <%= design_display_button('cancel', _('Cancel'), :action => 'view', :id => @article) %> + <%= design_display_button('cancel', _('Cancel'), :action => (@article.parent ? 'view' : 'index'), :id => @article.parent) %> <% end %> diff --git a/app/views/cms/view.rhtml b/app/views/cms/view.rhtml index 6045548..8c2ad84 100644 --- a/app/views/cms/view.rhtml +++ b/app/views/cms/view.rhtml @@ -58,7 +58,7 @@ - <%= link_to_edit_article(@article) %> + <%= button('edit', _('Edit'), { :action => 'edit', :id => @article}) %> <%= button('home', _('Use as homepage'), { :action => 'set_home_page', :id => @article }, { :method => :post }) %> <% end %> <%= @article.to_html %> diff --git a/db/migrate/007_create_articles.rb b/db/migrate/007_create_articles.rb index 49e17c4..ea6240c 100644 --- a/db/migrate/007_create_articles.rb +++ b/db/migrate/007_create_articles.rb @@ -10,6 +10,7 @@ class CreateArticles < ActiveRecord::Migration # main data t.column :body, :text + t.column :abstract, :text # belongs to profile t.column :profile_id, :integer -- libgit2 0.21.2