Commit de1f4599c8c631278a36218d4db94f8616b02855
1 parent
9136a216
Exists in
master
and in
28 other branches
Allowing suggestion of html articles
* Added tinymce editor on lead and body of suggested article * Added tiny mce on approval of suggested articles (ActionItem1887)
Showing
4 changed files
with
27 additions
and
4 deletions
Show diff stats
app/views/cms/suggest_an_article.rhtml
@@ -21,10 +21,10 @@ | @@ -21,10 +21,10 @@ | ||
21 | <em><%= _('Used when a short version of your text is needed.') %></em> | 21 | <em><%= _('Used when a short version of your text is needed.') %></em> |
22 | 22 | ||
23 | <div id="article-lead"> | 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 | </div> | 25 | </div> |
26 | <div style="margin-top: 10px;"> | 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 | </div> | 28 | </div> |
29 | 29 | ||
30 | <div id="captcha"> | 30 | <div id="captcha"> |
app/views/tasks/_suggest_article_accept_details.rhtml
1 | +<%= render :file => 'shared/tiny_mce' %> | ||
2 | + | ||
1 | <%= labelled_form_field(_("Sent by: "), f.text_field(:name)) %> | 3 | <%= labelled_form_field(_("Sent by: "), f.text_field(:name)) %> |
2 | <p><%= label_tag(_("Email: %s") % task.email) %> </p> | 4 | <p><%= label_tag(_("Email: %s") % task.email) %> </p> |
3 | <%= required labelled_form_field(_('Title'), f.text_field(:article_name, :size => 50)) %> | 5 | <%= required labelled_form_field(_('Title'), f.text_field(:article_name, :size => 50)) %> |
@@ -8,10 +10,10 @@ | @@ -8,10 +10,10 @@ | ||
8 | <%= labelled_form_field(_('Highlight this article'), f.check_box(:highlighted)) %> | 10 | <%= labelled_form_field(_('Highlight this article'), f.check_box(:highlighted)) %> |
9 | 11 | ||
10 | <div> | 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 | </div> | 14 | </div> |
13 | <em><%= _('Used when a short version your text is needed.') %></em> | 15 | <em><%= _('Used when a short version your text is needed.') %></em> |
14 | 16 | ||
15 | <div style="margin-top: 10px;"> | 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 | </div> | 19 | </div> |
test/functional/cms_controller_test.rb
@@ -1423,6 +1423,14 @@ class CmsControllerTest < Test::Unit::TestCase | @@ -1423,6 +1423,14 @@ class CmsControllerTest < Test::Unit::TestCase | ||
1423 | assert_template 'suggest_an_article' | 1423 | assert_template 'suggest_an_article' |
1424 | end | 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 | should 'create a task suggest task to a profile' do | 1434 | should 'create a task suggest task to a profile' do |
1427 | c = Community.create!(:name => 'test comm', :identifier => 'test_comm', :moderated_articles => true) | 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 < Test::Unit::TestCase | @@ -231,6 +231,19 @@ class TasksControllerTest < Test::Unit::TestCase | ||
231 | assert_equal Task::Status::ACTIVE, task.status | 231 | assert_equal Task::Status::ACTIVE, task.status |
232 | end | 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 | should 'create TinyMceArticle article after finish approve suggested article task' do | 247 | should 'create TinyMceArticle article after finish approve suggested article task' do |
235 | TinyMceArticle.destroy_all | 248 | TinyMceArticle.destroy_all |
236 | c = fast_create(Community) | 249 | c = fast_create(Community) |