Module: TinymceFm::ApplicationHelper
- Defined in:
- app/helpers/tinymce_fm/application_helper.rb
Instance Method Summary collapse
- #append_class_name(options, class_name) ⇒ Object
- #tinymce_javascript_tag(controller = nil, theme = nil) ⇒ Object
- #tinymce_tag(name, content = '', options = {}) ⇒ Object
Instance Method Details
#append_class_name(options, class_name) ⇒ Object
19 20 21 22 23 24 25 |
# File 'app/helpers/tinymce_fm/application_helper.rb', line 19 def append_class_name , class_name key = .has_key?('class') ? 'class' : :class unless [key].to_s =~ /(^|\s+)#{class_name}(\s+|$)/ [key] = "#{[key]} #{class_name}".strip end end |
#tinymce_javascript_tag(controller = nil, theme = nil) ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'app/helpers/tinymce_fm/application_helper.rb', line 3 def tinymce_javascript_tag( controller = nil, theme = nil ) opts = {:manager => "#{controller.to_s if controller.present?}", :theme => theme} # As using javascript_include_tag will malform js path tinymce_js = "<script type='text/javascript' src='#{tinymce_fm_engine.tinymce_combine_js_path(opts)}'></script>" scripts = [ javascript_include_tag('tinymce_fm/application.js'), tinymce_js, stylesheet_link_tag('tinymce_fm/application.css') ].join("\n") raw scripts end |
#tinymce_tag(name, content = '', options = {}) ⇒ Object
14 15 16 17 |
# File 'app/helpers/tinymce_fm/application_helper.rb', line 14 def tinymce_tag name, content = '', = {} append_class_name(, 'tinymce_managed') text_area_tag(name, content, ) end |