Skip to content

Commit

Permalink
Ckeditor now isolated engine
Browse files Browse the repository at this point in the history
  • Loading branch information
galetahub committed Jan 3, 2012
1 parent 3508625 commit cb810fb
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 9 deletions.
4 changes: 4 additions & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ Rails 3.1:

gem "ckeditor"

in routes:

mount Ckeditor::Engine => '/ckeditor'

Rails <= 3.0:

gem "ckeditor", "3.6.3"
Expand Down
5 changes: 5 additions & 0 deletions app/assets/javascripts/ckeditor/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//= require ckeditor/filebrowser/javascripts/jquery.min.js
//= require ckeditor/filebrowser/javascripts/jquery.tmpl.min.js
//= require ckeditor/filebrowser/javascripts/fileuploader.js
//= require ckeditor/filebrowser/javascripts/rails.js
//= require ckeditor/filebrowser/javascripts/application.js
6 changes: 6 additions & 0 deletions app/assets/stylesheets/ckeditor/application.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* This is a manifest file that'll automatically include all the stylesheets available in this directory
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
* the top of the compiled file, but it's generally better to create a new file per style scope.
*= require ckeditor/filebrowser/stylesheets/uploader.css
*/
2 changes: 1 addition & 1 deletion app/views/ckeditor/shared/_asset.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%= content_tag(:div, :id => dom_id(asset), :class => "gal-item", :"data-url" => asset.url_content) do %>
<%= link_to image_tag("#{Ckeditor.relative_path}/ckeditor/filebrowser/images/gal_del.png",
<%= link_to image_tag("/assets/ckeditor/filebrowser/images/gal_del.png",
:title => I18n.t('ckeditor.buttons.delete')),
polymorphic_path(asset, :format => :json),
:remote => true,
Expand Down
2 changes: 1 addition & 1 deletion app/views/ckeditor/shared/_asset_tmpl.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script id="fileupload_tmpl" type="text/x-jquery-tmpl">
<div id="asset_${id}" class="gal-item" data-url="${url_content}">
<%= link_to image_tag("#{Ckeditor.relative_path}/ckeditor/filebrowser/images/gal_del.png",
<%= link_to image_tag("/assets/ckeditor/filebrowser/images/gal_del.png",
:title => I18n.t('ckeditor.buttons.delete')),
"/ckeditor/${controller}/${id}.json",
:remote => true,
Expand Down
8 changes: 3 additions & 5 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
Rails.application.routes.draw do
namespace :ckeditor, :only => [:index, :create, :destroy] do
resources :pictures
resources :attachment_files
end
Ckeditor::Engine.routes.draw do
resources :pictures, :only => [:index, :create, :destroy]
resources :attachment_files, :only => [:index, :create, :destroy]
end
3 changes: 3 additions & 0 deletions lib/ckeditor/engine.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
require 'rails'
require 'ckeditor'

module Ckeditor
class Engine < ::Rails::Engine
isolate_namespace Ckeditor

config.action_view.javascript_expansions[:ckeditor] = "ckeditor/ckeditor"

initializer "ckeditor.helpers" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ body {
.gal-holder .gal-item .gal-upload-holder .add {
display: block;
color: #2e5aff;
/*background: url(/javascripts/ckeditor/filebrowser/images/gal_add.png) no-repeat left center;*/
background: url(/assets/ckeditor/filebrowser/images/gal_add.png) no-repeat left center;
padding-left: 33px;
line-height: 25px;
text-decoration: none;
Expand Down Expand Up @@ -105,7 +105,7 @@ body {
}
.gal-more a {
color: #2e5aff;
/*background: url(/javascripts/ckeditor/filebrowser/images/gal_more.gif) no-repeat left center;*/
background: url(/assets/ckeditor/filebrowser/images/gal_more.gif) no-repeat left center;
padding-left: 15px;
font-size: 14px;
text-decoration: none;
Expand Down

1 comment on commit cb810fb

@ippa
Copy link
Contributor

@ippa ippa commented on cb810fb Jan 3, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice :)

Please sign in to comment.