diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index a316749..2014723 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -195,8 +195,23 @@ module ApplicationHelper
end
end
- def rich_text_editor(object, method, options = {})
- fckeditor_textarea(object, method, options.merge({:toolbarSet => 'Simple', :height => '300px'}))
+ def text_editor(object, method, filter_type_method, options = {})
+ filter_type = instance_variable_get("@#{object}").send(filter_type_method)
+ if filter_type == '[No Filter]' || filter_type.blank?
+ fckeditor_textarea(object, method, options.merge({:toolbarSet => 'Simple', :height => '300px'}))
+ else
+ text_area(object, method, { :rows => 12, :columns => 72 }.merge(options))
+ end
+ end
+
+ def select_filter_type(object, method, html_options)
+ options = [
+ [ _('No Filter at all'), '[No Filter]' ],
+ [ _('RDoc filter'), 'RDoc' ],
+ [ _('Simple'), 'Simple' ],
+ [ _('Textile'), 'Textile' ]
+ ]
+ select_tag "#{object}[#{method}]", options_for_select(options, @page.filter_type || Comatose.config.default_filter), { :id=> "#{object}_#{method}" }.merge(html_options)
end
end
diff --git a/app/views/cms/_form.rhtml b/app/views/cms/_form.rhtml
index 54fbe91..e287008 100644
--- a/app/views/cms/_form.rhtml
+++ b/app/views/cms/_form.rhtml
@@ -32,13 +32,13 @@
- <%= f.text_area :body, :rows => 14, :tabindex => 2 %>
+ <%= text_editor('page', 'body', 'filter_type', :tabindex => 2) %>
<% if show_field? 'filter' %>
- <%= select_tag 'page[filter_type]', options_for_select(TextFilters.all_titles.sort, @page.filter_type || Comatose.config.default_filter), :tabindex=>3, :id=>'page_filter_type' %>
+ <%= select_filter_type('page', 'filter_type', :tabindex => 3 ) %>
<%= _('Converts plain text into HTML') %>
<% end %>
diff --git a/public/javascripts/fck-custom-styles.xml b/public/javascripts/fck-custom-styles.xml
new file mode 100644
index 0000000..f9d9663
--- /dev/null
+++ b/public/javascripts/fck-custom-styles.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/public/javascripts/fckcustom.js b/public/javascripts/fckcustom.js
index 2c6e0ee..03ec1a8 100644
--- a/public/javascripts/fckcustom.js
+++ b/public/javascripts/fckcustom.js
@@ -16,15 +16,16 @@ FCKConfig.SpellChecker = 'SpellerPages';
FCKConfig.SkinPath = FCKConfig.BasePath + 'skins/silver/';
FCKConfig.ToolbarSets["Simple"] = [
- ['Source','-','-','Templates'],
- ['Cut','Copy','Paste','PasteWord','-','Print','SpellCheck'],
- ['Undo','Redo','-','Find','Replace','-','SelectAll'],
+ ['Source','-','Templates'],
+ ['Cut','Copy','Paste','PasteWord','-','Print'],
+ ['Undo','Redo','-','Find','Replace', 'Style'],
'/',
- ['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
- ['OrderedList','UnorderedList','-','Outdent','Indent'],
+ ['Bold','Italic','Underline','StrikeThrough'],
+ ['OrderedList','UnorderedList'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
['Link','Unlink'],
- '/',
['Image','Table','Rule','Smiley'],
['-','About']
] ;
+
+FCKConfig.StylesXmlPath = FCKConfig.EditorPath + '../fck-custom-styles.xml' ;
--
libgit2 0.21.2