Commit 3a54464f7556a9600044b80fd032d20c80f42582
1 parent
aac9d70f
Exists in
master
and in
22 other branches
ActionItem64: finishing with fckeditor.
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@570 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
4 changed files
with
43 additions
and
10 deletions
Show diff stats
app/helpers/application_helper.rb
... | ... | @@ -195,8 +195,23 @@ module ApplicationHelper |
195 | 195 | end |
196 | 196 | end |
197 | 197 | |
198 | - def rich_text_editor(object, method, options = {}) | |
199 | - fckeditor_textarea(object, method, options.merge({:toolbarSet => 'Simple', :height => '300px'})) | |
198 | + def text_editor(object, method, filter_type_method, options = {}) | |
199 | + filter_type = instance_variable_get("@#{object}").send(filter_type_method) | |
200 | + if filter_type == '[No Filter]' || filter_type.blank? | |
201 | + fckeditor_textarea(object, method, options.merge({:toolbarSet => 'Simple', :height => '300px'})) | |
202 | + else | |
203 | + text_area(object, method, { :rows => 12, :columns => 72 }.merge(options)) | |
204 | + end | |
205 | + end | |
206 | + | |
207 | + def select_filter_type(object, method, html_options) | |
208 | + options = [ | |
209 | + [ _('No Filter at all'), '[No Filter]' ], | |
210 | + [ _('RDoc filter'), 'RDoc' ], | |
211 | + [ _('Simple'), 'Simple' ], | |
212 | + [ _('Textile'), 'Textile' ] | |
213 | + ] | |
214 | + select_tag "#{object}[#{method}]", options_for_select(options, @page.filter_type || Comatose.config.default_filter), { :id=> "#{object}_#{method}" }.merge(html_options) | |
200 | 215 | end |
201 | 216 | |
202 | 217 | end | ... | ... |
app/views/cms/_form.rhtml
... | ... | @@ -32,13 +32,13 @@ |
32 | 32 | |
33 | 33 | <div class='comatose_field'> |
34 | 34 | <label for="page_body"><%= _('Content') %></label> |
35 | - <%= f.text_area :body, :rows => 14, :tabindex => 2 %> | |
35 | + <%= text_editor('page', 'body', 'filter_type', :tabindex => 2) %> | |
36 | 36 | </div> |
37 | 37 | |
38 | 38 | <div class='comatose_field' id='filter_row'> |
39 | 39 | <% if show_field? 'filter' %> |
40 | 40 | <label for="page_filter_type"><%= _("Filter") %></label> |
41 | - <%= 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' %> | |
41 | + <%= select_filter_type('page', 'filter_type', :tabindex => 3 ) %> | |
42 | 42 | <span class="field-help"><%= _('Converts plain text into HTML') %></span> |
43 | 43 | <% end %> |
44 | 44 | </div> | ... | ... |
... | ... | @@ -0,0 +1,17 @@ |
1 | +<?xml version="1.0" encoding="utf-8" ?> | |
2 | +<Styles> | |
3 | + <Style name="Paragraph" element="p"> | |
4 | + </Style> | |
5 | + <Style name="Title 1" element="h1"> | |
6 | + </Style> | |
7 | + <Style name="Title 2" element="h2"> | |
8 | + </Style> | |
9 | + <Style name="Title 3" element="h3"> | |
10 | + </Style> | |
11 | + <Style name="Title 4" element="h4"> | |
12 | + </Style> | |
13 | + <Style name="Title 5" element="h5"> | |
14 | + </Style> | |
15 | + <Style name="Title 6" element="h6"> | |
16 | + </Style> | |
17 | +</Styles> | ... | ... |
public/javascripts/fckcustom.js
... | ... | @@ -16,15 +16,16 @@ FCKConfig.SpellChecker = 'SpellerPages'; |
16 | 16 | FCKConfig.SkinPath = FCKConfig.BasePath + 'skins/silver/'; |
17 | 17 | |
18 | 18 | FCKConfig.ToolbarSets["Simple"] = [ |
19 | - ['Source','-','-','Templates'], | |
20 | - ['Cut','Copy','Paste','PasteWord','-','Print','SpellCheck'], | |
21 | - ['Undo','Redo','-','Find','Replace','-','SelectAll'], | |
19 | + ['Source','-','Templates'], | |
20 | + ['Cut','Copy','Paste','PasteWord','-','Print'], | |
21 | + ['Undo','Redo','-','Find','Replace', 'Style'], | |
22 | 22 | '/', |
23 | - ['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'], | |
24 | - ['OrderedList','UnorderedList','-','Outdent','Indent'], | |
23 | + ['Bold','Italic','Underline','StrikeThrough'], | |
24 | + ['OrderedList','UnorderedList'], | |
25 | 25 | ['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'], |
26 | 26 | ['Link','Unlink'], |
27 | - '/', | |
28 | 27 | ['Image','Table','Rule','Smiley'], |
29 | 28 | ['-','About'] |
30 | 29 | ] ; |
30 | + | |
31 | +FCKConfig.StylesXmlPath = FCKConfig.EditorPath + '../fck-custom-styles.xml' ; | ... | ... |