Permalink
Browse files

Reorganize plugin and update ckeditor version to 3.3.2

  • Loading branch information...
1 parent 0411cab commit 29bba561993482d6bb1f32e19b2257745cb57702 @galetahub committed Aug 13, 2010
Showing 1,078 changed files with 92,654 additions and 106,440 deletions.
View
@@ -1,15 +0,0 @@
-0.9.0 - Replaced FCKeditor with CKEditor
-
-0.8.1 - Remove plugin files on uninstall
-
-0.8.0 - Added uninstall rake task
-
-0.8.0 - Refactoring for fckeditor controller
-
-0.8.0 - Added Easy upload plugin http://martinezdelizarrondo.com/easyupload/
-
-0.8.0 - Change for works with FCKeditor 2.6.3
-
-0.2.2 - Added fckeditor_form_remote_tag helper to allow multiple editors in a single form
-
-0.2.1 - Added spell check from Ken Pratt
View
16 LICENSE
@@ -1,16 +0,0 @@
-Easy CKEditor is a Rails Plugin WYSIWYG text editor and a fork of Gast�n Ramos's fork of Scott Rutherford great plugin
-
- Copyright (C) 2009 John Bradley
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
View
@@ -0,0 +1,132 @@
+=Rails CKEditor integration plugin with SWFUpload support
+
+CKEditor is a text editor to be used inside web pages. It's a WYSIWYG editor, which means that the text being edited on it looks as similar as possible to
+the results users have when publishing it. It brings to the web common editing features found on desktop editing applications like Microsoft Word and OpenOffice.
+
+Because CKEditor is licensed under flexible Open Source and commercial licenses, you'll be able to integrate and use it inside any kind of application.
+This is the ideal editor for developers, created to provide easy and powerful solutions to their users.
+
+CKEditor version: 3.3.2 (http://ckeditor.com)
+
+SWFUpload version: 2.2.0.1 Core (http://swfupload.org)
+
+Rails version: 2.3.8
+
+Demo appication (Rails 2.3.8):
+http://github.com/galetahub/rails-ckeditor-demo-app
+
+==Install
+
+Via gem:
+ config.gem 'ckeditor', '3.3.2'
+
+Via plugin
+ ./script/plugin install git://github.com/galetahub/rails-ckeditor.git
+
+Next step is generate ckeditor js files and configuration file
+Check "config/initializers/ckeditor.rb" for more configuration options:
+
+ ./script/generate ckeditor_install
+
+Generate ckeditor models for file upload support:
+For paperclip:
+
+ ./script/generate ckeditor_migration
+
+For attachment_fu:
+ ./script/generate ckeditor_migration --backend=attachment_fu
+
+Don't forget about migration:
+
+ rake db:migarte
+
+In your environment:
+
+ config.load_paths += %W( #{RAILS_ROOT}/app/models/ckeditor )
+
+==Usage
+
+Basically include this in the page you wish to use the editor in:
+ <%= javascript_include_tag :ckeditor %>
+
+Then instead of the normal textarea helper from Rails use this one:
+ <%= ckeditor_textarea("object", "field", :width => '100%', :height => '200px') %>
+
+FormBuilder helper for more usefully:
+
+ <%= form_for @page do |form| -%>
+ ...
+ <%= form.cktext_area :notes, :toolbar=>'Full', :width=>'400px', :height=>'200px' %>
+ ...
+ <%= form.cktext_area :content, :swf_params=>{:assetable_type=>'User', :assetable_id=>current_user.id} %>
+ ...
+ <% end -%>
+
+===Support options
+ :cols # Textarea cols (default: 70)
+ :rows # Textarea rows (default: 20)
+ :width # Editor width (default: 100%)
+ :height # Editor height (default: 100%)
+ :class # Textarea css class name
+ :toolbar # Toolbar name
+ :skin # Editor skin
+ :language # Editor language (default: I18n.locale)
+ :swf_params # SWFUpload additional params (Hash)
+ :id # textarea DOM element id
+ :index # element id index
+
+For configure ckeditor default options check:
+ public/javascripts/ckeditor/config.js
+
+This stylesheet use editor for displaying edit area:
+ public/javascripts/ckeditor/contents.css
+
+===AJAX
+
+To use a remote form you need to call "ckeditor_ajax_script" helper method:
+
+ <%= form_for @page, :remote => true do |form| -%>
+ <%= form.cktext_area("note", "content") %>
+ ...
+ <%= form.cktext_area("note", "about") %>
+ ...
+ <%= ckeditor_ajax_script %>
+ <% end %>
+
+Helper "ckeditor_ajax_script" generate next script (jquery):
+
+ <script type='text/javascript' charset='UTF-8'>
+ $(document).ready(function(){
+ $('form[data-remote]').bind("ajax:before", function(){
+ for (instance in CKEDITOR.instances){
+ CKEDITOR.instances[instance].updateElement();
+ }
+ });
+ });
+ </script>
+
+==File uploads
+
+We recommend using a paperclip plugin for file storage and processing images. Controller @../rails-ckeditor/app/controllers/ckeditor_controller.rb@ has actions
+for displaying and uploading files. It uses classes Picture and AttachmentFile, who are descendants of the Asset class. So, your project must have these classes.
+
+ http://github.com/thoughtbot/paperclip
+
+For S3 storage look at "../ckeditor/examples/s3"
+
+==Formtastic integration
+Ckeditor detects if your use Formtastic and appends "Ckeditor::CustomFormBuilder".
+
+ <%= form.input :content, :as => :ckeditor %>
+
+==Middleware
+
+Ckeditor appends middleware ("Ckeditor::Middleware") before session store to
+support swf upload with AuthenticityToken.
+
+ rake middleware
+
+==TODOs
+
+1. Add support for choose filemanager storage
+2. More integration upload system
View
@@ -1,224 +0,0 @@
-h1. Rails CKEditor integration plugin with SWFUpload support
-
-CKEditor is a text editor to be used inside web pages. It's a WYSIWYG editor, which means that the text being edited on it looks as similar as possible to
-the results users have when publishing it. It brings to the web common editing features found on desktop editing applications like Microsoft Word and OpenOffice.
-
-Because CKEditor is licensed under flexible Open Source and commercial licenses, you'll be able to integrate and use it inside any kind of application.
-This is the ideal editor for developers, created to provide easy and powerful solutions to their users.
-
-CKEditor version: 3.2
-SWFUpload version: 2.2.0
-Rails version: 2.3.x
-
-"ckeditor.com":http://ckeditor.com/
-"swfupload.org":http://swfupload.org/
-
-Demo appication:
-"rails-ckeditor-demo-app":http://github.com/galetahub/rails-ckeditor-demo-app
-
-h2. Install
-
-@./script/plugin install git://github.com/galetahub/rails-ckeditor.git@
-
-@rake ckeditor:install@
-
-@rake ckeditor:config@
-
-Last rake generated file config/ckeditor.yml:
-<pre><code>
-development:
- swf_file_post_name: "data"
- swf_image_file_types_description: "Images"
- swf_image_file_types: "*.jpg;*.jpeg;*.png;*.gif"
- swf_image_file_size_limit: "5 MB"
- swf_image_file_upload_limit: 10
- swf_types_description: "Files"
- swf_file_types: "*.doc;*.wpd;*.pdf;*.swf;*.xls"
- swf_file_size_limit: "10 MB"
- swf_file_file_upload_limit: 5
- public_uri: "/uploads"
- public_path: "public/uploads"
- file_manager_uri: "/ckeditor/files"
- file_manager_upload_uri: "/ckeditor/create?kind=file"
- file_manager_image_upload_uri: "/ckeditor/create?kind=image"
- file_manager_image_uri: "/ckeditor/images"
-</code></pre>
-
-For attachment_fu: @swf_file_post_name: "uploaded_data"@
-
-h2. Usage
-
-Basically include this in the page you wish to use the editor in
-<pre><code>
- <%= javascript_include_tag :ckeditor %>
-</code></pre>
-
-Then instead of the normal textarea helper from Rails use this one
-<pre><code>
- <%= ckeditor_textarea("object", "field", :width => '100%', :height => '200px') %>
-</code></pre>
-
-FormBuilder helper for more usefully
-
-<pre><code>
- <% form_for :page, :url => pages_path do |form| -%>
- ...
- <%= form.cktext_area :notes, :toolbar=>'Full', :width=>'400px', :heigth=>'200px' %>
- ...
- <%= form.cktext_area :content, :swf_params=>{:assetable_type=>'User', :assetable_id=>current_user.id} %>
- ...
- <% end -%>
-</code></pre>
-
-h3. Support options
-<pre><code>
- :cols # Textarea cols
- :rows # Textarea rows
- :width # Editor width
- :height # Editor height
- :class # Textarea css class name
- :toolbar # Toolbar name
- :skin # Editor skin
- :language # Editor language
- :swf_params # SWFUpload additional params
-</code></pre>
-
-Check @public/javascripts/ckeditor/config.js@ for config default options.
-Modify @public/javascripts/ckeditor/contents.css@ - this stylesheet use editor
-
-h3. AJAX
-
-To use a remote form you need to do something like this
-<pre><code>
- <%= form_remote_tag :url => @options.merge(:controller => @scaffold_controller),
- :before => Ckeditor_before_js('note', 'text') %>
-
- <%= ckeditor_textarea( "note", "text", :ajax => true ) %>
-
- <%= end_form_tag %>
-</code></pre>
-
-If you forget to put in the :before it won't work, you can also use the Ckeditor_form_remote_tag described below
-
-h3. Multiple Editors in a form
-
-To create a form using multiple editors use the Ckeditor_form_remote_tag helper and pass the :editors option. This takes an hash of model symbol keys with each having
-an array as its value. The array should contain the list of fields that will have editors attached to them.
-<pre><code>
- <%= ckeditor_form_remote_tag :url => @options.merge(:controller => @scaffold_controller),
- :editors => { :multinote => ['text1', 'text2'] } %>
-
- <%= ckeditor_textarea( "multinote", "text1", :ajax => true ) %>
- <%= ckeditor_textarea( "multinote", "text2", :ajax => true ) %>
-
- <%= end_form_tag %>
-</code></pre>
-
-h3. File uploads
-
-We recommend using a paperclip plugin for file storage and processing images. Controller @../rails-ckeditor/app/controllers/ckeditor_controller.rb@ has actions
-for displaying and uploading files. It uses classes Picture and AttachmentFile, who are descendants of the Asset class. So, your project must have these classes.
-
-"http://github.com/thoughtbot/paperclip":http://github.com/thoughtbot/paperclip
-
-For S3 storage look at @../rails-ckeditor/examples/s3@
-
-For paperclip:
-ActiveRecord model Asset (asset.rb):
-<pre><code>
-class Asset < ActiveRecord::Base
- belongs_to :user
- belongs_to :assetable, :polymorphic => true
-
- def url(*args)
- data.url(*args)
- end
- alias :public_filename :url
-
- def filename
- data_file_name
- end
-
- def content_type
- data_content_type
- end
-
- def size
- data_file_size
- end
-
- def path
- data.path
- end
-
- def styles
- data.styles
- end
-
- def format_created_at
- I18n.l(self.created_at, :format=>"%d.%m.%Y %H:%M")
- end
-
- def to_xml(options = {})
- xml = options[:builder] ||= Builder::XmlMarkup.new(:indent => options[:indent])
-
- xml.tag!(self.type.to_s.downcase) do
- xml.filename{ xml.cdata!(self.filename) }
- xml.size self.size
- xml.path{ xml.cdata!(self.url) }
-
- xml.styles do
- self.styles.each do |style|
- xml.tag!(style.first, self.url(style.first))
- end
- end unless self.styles.empty?
- end
- end
-end
-</pre></code>
-
-ActiveRecord model AttachmentFile (attachment_file.rb):
-<pre><code>
-class AttachmentFile < Asset
- has_attached_file :data,
- :url => "/assets/attachments/:id/:filename",
- :path => ":rails_root/public/assets/attachments/:id/:filename"
-
- validates_attachment_size :data, :less_than => 10.megabytes
-end
-</pre></code>
-
-ActiveRecord model Picture (picture.rb):
-<pre><code>
-class Picture < Asset
- has_attached_file :data,
- :url => "/assets/pictures/:id/:style_:basename.:extension",
- :path => ":rails_root/public/assets/pictures/:id/:style_:basename.:extension",
- :styles => { :content => '575>', :thumb => '100x100' }
-
- validates_attachment_size :data, :less_than => 2.megabytes
-
- def url_content
- url(:content)
- end
-
- def url_thumb
- url(:thumb)
- end
-
- def to_json(options = {})
- options[:methods] ||= []
- options[:methods] << :url_content
- options[:methods] << :url_thumb
- super options
- end
-end
-</code></pre>
-
-More info in @../rails-ckeditor/examples/models@.
-Do not forget about migration @../rails-ckeditor/examples/migrations@.
-
-h2. TODOs
-
-1. Add support for choose filemanager storage
-2. More integration upload system
Oops, something went wrong.

0 comments on commit 29bba56

Please sign in to comment.