Put tinymce in its own js file.

To use on a text area just add the class "tinymce_textarea".
This commit is contained in:
Christophe Vilayphiou 2012-03-21 12:41:32 +08:00
parent 5d7202af8b
commit 3aa7c5120d
4 changed files with 31 additions and 22 deletions

View File

@ -10,4 +10,5 @@
//= require jquery.isotope.min //= require jquery.isotope.min
//= require jquery.tinyscrollbar.min //= require jquery.tinyscrollbar.min
//= require orbit-1.0 //= require orbit-1.0
//= require tinymce-jquery //= require tinymce-jquery
//= require tinymce_orbit

View File

@ -0,0 +1,26 @@
$(function() {
$('.tinymce_textarea').tinymce({
theme: 'advanced',
plugins : "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
// Theme options
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : false,
// Skin options
skin : "o2k7",
skin_variant : "silver",
// Drop lists for link/image/media/template dialogs
template_external_list_url : "js/template_list.js",
external_link_list_url : "js/link_list.js",
external_image_list_url : "js/image_list.js",
media_external_list_url : "js/media_list.js"
});
});

View File

@ -146,7 +146,7 @@
<% @site_valid_locales.each do |locale| %> <% @site_valid_locales.each do |locale| %>
<td> <td>
<%= I18nVariable.from_locale(locale) %> <%= I18nVariable.from_locale(locale) %>
<%= f.text_area locale, :style=>"width:100%" %> <%= f.text_area locale, :style=>"width:100%", :class => 'tinymce_textarea' %>
</td> </td>
<% end %> <% end %>
<% end %> <% end %>
@ -158,7 +158,7 @@
<% @site_valid_locales.each do |locale| %> <% @site_valid_locales.each do |locale| %>
<td> <td>
<%= I18nVariable.from_locale(locale) %> <%= I18nVariable.from_locale(locale) %>
<%= f.text_area locale, :style=>"width:100%" %> <%= f.text_area locale, :style=>"width:100%", :class => 'tinymce_textarea' %>
</td> </td>
<% end %> <% end %>
<% end %> <% end %>
@ -286,11 +286,4 @@
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'bulletin_file', f, :bulletin_files) %>").replace(old_id, new_id)); $(this).parents('table').append(("<%= escape_javascript(add_attribute 'bulletin_file', f, :bulletin_files) %>").replace(old_id, new_id));
}); });
</script> </script>
<script type="text/javascript">
$(function() {
$('textarea').tinymce({
theme: 'advanced'
});
});
</script>
<% end %> <% end %>

View File

@ -15,7 +15,7 @@
<% @site_valid_locales.each do |locale| %> <% @site_valid_locales.each do |locale| %>
<td> <td>
<%= I18nVariable.from_locale(locale) %> <%= I18nVariable.from_locale(locale) %>
<%= f.text_area locale, :style=>"width:100%" %> <%= f.text_area locale, :style=>"width:100%", :class => 'tinymce_textarea' %>
</td> </td>
<% end %> <% end %>
<% end %> <% end %>
@ -27,14 +27,3 @@
</div> </div>
</div> </div>
<% content_for :page_specific_javascript do %>
<script type="text/javascript">
$(function() {
$('textarea').tinymce({
theme: 'advanced'
});
});
</script>
<% end %>