tiny_mce_helper 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,5 +1,13 @@
1
1
  *SVN*
2
2
 
3
+ *0.0.3* (May 5th, 2008)
4
+
5
+ * Updated documentation
6
+
7
+ * Change references from RAILS_ROOT to Rails.root
8
+
9
+ * Use zipped version of TinyMCE instead of tar
10
+
3
11
  *0.0.2* (September 26th, 2007)
4
12
 
5
13
  * Remove gem dependency on actionpack
data/README CHANGED
@@ -5,25 +5,21 @@ script.
5
5
 
6
6
  == Resources
7
7
 
8
- API
9
-
10
- * http://api.pluginaweek.org/tiny_mce_helper
11
-
12
8
  Wiki
13
9
 
14
10
  * http://wiki.pluginaweek.org/Tiny_mce_helper
15
11
 
16
- Announcement
12
+ API
17
13
 
18
- * http://www.pluginaweek.org
14
+ * http://api.pluginaweek.org/tiny_mce_helper
19
15
 
20
- Source
16
+ Development
21
17
 
22
- * http://svn.pluginaweek.org/trunk/plugins/action_pack/tiny_mce_helper
18
+ * http://dev.pluginaweek.org/browser/trunk/tiny_mce_helper
23
19
 
24
- Development
20
+ Source
25
21
 
26
- * http://dev.pluginaweek.org/browser/trunk/plugins/action_pack/tiny_mce_helper
22
+ * http://svn.pluginaweek.org/trunk/tiny_mce_helper
27
23
 
28
24
  == Description
29
25
 
@@ -158,10 +154,13 @@ will generate the following javascript:
158
154
  'content_css' : '/stylesheets/tiny_mce_content.css'
159
155
  });
160
156
 
161
- To see additional initialization helpers, see the API for PluginAWeek::Helpers::TinyMCEHelper
157
+ To see additional initialization helpers, see the API for PluginAWeek::TinyMCEHelper
162
158
 
163
159
  == Testing
164
160
 
161
+ Before you can run any tests, the following gem must be installed:
162
+ * plugin_test_helper[http://wiki.pluginaweek.org/Plugin_test_helper]
163
+
165
164
  Since the rake tasks for installing TinyMCE and updating the configuration
166
165
  options are part of the unit tests, already-downloaded files are included with
167
166
  the plugin. If you want to perform a "live" test which actually downloads the
@@ -177,4 +176,4 @@ Rails applications. TinyMCE is a WYSIWYG HTML editing component released under
177
176
  the GNU Public License (GPL) by Moxiecode Systems (http://tinymce.moxiecode.com/).
178
177
 
179
178
  This plugin was originally created by by Blake Watters <blake@near-time.com> and
180
- later modified by Aaron Pfeifer & Neil Abraham.
179
+ later modified by Aaron Pfeifer.
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require 'rake/gempackagetask'
4
4
  require 'rake/contrib/sshpublisher'
5
5
 
6
6
  PKG_NAME = 'tiny_mce_helper'
7
- PKG_VERSION = '0.0.2'
7
+ PKG_VERSION = '0.0.3'
8
8
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
9
9
  RUBY_FORGE_PROJECT = 'pluginaweek'
10
10
 
@@ -39,8 +39,8 @@ spec = Gem::Specification.new do |s|
39
39
  s.has_rdoc = true
40
40
  s.test_files = Dir['test/**/*_test.rb']
41
41
 
42
- s.author = 'Aaron Pfeifer, Neil Abraham'
43
- s.email = 'info@pluginaweek.org'
42
+ s.author = 'Aaron Pfeifer'
43
+ s.email = 'aaron@pluginaweek.org'
44
44
  s.homepage = 'http://www.pluginaweek.org'
45
45
  end
46
46
 
@@ -52,12 +52,12 @@ end
52
52
 
53
53
  desc 'Publish the beta gem'
54
54
  task :pgem => [:package] do
55
- Rake::SshFilePublisher.new('pluginaweek@pluginaweek.org', '/home/pluginaweek/gems.pluginaweek.org/gems', 'pkg', "#{PKG_FILE_NAME}.gem").upload
55
+ Rake::SshFilePublisher.new('aaron@pluginaweek.org', '/home/aaron/gems.pluginaweek.org/public/gems', 'pkg', "#{PKG_FILE_NAME}.gem").upload
56
56
  end
57
57
 
58
58
  desc 'Publish the API documentation'
59
59
  task :pdoc => [:rdoc] do
60
- Rake::SshDirPublisher.new('pluginaweek@pluginaweek.org', "/home/pluginaweek/api.pluginaweek.org/#{PKG_NAME}", 'rdoc').upload
60
+ Rake::SshDirPublisher.new('aaron@pluginaweek.org', "/home/aaron/api.pluginaweek.org/public/#{PKG_NAME}", 'rdoc').upload
61
61
  end
62
62
 
63
63
  desc 'Publish the API docs and gem'
data/install.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # Install TinyMCE
2
2
  puts 'Installing TinyMCE...'
3
- PluginAWeek::Helpers::TinyMCEHelper.install(:version => ENV['VERSION'], :target => ENV['TARGET'])
3
+ PluginAWeek::TinyMCEHelper.install(:version => ENV['VERSION'], :target => ENV['TARGET'])
4
4
 
5
5
  # Update the configuration options
6
6
  puts 'Updating TinyMCE configuration options...'
7
- PluginAWeek::Helpers::TinyMCEHelper.update_options
7
+ PluginAWeek::TinyMCEHelper.update_options
@@ -1,244 +1,241 @@
1
1
  module PluginAWeek #:nodoc:
2
- module Helpers #:nodoc:
3
- # Adds helper methods for generating the TinyMCE initialization script
4
- # within your Rails views
5
- module TinyMCEHelper
6
- # The path to the file which contains all valid options that can be used
7
- # to configure TinyMCE
8
- OPTIONS_FILE_PATH = "#{RAILS_ROOT}/config/tiny_mce_options.yml"
9
-
10
- # A regular expression matching options that are dynamic (i.e. they can
11
- # vary on an integer or string basis)
12
- DYNAMIC_OPTIONS = /theme_advanced_buttons|theme_advanced_container/
13
-
14
- # Whether or not to use verbose output
15
- mattr_accessor :verbose
16
- @@verbose = true
17
-
18
- # A list of all valid options that can be used to configure TinyMCE
19
- mattr_accessor :valid_options
20
- @@valid_options = File.exists?(OPTIONS_FILE_PATH) ? File.open(OPTIONS_FILE_PATH) {|f| YAML.load(f.read)} : []
21
-
22
- class << self
23
- # Installs TinyMCE by downloading it and adding it to your application's
24
- # javascripts folder.
25
- #
26
- # == Versions
27
- #
28
- # By default, this will install the latest version of TinyMCE. You can
29
- # install a specific version of TinyMCE (if you are using an old API) by
30
- # passing in the version number.
31
- #
32
- # For example,
33
- # PluginAWeek::Helpers::TinyMCEHelper.install #=> Installs the latest version
34
- # PluginAWeek::Helpers::TinyMCEHelper.install('2.0.8') #=> Installs version 2.0.8
35
- #
36
- # An exception will be raised if the specified version cannot be found.
37
- #
38
- # == Target path
39
- #
40
- # By default, this will install TinyMCE into RAILS_ROOT/public/javascripts/tiny_mce.
41
- # If you want to install it to a different directory, you can pass in
42
- # a parameter with the relative path from RAILS_ROOT.
43
- #
44
- # For example,
45
- # PluginAWeek::Helpers::TinyMCEHelper.install(nil, 'public/javascripts/richtext')
46
- def install(options = {})
47
- options.assert_valid_keys(:version, :target, :force)
48
- options.reverse_merge!(:force => false)
49
-
50
- version = options[:version]
51
- base_target = options[:target] || 'public/javascripts/tiny_mce'
52
- source_path = 'tinymce'
53
- target_path = File.expand_path(File.join(RAILS_ROOT, base_target))
54
-
55
- # If TinyMCE is already installed, make sure the user wants to continue
56
- if !options[:force] && File.exists?(target_path)
57
- print "TinyMCE already be installed in #{target_path}. Overwrite? (y/n): "
58
- while !%w(y n).include?(option = STDIN.gets.chop)
59
- print "Invalid option. Overwrite #{target_path}? (y/n): "
60
- end
61
- return if option == 'n'
62
- end
63
-
64
- require 'hpricot'
65
- require 'open-uri'
66
-
67
- # Get the url of the TinyMCE version
68
- doc = Hpricot(open('http://sourceforge.net/project/showfiles.php?group_id=103281&package_id=111430'))
69
- if version
70
- version.gsub!('.', '_')
71
- file_element = (doc/'tr[@id*="rel0_"] a').detect {|file| file.innerHTML =~ /#{version}.tgz$/}
72
- raise ArgumentError, "Could not find TinyMCE version #{version}" if !file_element
73
- else
74
- file_element = (doc/'tr[@id^="pkg0_1rel0_"] a').detect {|file| file.innerHTML.to_s =~ /\d\.tgz$/}
75
- raise ArgumentError, 'Could not find latest TinyMCE version' if !file_element
76
- end
77
-
78
- filename = file_element.innerHTML
79
- file_url = file_element['href']
80
-
81
- # Download and install it
82
- Dir.chdir('/tmp/') do
83
- begin
84
- puts 'Downloading TinyMCE source...' if verbose
85
- system("wget '#{file_url}' &> wget.log")
86
- puts 'Extracting...' if verbose
87
- system("tar xf #{filename} &> tar.log")
88
- File.delete(filename)
89
- FileUtils.mkdir_p(target_path)
90
- FileUtils.cp_r("#{source_path}/jscripts/tiny_mce/.", target_path)
91
- FileUtils.rmtree(source_path)
92
- puts 'Done!' if verbose
93
- rescue Object => e
94
- puts "Error: #{e.inspect}"
95
- puts 'Also see the last modified log file (wget.log or tar.log) in /tmp/.'
96
- end
97
- end
98
- end
99
-
100
- # Uninstalls the TinyMCE installation and optional configuration file
101
- def uninstall
102
- # Remove the TinyMCE configuration file
103
- File.delete(OPTIONS_FILE_PATH)
104
-
105
- # Remove the TinyMCE installation
106
- FileUtils.rm_rf("#{RAILS_ROOT}/public/javascripts/tiny_mce")
107
- end
108
-
109
- # Updates the list of possible configuration options that can be used
110
- # when initializing the TinyMCE script. These are always installed to
111
- # the application folder, config/tiny_mce_options.yml. If this file
112
- # does not exist, then the TinyMCE helper will not be able to verify
113
- # that all of the initialization options are valid.
114
- def update_options
115
- require 'hpricot'
116
- require 'open-uri'
117
- require 'yaml'
118
-
119
- puts 'Downloading configuration options from TinyMCE Wiki...' if verbose
120
- doc = Hpricot(open('http://wiki.moxiecode.com/index.php/TinyMCE:Configuration'))
121
- options = (doc/'a[@title*="Configuration/"]/').collect {|option| option.to_s}.sort
122
- options.reject! {|option| option =~ DYNAMIC_OPTIONS}
123
-
124
- File.open("#{RAILS_ROOT}/config/tiny_mce_options.yml", 'w') do |out|
125
- YAML.dump(options, out)
126
- end
127
- puts 'Done!' if verbose
128
- end
129
- end
130
-
131
- # Are we using TinyMCE?
132
- def using_tiny_mce?
133
- @uses_tiny_mce
134
- end
135
-
136
- # Create the TinyMCE initialization scripts. The default configuration
137
- # is for a simple theme that replaces all textareas on the page. For
138
- # example, the default initialization script will generate the following:
2
+ # Adds helper methods for generating the TinyMCE initialization script
3
+ # within your Rails views
4
+ module TinyMCEHelper
5
+ # The path to the file which contains all valid options that can be used
6
+ # to configure TinyMCE
7
+ OPTIONS_FILE_PATH = "#{Rails.root}/config/tiny_mce_options.yml"
8
+
9
+ # A regular expression matching options that are dynamic (i.e. they can
10
+ # vary on an integer or string basis)
11
+ DYNAMIC_OPTIONS = /theme_advanced_buttons|theme_advanced_container/
12
+
13
+ # Whether or not to use verbose output
14
+ mattr_accessor :verbose
15
+ @@verbose = true
16
+
17
+ # A list of all valid options that can be used to configure TinyMCE
18
+ mattr_accessor :valid_options
19
+ @@valid_options = File.exists?(OPTIONS_FILE_PATH) ? File.open(OPTIONS_FILE_PATH) {|f| YAML.load(f.read)} : []
20
+
21
+ class << self
22
+ # Installs TinyMCE by downloading it and adding it to your application's
23
+ # javascripts folder.
139
24
  #
140
- # tinyMCE.init({
141
- # 'mode' : 'textareas',
142
- # 'theme' : 'simple'
143
- # });
25
+ # == Versions
144
26
  #
145
- # == Customizing initialization options
27
+ # By default, this will install the latest version of TinyMCE. You can
28
+ # install a specific version of TinyMCE (if you are using an old API) by
29
+ # passing in the version number.
146
30
  #
147
- # To customize the options to be included in the initialization script,
148
- # you can pass in a hash to +tiny_mce_init_script+. For example,
31
+ # For example,
32
+ # PluginAWeek::TinyMCEHelper.install #=> Installs the latest version
33
+ # PluginAWeek::TinyMCEHelper.install('2.0.8') #=> Installs version 2.0.8
149
34
  #
150
- # tiny_mce_init_script(
151
- # :theme => 'advanced',
152
- # :editor_selector => 'rich_text',
153
- # :content_css => '/stylesheets/tiny_mce_content.css',
154
- # :editor_css => '/stylesheets/tiny_mce_editor.css',
155
- # :auto_reset_designmode => true
156
- # )
35
+ # An exception will be raised if the specified version cannot be found.
157
36
  #
158
- # will generate:
37
+ # == Target path
159
38
  #
160
- # tinyMCE.init({
161
- # 'mode' : 'textareas',
162
- # 'theme' : 'advanced',
163
- # 'editor_selected' : 'rich_text',
164
- # 'content_css' : '/stylesheets/tiny_mce_content.css'
165
- # });
39
+ # By default, this will install TinyMCE into Rails.root/public/javascripts/tiny_mce.
40
+ # If you want to install it to a different directory, you can pass in
41
+ # a parameter with the relative path from Rails.root.
166
42
  #
167
- # == Validating options
168
- #
169
- # If additional options are passed in to initialize TinyMCE, they will be
170
- # validated against the list of valid options in PluginAWeek::Helpers::TinyMCEHelper#valid_options.
171
- # These options are configured in the file config/tiny_mce_options.yml.
172
- # You can generate this file by invoke the rake task tiny_mce:update_options.
173
- def tiny_mce_init_script(options = @tiny_mce_options)
174
- options ||= {}
175
- options.stringify_keys!.reverse_merge!(
176
- 'mode' => 'textareas',
177
- 'theme' => 'simple'
178
- )
179
-
180
- # Check validity
181
- plugins = options['plugins']
182
- options_to_validate = options.reject {|option, value| plugins && plugins.include?(option.split('_')[0]) || option =~ DYNAMIC_OPTIONS}
183
- options_to_validate.assert_valid_keys(@@valid_options) if @@valid_options && @@valid_options.any?
43
+ # For example,
44
+ # PluginAWeek::TinyMCEHelper.install(nil, 'public/javascripts/richtext')
45
+ def install(options = {})
46
+ options.assert_valid_keys(:version, :target, :force)
47
+ options.reverse_merge!(:force => false)
184
48
 
185
- init_script = 'tinyMCE.init({'
49
+ version = options[:version]
50
+ base_target = options[:target] || 'public/javascripts/tiny_mce'
51
+ source_path = 'tinymce'
52
+ target_path = File.expand_path(File.join(Rails.root, base_target))
186
53
 
187
- options.sort.each do |key, value|
188
- init_script += "\n#{key} : "
189
-
190
- case value
191
- when String, Symbol, Fixnum
192
- init_script << "'#{value}'"
193
- when Array
194
- init_script << "'#{value.join(',')}'"
195
- when TrueClass
196
- init_script << 'true'
197
- when FalseClass
198
- init_script << 'false'
199
- else
200
- raise ArgumentError, "Cannot parse value of type #{value.class} passed for TinyMCE option #{key}"
54
+ # If TinyMCE is already installed, make sure the user wants to continue
55
+ if !options[:force] && File.exists?(target_path)
56
+ print "TinyMCE already installed in #{target_path}. Overwrite? (y/n): "
57
+ while !%w(y n).include?(option = STDIN.gets.chop)
58
+ print "Invalid option. Overwrite #{target_path}? (y/n): "
201
59
  end
202
-
203
- init_script << ','
60
+ return if option == 'n'
61
+ end
62
+
63
+ require 'hpricot'
64
+ require 'open-uri'
65
+
66
+ # Get the url of the TinyMCE version
67
+ doc = Hpricot(open('http://sourceforge.net/project/showfiles.php?group_id=103281&package_id=111430'))
68
+ if version
69
+ version.gsub!('.', '_')
70
+ file_element = (doc/'tr[@id*="rel0_"] a').detect {|file| file.innerHTML =~ /#{version}.zip$/}
71
+ raise ArgumentError, "Could not find TinyMCE version #{version}" if !file_element
72
+ else
73
+ file_element = (doc/'tr[@id^="pkg0_1rel0_"] a').detect {|file| file.innerHTML.to_s =~ /\d\.zip$/}
74
+ raise ArgumentError, 'Could not find latest TinyMCE version' if !file_element
204
75
  end
205
76
 
206
- init_script.chop << "\n});"
77
+ filename = file_element.innerHTML
78
+ file_url = file_element['href']
79
+
80
+ # Download and install it
81
+ Dir.chdir('/tmp/') do
82
+ begin
83
+ puts 'Downloading TinyMCE source...' if verbose
84
+ system('wget', file_url)
85
+ puts 'Extracting...' if verbose
86
+ system('unzip', filename)
87
+ File.delete(filename)
88
+ FileUtils.mkdir_p(target_path)
89
+ FileUtils.cp_r("#{source_path}/jscripts/tiny_mce/.", target_path)
90
+ FileUtils.rmtree(source_path)
91
+ puts 'Done!' if verbose
92
+ rescue Object => ex
93
+ puts "Error: #{ex.inspect}"
94
+ end
95
+ end
207
96
  end
208
97
 
209
- # Generate the TinyMCE
210
- def tiny_mce(*args)
211
- javascript_tag tiny_mce_init_script(*args)
98
+ # Uninstalls the TinyMCE installation and optional configuration file
99
+ def uninstall
100
+ # Remove the TinyMCE configuration file
101
+ File.delete(OPTIONS_FILE_PATH)
102
+
103
+ # Remove the TinyMCE installation
104
+ FileUtils.rm_rf("#{Rails.root}/public/javascripts/tiny_mce")
212
105
  end
213
106
 
214
- # The name of the TinyMCE javascript file to use. In development, this
215
- # will use the source (uncompressed) file in order to help with debugging
216
- # issues that occur within TinyMCE. In production, the compressed version
217
- # of TinyMCE will be used in order to increased download speed.
218
- def tiny_mce_file_name
219
- RAILS_ENV == 'development' ? 'tiny_mce/tiny_mce_src' : 'tiny_mce/tiny_mce'
107
+ # Updates the list of possible configuration options that can be used
108
+ # when initializing the TinyMCE script. These are always installed to
109
+ # the application folder, config/tiny_mce_options.yml. If this file
110
+ # does not exist, then the TinyMCE helper will not be able to verify
111
+ # that all of the initialization options are valid.
112
+ def update_options
113
+ require 'hpricot'
114
+ require 'open-uri'
115
+ require 'yaml'
116
+
117
+ puts 'Downloading configuration options from TinyMCE Wiki...' if verbose
118
+ doc = Hpricot(open('http://wiki.moxiecode.com/index.php/TinyMCE:Configuration'))
119
+ options = (doc/'a[@title*="Configuration/"]/').collect {|option| option.to_s}.sort
120
+ options.reject! {|option| option =~ DYNAMIC_OPTIONS}
121
+
122
+ File.open("#{Rails.root}/config/tiny_mce_options.yml", 'w') do |out|
123
+ YAML.dump(options, out)
124
+ end
125
+ puts 'Done!' if verbose
220
126
  end
127
+ end
128
+
129
+ # Are we using TinyMCE?
130
+ def using_tiny_mce?
131
+ @uses_tiny_mce
132
+ end
133
+
134
+ # Create the TinyMCE initialization scripts. The default configuration
135
+ # is for a simple theme that replaces all textareas on the page. For
136
+ # example, the default initialization script will generate the following:
137
+ #
138
+ # tinyMCE.init({
139
+ # 'mode' : 'textareas',
140
+ # 'theme' : 'simple'
141
+ # });
142
+ #
143
+ # == Customizing initialization options
144
+ #
145
+ # To customize the options to be included in the initialization script,
146
+ # you can pass in a hash to +tiny_mce_init_script+. For example,
147
+ #
148
+ # tiny_mce_init_script(
149
+ # :theme => 'advanced',
150
+ # :editor_selector => 'rich_text',
151
+ # :content_css => '/stylesheets/tiny_mce_content.css',
152
+ # :editor_css => '/stylesheets/tiny_mce_editor.css',
153
+ # :auto_reset_designmode => true
154
+ # )
155
+ #
156
+ # will generate:
157
+ #
158
+ # tinyMCE.init({
159
+ # 'mode' : 'textareas',
160
+ # 'theme' : 'advanced',
161
+ # 'editor_selected' : 'rich_text',
162
+ # 'content_css' : '/stylesheets/tiny_mce_content.css'
163
+ # });
164
+ #
165
+ # == Validating options
166
+ #
167
+ # If additional options are passed in to initialize TinyMCE, they will be
168
+ # validated against the list of valid options in PluginAWeek::TinyMCEHelper#valid_options.
169
+ # These options are configured in the file config/tiny_mce_options.yml.
170
+ # You can generate this file by invoke the rake task tiny_mce:update_options.
171
+ def tiny_mce_init_script(options = @tiny_mce_options)
172
+ options ||= {}
173
+ options.stringify_keys!.reverse_merge!(
174
+ 'mode' => 'textareas',
175
+ 'theme' => 'simple'
176
+ )
221
177
 
222
- # Generates the javascript include for TinyMCE. For example,
223
- #
224
- # javascript_include_tiny_mce
225
- #
226
- # will generate:
227
- #
228
- # <script type="text/javascript" src="/javascripts/tiny_mce/tiny_mce.js"></script>
229
- def javascript_include_tiny_mce
230
- javascript_include_tag tiny_mce_file_name
231
- end
178
+ # Check validity
179
+ plugins = options['plugins']
180
+ options_to_validate = options.reject {|option, value| plugins && plugins.include?(option.split('_')[0]) || option =~ DYNAMIC_OPTIONS}
181
+ options_to_validate.assert_valid_keys(@@valid_options) if @@valid_options && @@valid_options.any?
182
+
183
+ init_script = 'tinyMCE.init({'
232
184
 
233
- # Conditionally includes the TinyMCE javascript file if the variable
234
- # @uses_tiny_mce has been set to true.
235
- def javascript_include_tiny_mce_if_used
236
- javascript_include_tiny_mce if using_tiny_mce?
185
+ options.sort.each do |key, value|
186
+ init_script += "\n#{key} : "
187
+
188
+ case value
189
+ when String, Symbol, Fixnum
190
+ init_script << "'#{value}'"
191
+ when Array
192
+ init_script << "'#{value.join(',')}'"
193
+ when TrueClass
194
+ init_script << 'true'
195
+ when FalseClass
196
+ init_script << 'false'
197
+ else
198
+ raise ArgumentError, "Cannot parse value of type #{value.class} passed for TinyMCE option #{key}"
199
+ end
200
+
201
+ init_script << ','
237
202
  end
203
+
204
+ init_script.chop << "\n});"
205
+ end
206
+
207
+ # Generate the TinyMCE
208
+ def tiny_mce(*args)
209
+ javascript_tag tiny_mce_init_script(*args)
210
+ end
211
+
212
+ # The name of the TinyMCE javascript file to use. In development, this
213
+ # will use the source (uncompressed) file in order to help with debugging
214
+ # issues that occur within TinyMCE. In production, the compressed version
215
+ # of TinyMCE will be used in order to increased download speed.
216
+ def tiny_mce_file_name
217
+ Rails.env == 'development' ? 'tiny_mce/tiny_mce_src' : 'tiny_mce/tiny_mce'
218
+ end
219
+
220
+ # Generates the javascript include for TinyMCE. For example,
221
+ #
222
+ # javascript_include_tiny_mce
223
+ #
224
+ # will generate:
225
+ #
226
+ # <script type="text/javascript" src="/javascripts/tiny_mce/tiny_mce.js"></script>
227
+ def javascript_include_tiny_mce
228
+ javascript_include_tag tiny_mce_file_name
229
+ end
230
+
231
+ # Conditionally includes the TinyMCE javascript file if the variable
232
+ # @uses_tiny_mce has been set to true.
233
+ def javascript_include_tiny_mce_if_used
234
+ javascript_include_tiny_mce if using_tiny_mce?
238
235
  end
239
236
  end
240
237
  end
241
238
 
242
239
  ActionController::Base.class_eval do
243
- helper PluginAWeek::Helpers::TinyMCEHelper
240
+ helper PluginAWeek::TinyMCEHelper
244
241
  end