Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

html_area use, optionally, FCKEditor.

Prompted by a conversation with Github user denniscastro,
I've implemented html_area to use FCKEditor.
  • Loading branch information...
commit 046e1fa3ca490ed542ffc098896db583fe9c1706 1 parent 03de3cb
@baldowl authored
View
15 README.rdoc
@@ -118,6 +118,10 @@ For the optional export mechanism you also need:
* the <b>pdf-writer</b> gem for the PDF export module.
+To use the +html_area+ helper with FCKEditor you need an extra
+plugin[http://rubyforge.org/projects/fckeditorp/]; see its documentation for
+further instructions.
+
== How do I use it?
@@ -144,6 +148,9 @@ lines to the bottom of your environment.rb or in an initializer file:
# The optional export mechanism.
admin.save_as = %w(pdf csv)
+
+ # Turn on the use of FCKEditor.
+ admin.use_fckeditor_plugin = true
end
Having done that, you can now (re-)start <tt>script/server</tt>, and navigate
@@ -377,10 +384,12 @@ object for a list view, for fairly obvious reasons.
f.hyperlink :picture, :url => f.object.picture.url,
:link_text => 'The picture'
+* +html_area+ use FCKEditor if the support has been explicitly turned on,
+ otherwise it delegates to +text_area+.
+
* None of the following actually work, but they're defined, waiting for me to
- come back and write them. +html_area+ will eventually use FCKeditor by
- default, and presumably the file/image fields will delegate to file_column:
- +html_area+, +image_field+, +static_file+.
+ come back and write them. Presumably the image fields will delegate to
+ file_column: +image_field+, +static_file+.
== How does it work? - Part II, Themes
View
4 lib/auto_admin_configuration.rb
@@ -119,6 +119,10 @@ def self.save_as=(formats); @@save_as_formats = formats; end
# Returns the list of active export formats.
def self.save_as; @@save_as_formats ||= []; end
+ # Turn on/off the use of FCKEditor.
+ def self.use_fckeditor_plugin=(flag); @@use_fckeditor = flag; end
+ def self.use_fckeditor_plugin; @@use_fckeditor ||= false; end
+
# Turns a simple string into the model class.
def self.model name
Object.const_get( name.to_s.camelcase )
View
2  lib/auto_admin_django_theme.rb
@@ -60,7 +60,7 @@ def wrap_field(field_type, field_name, options)
options[:class] << ' vTextField'
options[:size] ||= 50
end
- when :text_area
+ when :text_area, :html_area
options[:class] << ' vLargeTextField'
when :check_box
options[:class] << ' vCheckboxField'
View
5 lib/auto_admin_simple_theme.rb
@@ -297,6 +297,11 @@ def text_area(field, options = {})
end
def html_area(field, options = {})
common_option_translations! options
+ if AutoAdmin::AutoAdminConfiguration.use_fckeditor_plugin
+ object_helper :fckeditor_textarea, field, options
+ else
+ object_helper :text_area, field, options
+ end
end
def select(field, options = {}, html_options = {})
common_option_translations! options
View
3  themes/django/views/layouts/layout.html.erb
@@ -5,6 +5,9 @@
<title><%=h @title ? "#{@title} | " : '' %><%=h site.name %></title>
<%= tag("link", { "rel" => "Stylesheet", "type" => "text/css", "media" => "screen", "href" => url_for( :action => 'asset', :path => %w(stylesheets auto_admin.css)) } ) %>
<%= javascript_include_tag :defaults %>
+ <% if AutoAdmin::AutoAdminConfiguration.use_fckeditor_plugin %>
+ <%= javascript_include_tag :fckeditor %>
+ <% end %>
<%= tag("meta", { "http-equiv" => "refresh", "content" => @auto_admin_refresh_time } ) if @auto_admin_refresh_time %>
</head>
Please sign in to comment.
Something went wrong with that request. Please try again.