Module: ApplicationHelper
- Defined in:
- app/helpers/application_helper.rb
Instance Method Summary collapse
-
#fckeditor(object_name, method_name, fckeditor_custom_config_url, fck_options = { }, options = { }) ⇒ Object
Renders a text-field for the given object and method plus a FCK integration for this field.
Instance Method Details
#fckeditor(object_name, method_name, fckeditor_custom_config_url, fck_options = { }, options = { }) ⇒ Object
Renders a text-field for the given object and method plus a FCK integration for this field. The parameter ”fckeditor_custom_config_url” should contain the url of a (static) fckcustom_config.js or the url to a ”fckeditor_custom_config” action, given by ”acts_as_fckeditor_file_provider” to use file handling over the controller. Valid ”fck_options” are:
width, hight: the dimensions for the fck control
toolbarset: name of a set used. You can specify custom
sets in the custom_config.js.erb file under 'app/views' in this plugin.
base_path: a custom BasePath the fck editor should use
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/helpers/application_helper.rb', line 14 def fckeditor( object_name, method_name, fckeditor_custom_config_url, = { }, = { }) # Try to get the value to be shown obj = instance_variable_get("@#{object_name}") value = (obj && obj.send(method_name.to_sym)) || "" id = (obj && "#{object_name}_#{obj.id}_#{method_name}_editor") || "#{object_name}_0_#{method_name}_editor" [:toolbarset] ||= [:toolbarSet] #Accept both styles render :partial => 'iq_fckeditor/fckeditor', :locals => { :v => "oFck#{id}", :object_name => object_name, :method_name => method_name, :custom_config_url => fckeditor_custom_config_url, :width => ([:width] && "'#{fck_options[:width] }'") || 'null', :height => ([:height] && "'#{fck_options[:height] }'") || 'null', :toolbarset => ([:toolbarset] && "'#{fck_options[:toolbarset] }'") || "'Default'", :value => value, :id => id, :base_path => ([:base_path] && "'#{fck_options[:base_path] }'") || 'null' } end |