From 3aa7c5120deadba8de4252753a125533555fb551 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Wed, 21 Mar 2012 12:41:32 +0800 Subject: [PATCH] Put tinymce in its own js file. To use on a text area just add the class "tinymce_textarea". --- app/assets/javascripts/new_admin.js | 3 ++- app/assets/javascripts/tinymce_orbit.js | 26 +++++++++++++++++++ .../back_end/bulletins/_form.html.erb | 11 ++------ .../back_end/page_contexts/_form.html.erb | 13 +--------- 4 files changed, 31 insertions(+), 22 deletions(-) create mode 100644 app/assets/javascripts/tinymce_orbit.js diff --git a/app/assets/javascripts/new_admin.js b/app/assets/javascripts/new_admin.js index cd15fc39..3ec6f22f 100644 --- a/app/assets/javascripts/new_admin.js +++ b/app/assets/javascripts/new_admin.js @@ -10,4 +10,5 @@ //= require jquery.isotope.min //= require jquery.tinyscrollbar.min //= require orbit-1.0 -//= require tinymce-jquery \ No newline at end of file +//= require tinymce-jquery +//= require tinymce_orbit \ No newline at end of file diff --git a/app/assets/javascripts/tinymce_orbit.js b/app/assets/javascripts/tinymce_orbit.js new file mode 100644 index 00000000..89fb9390 --- /dev/null +++ b/app/assets/javascripts/tinymce_orbit.js @@ -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" + }); +}); \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb index d3e9f3a1..97f822d0 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb @@ -146,7 +146,7 @@ <% @site_valid_locales.each do |locale| %> <%= I18nVariable.from_locale(locale) %> - <%= f.text_area locale, :style=>"width:100%" %> + <%= f.text_area locale, :style=>"width:100%", :class => 'tinymce_textarea' %> <% end %> <% end %> @@ -158,7 +158,7 @@ <% @site_valid_locales.each do |locale| %> <%= I18nVariable.from_locale(locale) %> - <%= f.text_area locale, :style=>"width:100%" %> + <%= f.text_area locale, :style=>"width:100%", :class => 'tinymce_textarea' %> <% end %> <% end %> @@ -286,11 +286,4 @@ $(this).parents('table').append(("<%= escape_javascript(add_attribute 'bulletin_file', f, :bulletin_files) %>").replace(old_id, new_id)); }); - <% end %> diff --git a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_form.html.erb b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_form.html.erb index 4ca568a9..258aa55c 100644 --- a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_form.html.erb +++ b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_form.html.erb @@ -15,7 +15,7 @@ <% @site_valid_locales.each do |locale| %> <%= I18nVariable.from_locale(locale) %> - <%= f.text_area locale, :style=>"width:100%" %> + <%= f.text_area locale, :style=>"width:100%", :class => 'tinymce_textarea' %> <% end %> <% end %> @@ -27,14 +27,3 @@ - - -<% content_for :page_specific_javascript do %> - -<% end %> \ No newline at end of file