Permalink
Browse files

Replace FCKeditor with Rails 3-friendly ckeditor

  • Loading branch information...
scottwillson committed Apr 3, 2012
1 parent e110264 commit 6cc6eb0b9553bd71c577354d800d665a72426f96
View
@@ -17,7 +17,7 @@ gem "will_paginate", "~> 3.0.beta"
gem "airbrake"
gem "ruby-ole", :git => "git://github.com/scottwillson/ruby-ole.git"
gem "spreadsheet", :git => "git://github.com/scottwillson/spreadsheet.git"
-gem "fckeditor", :git => "git://github.com/scottwillson/fckeditor.git"
+gem "ckeditor", "3.7.0.rc3"
gem "default_value_for", :git => "https://github.com/FooBarWidget/default_value_for.git"
gem "acts_as_list", :git => "git://github.com/swanandp/acts_as_list.git"
gem "acts_as_tree", :git => "git://github.com/parasew/acts_as_tree.git"
@@ -27,6 +27,7 @@ gem "ri_cal"
gem "truncate_html"
gem "jquery-rails"
gem "yui-compressor"
+gem "paperclip"
group :assets do
gem 'sass-rails', "~> 3.2.0"
View
@@ -18,12 +18,6 @@ GIT
pdf-reader (>= 0.9.0)
ttfunk (~> 1.0.3)
-GIT
- remote: git://github.com/scottwillson/fckeditor.git
- revision: 905f4db427732e030da948726c49ef87b51e8f09
- specs:
- fckeditor (0.6.2)
-
GIT
remote: git://github.com/scottwillson/ruby-ole.git
revision: 6b9d2530b12259ca21af75ed2dcb26ba745a6115
@@ -120,6 +114,10 @@ GEM
xpath (~> 0.1.4)
childprocess (0.3.1)
ffi (~> 1.0.6)
+ ckeditor (3.7.0.rc3)
+ mime-types (~> 1.17.2)
+ orm_adapter (~> 0.0.6)
+ cocaine (0.2.1)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
@@ -156,7 +154,7 @@ GEM
mime-types (~> 1.16)
treetop (~> 1.4.8)
metaclass (0.0.1)
- mime-types (1.18)
+ mime-types (1.17.2)
mocha (0.10.5)
metaclass (~> 0.0.1)
multi_json (1.2.0)
@@ -171,6 +169,13 @@ GEM
newrelic_rpm (3.3.3)
nokogiri (1.5.2)
open4 (1.3.0)
+ orm_adapter (0.0.7)
+ paperclip (3.0.1)
+ activemodel (>= 3.0.0)
+ activerecord (>= 3.0.0)
+ activesupport (>= 3.0.0)
+ cocaine (>= 0.0.2)
+ mime-types
pdf-reader (1.1.0)
Ascii85 (~> 1.0.0)
ruby-rc4
@@ -255,6 +260,7 @@ DEPENDENCIES
capistrano
capistrano-unicorn
capybara
+ ckeditor (= 3.7.0.rc3)
coffee-rails (~> 3.2.0)
database_cleaner
default_value_for!
@@ -263,13 +269,13 @@ DEPENDENCIES
factory_girl
factory_girl_rails
fastercsv
- fckeditor!
in_place_editing
jquery-rails
launchy
mocha
mysql2
newrelic_rpm
+ paperclip
pdf-reader
prawn!
rails (~> 3.2)
@@ -0,0 +1,4 @@
+class Ckeditor::Asset < ActiveRecord::Base
+ include Ckeditor::Orm::ActiveRecord::AssetBase
+ include Ckeditor::Backend::Paperclip
+end
@@ -0,0 +1,12 @@
+class Ckeditor::AttachmentFile < Ckeditor::Asset
+ has_attached_file :data,
+ :url => "/ckeditor_assets/attachments/:id/:filename",
+ :path => ":rails_root/public/ckeditor_assets/attachments/:id/:filename"
+
+ validates_attachment_size :data, :less_than => 100.megabytes
+ validates_attachment_presence :data
+
+ def url_thumb
+ @url_thumb ||= Ckeditor::Utils.filethumb(filename)
+ end
+end
@@ -0,0 +1,13 @@
+class Ckeditor::Picture < Ckeditor::Asset
+ has_attached_file :data,
+ :url => "/ckeditor_assets/pictures/:id/:style_:basename.:extension",
+ :path => ":rails_root/public/ckeditor_assets/pictures/:id/:style_:basename.:extension",
+ :styles => { :content => '800>', :thumb => '118x100#' }
+
+ validates_attachment_size :data, :less_than => 2.megabytes
+ validates_attachment_presence :data
+
+ def url_content
+ url(:content)
+ end
+end
@@ -6,9 +6,10 @@
<%= tree_select(ArticleCategory.all( :conditions => "parent_id = 0"), 'article', 'article_category_id', @article, false) %>
<hr/>
- <%#= fckeditor_textarea(:article, :body, :toolbarSet => 'Simple', :width => '90%', :height => '400px') %>
+ <%= f.cktext_area(:body, :toolbarSet => 'Simple', :width => '90%', :height => '400px') %>
+ <%#= cktext_area_tag("content", "Ckeditor", :input_html => {:cols => 10, :rows => 20}, :toolbar => 'Easy') %>
<%= f.label :article %>
- <%= text_area(:article, :body, :cols => 80, :rows => 60, :class => "article-body")%>
+ <%#= text_area(:article, :body, :cols => 80, :rows => 60, :class => "article-body")%>
<%= f.labelled_text_field :position %>
<%= f.labelled_check_box :display %>
@@ -2,7 +2,7 @@
<div class="column_grid_container">
<%= form_for([:admin, @article]) do |f| %>
- <%=render :partial => "form", :locals => { :f => f, :action_button => "Update" } %>
+ <%= render :partial => "form", :locals => { :f => f, :action_button => "Update" } %>
<% end %>
<%= form_tag({:action => 'update', :id => @article}) %>
@@ -0,0 +1,5 @@
+if Object.const_defined?("Ckeditor")
+ Ckeditor.setup do |config|
+ require "ckeditor/orm/active_record"
+ end
+end
View
@@ -1,4 +1,6 @@
RacingOnRails::Application.routes.draw do
+ mount Ckeditor::Engine => '/ckeditor'
+
namespace :admin do
resources :articles
resources :article_categories
Oops, something went wrong.

0 comments on commit 6cc6eb0

Please sign in to comment.