Commit de1f4599c8c631278a36218d4db94f8616b02855

Authored by Daniela Feitosa
1 parent 9136a216

Allowing suggestion of html articles

  * Added tinymce editor on lead and body of suggested article
  * Added tiny mce on approval of suggested articles

(ActionItem1887)
app/views/cms/suggest_an_article.rhtml
... ... @@ -21,10 +21,10 @@
21 21 <em><%= _('Used when a short version of your text is needed.') %></em>
22 22  
23 23 <div id="article-lead">
24   - <%= labelled_form_field(_('Lead'), text_area(:task , 'article_abstract', :style => 'width: 100%; height: 200px;')) %>
  24 + <%= labelled_form_field(_('Lead'), text_area(:task , 'article_abstract', :style => 'width: 100%; height: 200px;', :class => 'mceEditor')) %>
25 25 </div>
26 26 <div style="margin-top: 10px;">
27   - <%= labelled_form_field(_('Text'), text_area(:task, 'article_body', :style => 'width:100%; height: 500px;')) %>
  27 + <%= labelled_form_field(_('Text'), text_area(:task, 'article_body', :style => 'width:100%; height: 500px;', :class => 'mceEditor')) %>
28 28 </div>
29 29  
30 30 <div id="captcha">
... ...
app/views/tasks/_suggest_article_accept_details.rhtml
  1 +<%= render :file => 'shared/tiny_mce' %>
  2 +
1 3 <%= labelled_form_field(_("Sent by: "), f.text_field(:name)) %>
2 4 <p><%= label_tag(_("Email: %s") % task.email) %> </p>
3 5 <%= required labelled_form_field(_('Title'), f.text_field(:article_name, :size => 50)) %>
... ... @@ -8,10 +10,10 @@
8 10 <%= labelled_form_field(_('Highlight this article'), f.check_box(:highlighted)) %>
9 11  
10 12 <div>
11   - <%= labelled_form_field(_('Lead'), f.text_area(:article_abstract, :style => 'width: 482px; height: 200px;')) %>
  13 + <%= labelled_form_field(_('Lead'), f.text_area(:article_abstract, :style => 'width: 482px; height: 200px;', :class => 'mceEditor')) %>
12 14 </div>
13 15 <em><%= _('Used when a short version your text is needed.') %></em>
14 16  
15 17 <div style="margin-top: 10px;">
16   - <%= labelled_form_field(_('Text'), f.text_area(:article_body, :style => 'width:482px; height: 500px;')) %>
  18 + <%= labelled_form_field(_('Text'), f.text_area(:article_body, :style => 'width:482px; height: 500px;', :class => 'mceEditor')) %>
17 19 </div>
... ...
test/functional/cms_controller_test.rb
... ... @@ -1423,6 +1423,14 @@ class CmsControllerTest &lt; Test::Unit::TestCase
1423 1423 assert_template 'suggest_an_article'
1424 1424 end
1425 1425  
  1426 + should 'render TinyMce Editor on suggestion of article' do
  1427 + logout
  1428 + get :suggest_an_article, :profile => profile.identifier
  1429 +
  1430 + assert_tag :tag => 'textarea', :attributes => { :name => /article_abstract/, :class => 'mceEditor' }
  1431 + assert_tag :tag => 'textarea', :attributes => { :name => /article_body/, :class => 'mceEditor' }
  1432 + end
  1433 +
1426 1434 should 'create a task suggest task to a profile' do
1427 1435 c = Community.create!(:name => 'test comm', :identifier => 'test_comm', :moderated_articles => true)
1428 1436  
... ...
test/functional/tasks_controller_test.rb
... ... @@ -231,6 +231,19 @@ class TasksControllerTest &lt; Test::Unit::TestCase
231 231 assert_equal Task::Status::ACTIVE, task.status
232 232 end
233 233  
  234 + should 'render TinyMce Editor when approving suggested article task' do
  235 + Task.destroy_all
  236 + c = fast_create(Community)
  237 + c.add_admin profile
  238 + @controller.stubs(:profile).returns(c)
  239 + SuggestArticle.skip_captcha!
  240 + t = SuggestArticle.create!(:article_name => 'test name', :article_abstract => 'test abstract', :article_body => 'test body', :name => 'some name', :email => 'test@localhost.com', :target => c)
  241 +
  242 + get :index
  243 + assert_tag :tag => 'textarea', :content => 'test abstract', :attributes => { :name => /article_abstract/, :class => 'mceEditor' }
  244 + assert_tag :tag => 'textarea', :content => 'test body', :attributes => { :name => /article_body/, :class => 'mceEditor' }
  245 + end
  246 +
234 247 should 'create TinyMceArticle article after finish approve suggested article task' do
235 248 TinyMceArticle.destroy_all
236 249 c = fast_create(Community)
... ...