Sha256: e689b71de76f13723aaf921818894833f1c5a1ac75493a2dd89236c704cb2bdb

Contents?: true

Size: 1.25 KB

Versions: 21

Compression:

Stored size: 1.25 KB

Contents

module Alchemy
	module Admin
		module PagesHelper

			def tinymce_javascript_tags
				init = Alchemy::Tinymce.init
				if init.is_a?(Hash)
					init = HashWithIndifferentAccess.new(init)
					init = init.keys.sort.collect(&:to_s).sort.collect do |key|
						[key, init[key]]
					end
				end
				init = init.collect { |key, value| "#{key} : #{value.to_json}" }.join(', ')
				
				setup = "init.setup = #{Alchemy::Tinymce.setup};" if Alchemy::Tinymce.setup
				return "
		<script type='text/javascript'>
			jQuery(function(){
				if (typeof(Alchemy) !== 'object') { Alchemy = {}; };
				Alchemy.Tinymce = {
					init : function(callback) {
						var init = { #{init} };
						init.mode = 'specific_textareas';
						init.editor_selector = 'tinymce';
						init.plugins = '#{Alchemy::Tinymce.plugins.join(',')}';
						init.language = '#{::I18n.locale}';
						init.init_instance_callback = function(inst) {
							jQuery('#' + inst.editorId).prev('.essence_richtext_loader').hide();
						}
						if (callback)
							init.oninit = callback;
						#{setup}
						tinymce.init(init);
					},
					addEditor : function(dom_id) {
						tinymce.execCommand('mceAddControl', true, dom_id);
					}
				};
				Alchemy.Tinymce.init();
			});
		</script>".html_safe
			end

		end
	end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
alchemy_cms-2.1.12 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-2.1.11 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-2.1.9.1 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-2.1.9 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-2.1.8.1 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-2.1.8 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-2.1.7 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-2.1.6 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-2.1.5 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-2.1.4 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-2.1.3 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-2.1.2 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-2.1.1 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-2.1 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-2.1.rc6 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-2.1.rc5 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-2.1.rc4 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-2.1.rc3 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-2.1.rc2 app/helpers/alchemy/admin/pages_helper.rb
alchemy_cms-2.1.beta6 app/helpers/alchemy/admin/pages_helper.rb