forked from a-ono/redmine_ckeditor
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
60 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 25 additions & 21 deletions
46
lib/generators/redmine_ckeditor/rich_assets/rich_assets_generator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,40 @@ | ||
require 'rake' | ||
require 'rails/generators' | ||
|
||
module RedmineCkeditor | ||
class RichAssetsGenerator < Rails::Generators::Base | ||
source_root File.expand_path('../templates', __FILE__) | ||
desc "Generate rich asset files for Redmine" | ||
def create_assets | ||
rake "redmine_ckeditor:assets:copy" | ||
module Generators | ||
module RedmineCkeditor | ||
module RichAssets | ||
class RichAssetsGenerator < Rails::Generators::Base | ||
source_root File.expand_path('../templates', __FILE__) | ||
desc "Generate rich asset files for Redmine" | ||
def create_assets | ||
rake "redmine_ckeditor:assets:copy" | ||
|
||
gsub_file RedmineCkeditor.root.join("assets/ckeditor-contrib/plugins/richfile/plugin.js"), | ||
"/assets/rich/", "../images/" | ||
gsub_file RedmineCkeditor.root.join("assets/ckeditor-contrib/plugins/richfile/plugin.js"), | ||
"/assets/rich/", "../images/" | ||
|
||
application_js = RedmineCkeditor.root.join("assets/javascripts/application.js") | ||
browser_js = RedmineCkeditor.root.join("assets/javascripts/browser.js") | ||
application_js = RedmineCkeditor.root.join("assets/javascripts/application.js") | ||
browser_js = RedmineCkeditor.root.join("assets/javascripts/browser.js") | ||
|
||
gsub_file browser_js, "opt=opt.split(',');", "opt=opt ? opt.split(',') : [];" | ||
gsub_file browser_js, "opt=opt.split(',');", "opt=opt ? opt.split(',') : [];" | ||
|
||
gsub_file application_js, /var CKEDITOR_BASEPATH.+$/, "" | ||
gsub_file application_js, /var CKEDITOR_BASEPATH.+$/, "" | ||
|
||
gsub_file application_js, /CKEDITOR.plugins.addExternal.+$/, "" | ||
gsub_file application_js, /CKEDITOR.plugins.addExternal.+$/, "" | ||
|
||
gsub_file browser_js, '"/rich/files/"+', "" | ||
gsub_file browser_js, '"/rich/files/"+', "" | ||
|
||
inject_into_file browser_js, | ||
"\t\turl = $(item).data('relative-url-root') + url;\n", | ||
:after => "data('uris')[this._options.currentStyle];\n" | ||
inject_into_file browser_js, | ||
"\t\turl = $(item).data('relative-url-root') + url;\n", | ||
:after => "data('uris')[this._options.currentStyle];\n" | ||
|
||
gsub_file RedmineCkeditor.root.join("assets/stylesheets/application.css"), | ||
'image-url("rich/', 'url("../images/' | ||
gsub_file RedmineCkeditor.root.join("assets/stylesheets/application.css"), | ||
'image-url("rich/', 'url("../images/' | ||
|
||
append_to_file RedmineCkeditor.root.join("assets/stylesheets/editor.css"), | ||
"\nhtml, body {\n height: 100%;\n}\n" | ||
append_to_file RedmineCkeditor.root.join("assets/stylesheets/editor.css"), | ||
"\nhtml, body {\n height: 100%;\n}\n" | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters