Commit c1c19173a21e1acaea64183b29b86e51ebca6f33

Authored by Rodrigo Souto
Committed by Daniela Feitosa
1 parent e7464a3d

Fixing the tiny_mce articles on tasks

Obs: should be applied over 4ce41162d5baa9389ae22ac09a730515143ad140

(ActionItem1527)
app/models/article.rb
@@ -443,6 +443,10 @@ class Article < ActiveRecord::Base @@ -443,6 +443,10 @@ class Article < ActiveRecord::Base
443 false 443 false
444 end 444 end
445 445
  446 + def tiny_mce?
  447 + false
  448 + end
  449 +
446 def author 450 def author
447 if reference_article 451 if reference_article
448 reference_article.author 452 reference_article.author
app/models/tiny_mce_article.rb
@@ -19,4 +19,8 @@ class TinyMceArticle < TextArticle @@ -19,4 +19,8 @@ class TinyMceArticle < TextArticle
19 true 19 true
20 end 20 end
21 21
  22 + def tiny_mce?
  23 + true
  24 + end
  25 +
22 end 26 end
app/views/cms/_tiny_mce_article.rhtml
@@ -18,10 +18,10 @@ @@ -18,10 +18,10 @@
18 <em><%= _('Used when a short version of your text is needed.') %></em> 18 <em><%= _('Used when a short version of your text is needed.') %></em>
19 19
20 <div id="article-lead"> 20 <div id="article-lead">
21 - <%= labelled_form_field(_('Lead'), text_area(:article, 'abstract', :style => 'width: 100%; height: 200px;')) %> 21 + <%= labelled_form_field(_('Lead'), text_area(:article, 'abstract', :style => 'width: 100%; height: 200px;', :class => 'mceEditor')) %>
22 </div> 22 </div>
23 <div style="margin-top: 10px;"> 23 <div style="margin-top: 10px;">
24 - <%= labelled_form_field(_('Text'), text_area(:article, 'body', :style => 'width:100%; height: 500px;')) %> 24 + <%= labelled_form_field(_('Text'), text_area(:article, 'body', :style => 'width:100%; height: 500px;', :class => 'mceEditor')) %>
25 </div> 25 </div>
26 26
27 </div> 27 </div>
app/views/shared/tiny_mce.rhtml
@@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
17 } 17 }
18 tinyMCE.init({ 18 tinyMCE.init({
19 mode : "textareas", 19 mode : "textareas",
  20 + editor_selector : "mceEditor",
20 theme : "advanced", 21 theme : "advanced",
21 relative_urls : false, 22 relative_urls : false,
22 remove_script_host : true, 23 remove_script_host : true,
app/views/tasks/_approve_article_accept_details.rhtml
  1 +<%= render :file => 'shared/tiny_mce' %>
  2 +
1 <%= labelled_form_field(_('Name for publishing'), f.text_field(:name)) %> 3 <%= labelled_form_field(_('Name for publishing'), f.text_field(:name)) %>
2 <%= select_profile_folder(_('Select the folder where the article must be published'), "tasks[#{task.id}][task]", 'article_parent_id', task.target) %> 4 <%= select_profile_folder(_('Select the folder where the article must be published'), "tasks[#{task.id}][task]", 'article_parent_id', task.target) %>
3 <%= labelled_form_field(_('Highlight this article'), f.check_box(:highlighted)) %> 5 <%= labelled_form_field(_('Highlight this article'), f.check_box(:highlighted)) %>
4 6
5 <div> 7 <div>
6 - <%= labelled_form_field(_('Lead'), f.text_area(:abstract, :style => 'width: 482px; height: 200px;')) %> 8 + <% if task.article && task.article.tiny_mce? %>
  9 + <%= labelled_form_field(_('Lead'), f.text_area(:abstract, :style => 'width: 482px; height: 200px;', :class => 'mceEditor')) %>
  10 + <% else %>
  11 + <%= labelled_form_field(_('Lead'), f.text_area(:abstract, :style => 'width: 482px; height: 200px;')) %>
  12 + <% end %>
7 </div> 13 </div>
8 <em><%= _('Used when a short version your text is needed.') %></em> 14 <em><%= _('Used when a short version your text is needed.') %></em>
9 15
10 <div style="margin-top: 10px;"> 16 <div style="margin-top: 10px;">
11 - <%= labelled_form_field(_('Text'), f.text_area(:body, :style => 'width:482px; height: 500px;')) %> 17 + <% if task.article && task.article.tiny_mce? %>
  18 + <%= labelled_form_field(_('Text'), f.text_area(:body, :style => 'width:482px; height: 500px;', :class => 'mceEditor')) %>
  19 + <% else %>
  20 + <%= labelled_form_field(_('Text'), f.text_area(:body, :style => 'width:482px; height: 500px;')) %>
  21 + <% end %>
12 </div> 22 </div>
13 <%= labelled_form_field _('Comment for author'), f.text_field(:closing_statment, :style => 'width: 488px;') %> 23 <%= labelled_form_field _('Comment for author'), f.text_field(:closing_statment, :style => 'width: 488px;') %>
14 24
app/views/tasks/_article.rhtml
app/views/tasks/_suggest_article_accept_details.rhtml
1 -<%= render :file => 'shared/tiny_mce' %>  
2 -  
3 <%= labelled_form_field(_("Sent by: "), f.text_field(:name)) %> 1 <%= labelled_form_field(_("Sent by: "), f.text_field(:name)) %>
4 <p><%= label_tag(_("Email: %s") % task.email) %> </p> 2 <p><%= label_tag(_("Email: %s") % task.email) %> </p>
5 <%= required labelled_form_field(_('Title'), f.text_field(:article_name, :size => 50)) %> 3 <%= required labelled_form_field(_('Title'), f.text_field(:article_name, :size => 50)) %>
app/views/tasks/_textile_article.rhtml
@@ -1,14 +0,0 @@ @@ -1,14 +0,0 @@
1 -<% button_bar do %>  
2 - <%= button :add, _("Lead"), '#', :id => "lead-button", :title => _('Used when a short version of your text is needed.'), :style => "margin-left: 0px;" %>  
3 - <%= button :add, _("Text"), '#', :id => "body-button", :style => "margin-left: 0px;" %>  
4 -<% end %>  
5 -  
6 -<div id="article-lead">  
7 - <%= labelled_form_field(_('Lead'), f.text_area(:abstract, :cols => 64, :rows => 10)) %>  
8 -</div>  
9 -<div id="article-body-field" style="margin-top: 10px;">  
10 - <%= labelled_form_field(_('Text'), f.text_area(:body, :cols => 64, :rows => 30)) %>  
11 -</div>  
12 -  
13 -<%= javascript_include_tag 'article'%>  
14 -  
app/views/tasks/_tiny_mce_article.rhtml
@@ -1,15 +0,0 @@ @@ -1,15 +0,0 @@
1 -<%= render :file => 'shared/tiny_mce' %>  
2 -  
3 -<% button_bar do %>  
4 - <%= button :add, _("Lead"), '#', :id => "lead-button", :title => _('Used when a short version your text is needed.'), :style => "margin-left: 0px;" %>  
5 - <%= button :add, _("Text"), '#', :id => "body-button", :style => "margin-left: 0px;" %>  
6 -<% end %>  
7 -  
8 -<div id="article-lead">  
9 - <%= labelled_form_field(_('Lead'), f.text_area(:abstract, :style => 'width: 100%; height: 200px;')) %>  
10 -</div>  
11 -<div id="article-body-field" style="margin-top: 10px;">  
12 - <%= labelled_form_field(_('Text'), f.text_area(:body, :style => 'width:100%; height: 500px;')) %>  
13 -</div>  
14 -  
15 -<%= javascript_include_tag 'article' %>  
app/views/tasks/_uploaded_file.rhtml
@@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
1 -<% button_bar do %>  
2 - <%= button :add, _("Description"), '#', :id => "lead-button", :title => _('Used when a short version your text is needed.') %>  
3 -<% end %>  
4 -  
5 -<div id="article-lead">  
6 - <%= labelled_form_field(_('Description'), text_area(:article, :abstract, :rows => 3, :cols => 64)) %>  
7 -</div>  
8 -  
9 -<%= javascript_include_tag 'article' %>