Commit ae1c68f2d0aa014d79d19458283a4f8bf0ac9317

Authored by Joenio Costa
Committed by Daniela Feitosa
1 parent 5e3082d6

Enabling tiny mce editor for Events

(ActionItem1868)
app/models/event.rb
@@ -116,6 +116,10 @@ class Event < Article @@ -116,6 +116,10 @@ class Event < Article
116 true 116 true
117 end 117 end
118 118
  119 + def tiny_mce?
  120 + true
  121 + end
  122 +
119 include Noosfero::TranslatableContent 123 include Noosfero::TranslatableContent
120 include MaybeAddHttp 124 include MaybeAddHttp
121 125
app/views/cms/_event.rhtml
@@ -15,5 +15,5 @@ @@ -15,5 +15,5 @@
15 15
16 <%= labelled_form_field(_('Address:'), text_field(:article, :address)) %> 16 <%= labelled_form_field(_('Address:'), text_field(:article, :address)) %>
17 17
18 -<%= labelled_form_field(_('Information about the event:'), text_area(:article, :body, :cols => 64)) %> 18 +<%= labelled_form_field(_('Information about the event:'), text_area(:article, :body, :cols => 64, :class => 'mceEditor')) %>
19 19
test/functional/cms_controller_test.rb
@@ -1576,4 +1576,9 @@ class CmsControllerTest &lt; Test::Unit::TestCase @@ -1576,4 +1576,9 @@ class CmsControllerTest &lt; Test::Unit::TestCase
1576 assert_redirected_to :action => 'view', :id => f 1576 assert_redirected_to :action => 'view', :id => f
1577 end 1577 end
1578 1578
  1579 + should 'render TinyMce Editor for events' do
  1580 + get :new, :profile => @profile.identifier, :type => 'Event'
  1581 + assert_tag :tag => 'textarea', :attributes => { :class => 'mceEditor' }
  1582 + end
  1583 +
1579 end 1584 end
test/unit/article_test.rb
@@ -1440,4 +1440,8 @@ class ArticleTest &lt; Test::Unit::TestCase @@ -1440,4 +1440,8 @@ class ArticleTest &lt; Test::Unit::TestCase
1440 assert_nil post.info_from_last_update[:author_url] 1440 assert_nil post.info_from_last_update[:author_url]
1441 end 1441 end
1442 1442
  1443 + should 'tiny mce editor is disabled by default' do
  1444 + assert !Article.new.tiny_mce?
  1445 + end
  1446 +
1443 end 1447 end
test/unit/event_test.rb
@@ -270,4 +270,8 @@ class EventTest &lt; ActiveSupport::TestCase @@ -270,4 +270,8 @@ class EventTest &lt; ActiveSupport::TestCase
270 assert_kind_of Noosfero::TranslatableContent, Event.new 270 assert_kind_of Noosfero::TranslatableContent, Event.new
271 end 271 end
272 272
  273 + should 'tiny mce editor is enabled' do
  274 + assert Event.new.tiny_mce?
  275 + end
  276 +
273 end 277 end
test/unit/tiny_mce_article_test.rb
@@ -236,4 +236,9 @@ class TinyMceArticleTest &lt; Test::Unit::TestCase @@ -236,4 +236,9 @@ class TinyMceArticleTest &lt; Test::Unit::TestCase
236 assert_equal false, a.advertise? 236 assert_equal false, a.advertise?
237 assert_equal false, a.is_trackable? 237 assert_equal false, a.is_trackable?
238 end 238 end
  239 +
  240 + should 'tiny mce editor is enabled' do
  241 + assert TinyMceArticle.new.tiny_mce?
  242 + end
  243 +
239 end 244 end