diff --git a/app/controllers/my_profile/cms/README b/app/controllers/my_profile/cms/README deleted file mode 100644 index 6bd4cf2..0000000 --- a/app/controllers/my_profile/cms/README +++ /dev/null @@ -1,46 +0,0 @@ -CMS editors for Noosfero -======================== - -This directory contains code for custom content editors in Noosfero. - -Creating a new editor -===================== - -:: File structure - -Let's say that you are implementingn and editor for type, say, "foo/bar". Then -you have to create: - - * app/controllers/my_profile/cms/foo_bar.html - * app/views/cms/foo_bar_*.rhtml (one view for each action you define in the - controller class, if applicable). - -:: Coding conventions - -You file must add methods to CmsController class. They are going to be loaded -after the cms_controller.rb file itself, to you don't need to care about -declaring the superclass: - - class CmsController - def foo_bar_edit - # code for preparing the "edit" view - end - - def foo_bar_new - # code for preparing the "new" view - end - - # etc ... - end - -Note that *all* of your actions must be prefixed with the content type (e.g. -"foor_bar_" for "foo/bar"), in order to avoid conflicts. - -The views for those actions can be thrown in app/views/cms/, just like other -views for this controller. - -Limitations -=========== - - - diff --git a/app/controllers/my_profile/cms/text_html.rb b/app/controllers/my_profile/cms/text_html.rb deleted file mode 100644 index 03c460a..0000000 --- a/app/controllers/my_profile/cms/text_html.rb +++ /dev/null @@ -1,5 +0,0 @@ -class CmsController - - # add eventual helper methods you need for editing your type of article. - -end diff --git a/app/controllers/my_profile/cms_controller.rb b/app/controllers/my_profile/cms_controller.rb index 4539e81..ec7f5fc 100644 --- a/app/controllers/my_profile/cms_controller.rb +++ b/app/controllers/my_profile/cms_controller.rb @@ -26,8 +26,6 @@ class CmsController < MyProfileController return end end - - render :action => "#{mime_type_to_action_name(@article.mime_type)}_edit" end def new @@ -47,7 +45,7 @@ class CmsController < MyProfileController end end - render :action => "#{mime_type_to_action_name(type)}_new" + render :action => 'edit' end post_only :set_home_page diff --git a/app/models/tiny_mce_article.rb b/app/models/tiny_mce_article.rb new file mode 100644 index 0000000..46168f6 --- /dev/null +++ b/app/models/tiny_mce_article.rb @@ -0,0 +1,2 @@ +class TinyMceArticle < Article +end diff --git a/app/views/cms/_article.rhtml b/app/views/cms/_article.rhtml new file mode 120000 index 0000000..8f01891 --- /dev/null +++ b/app/views/cms/_article.rhtml @@ -0,0 +1 @@ +_tiny_mce_article.rhtml \ No newline at end of file diff --git a/app/views/cms/_tiny_mce_article.rhtml b/app/views/cms/_tiny_mce_article.rhtml new file mode 100644 index 0000000..2a2f9d6 --- /dev/null +++ b/app/views/cms/_tiny_mce_article.rhtml @@ -0,0 +1,9 @@ + +<%= f.text_field('name', :size => '64') %> + +<%= f.text_field('tag_list', :size => 64, :title => _('Separate tags with commas')) %> + +<%= f.text_area('abstract', :cols => 64, :rows => 5) %> + +<%= f.text_area('body', :cols => 64) %> + diff --git a/app/views/cms/edit.rhtml b/app/views/cms/edit.rhtml new file mode 100644 index 0000000..4dccdb8 --- /dev/null +++ b/app/views/cms/edit.rhtml @@ -0,0 +1,15 @@ + + +<%= render :file => 'shared/tiny_mce' %> + +<%= error_messages_for 'article' %> + +<% labelled_form_for 'article', @article do |f| %> + + <%= hidden_field_tag('parent_id', params[:parent_id]) if params[:parent_id] %> + + <%= render :partial => partial_for_class(@article.class), :locals => { :f => f } %> + + <%= design_display_button_submit('save', _('Save')) %> + <%= design_display_button('cancel', _('Cancel'), :action => (@article.parent ? 'view' : 'index'), :id => @article.parent) %> +<% end %> diff --git a/app/views/cms/new.rhtml b/app/views/cms/new.rhtml deleted file mode 100644 index 7d7445f..0000000 --- a/app/views/cms/new.rhtml +++ /dev/null @@ -1,9 +0,0 @@ -
- <%= _('Choose the type of article:') %> -
- -+ <%= _('Choose the type of article:') %> +
+ +