From df95c2ddaa6e9989eca984fa3cbcf58d0377ac05 Mon Sep 17 00:00:00 2001 From: Roman Smirnov Date: Wed, 11 Jan 2012 13:16:38 +0400 Subject: [PATCH] Switched to use tinymce-jquery gem --- app/assets/javascripts/admin/spree_editor.js | 9 +++++++ app/assets/stylesheets/admin/spree_editor.css | 10 +++++++ .../shared/editor_engines/_tiny_mce.html.erb | 14 +--------- .../editor_engines/_wym_editor.html.erb | 2 +- .../spree_editor/install_generator.rb | 15 +++++++++++ lib/tasks/install.rake | 26 ------------------- lib/tasks/spree_editor.rake | 1 - spree_editor.gemspec | 3 ++- 8 files changed, 38 insertions(+), 42 deletions(-) create mode 100644 app/assets/javascripts/admin/spree_editor.js create mode 100644 app/assets/stylesheets/admin/spree_editor.css create mode 100644 lib/generators/spree_editor/install_generator.rb delete mode 100644 lib/tasks/install.rake delete mode 100644 lib/tasks/spree_editor.rake diff --git a/app/assets/javascripts/admin/spree_editor.js b/app/assets/javascripts/admin/spree_editor.js new file mode 100644 index 0000000..011d7ea --- /dev/null +++ b/app/assets/javascripts/admin/spree_editor.js @@ -0,0 +1,9 @@ +// This is a manifest file that'll be compiled into including all the files listed below. +// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically +// be included in the compiled file accessible from http://example.com/assets/application.js +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// the compiled file. +// +//= require_tree . +//= require admin/spree_core +//= require tinymce-jquery diff --git a/app/assets/stylesheets/admin/spree_editor.css b/app/assets/stylesheets/admin/spree_editor.css new file mode 100644 index 0000000..63ca74b --- /dev/null +++ b/app/assets/stylesheets/admin/spree_editor.css @@ -0,0 +1,10 @@ +/* + * 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_self +*/ + +form.edit_product div.left { width: 67%; } +form.edit_product div.right { width: 30%; } diff --git a/app/views/shared/editor_engines/_tiny_mce.html.erb b/app/views/shared/editor_engines/_tiny_mce.html.erb index 7707dd1..ed31e78 100644 --- a/app/views/shared/editor_engines/_tiny_mce.html.erb +++ b/app/views/shared/editor_engines/_tiny_mce.html.erb @@ -1,6 +1,3 @@ -<%= javascript_include_tag 'admin/tinymce/tiny_mce.js' %> -<%= javascript_include_tag 'admin/tinymce/jquery.tinymce.js' %> - \ No newline at end of file + diff --git a/lib/generators/spree_editor/install_generator.rb b/lib/generators/spree_editor/install_generator.rb new file mode 100644 index 0000000..ff7c565 --- /dev/null +++ b/lib/generators/spree_editor/install_generator.rb @@ -0,0 +1,15 @@ +module SpreeEditor + module Generators + class InstallGenerator < Rails::Generators::Base + + def add_javascripts + append_file "app/assets/javascripts/admin/all.js", "//= require admin/spree_editor\n" + end + + def add_stylesheets + inject_into_file "app/assets/stylesheets/admin/all.css", " *= require admin/spree_editor\n", :before => /\*\//, :verbose => true + end + + end + end +end diff --git a/lib/tasks/install.rake b/lib/tasks/install.rake deleted file mode 100644 index e5abe57..0000000 --- a/lib/tasks/install.rake +++ /dev/null @@ -1,26 +0,0 @@ -namespace :spree_editor do - desc "Copies all migrations and assets (NOTE: This will be obsolete with Rails 3.1)" - task :install do - # No migrations - # Rake::Task['spree_editor:install:migrations'].invoke - Rake::Task['spree_editor:install:assets'].invoke - end - - namespace :install do - desc "Copies all migrations (NOTE: This will be obsolete with Rails 3.1)" - task :migrations do - source = File.join(File.dirname(__FILE__), '..', '..', 'db') - destination = File.join(Rails.root, 'db') - Spree::FileUtilz.mirror_files(source, destination) - end - - desc "Copies all assets (NOTE: This will be obsolete with Rails 3.1)" - task :assets do - source = File.join(File.dirname(__FILE__), '..', '..', 'public') - destination = File.join(Rails.root, 'public') - puts "INFO: Mirroring assets from #{source} to #{destination}" - Spree::FileUtilz.mirror_files(source, destination) - end - end - -end \ No newline at end of file diff --git a/lib/tasks/spree_editor.rake b/lib/tasks/spree_editor.rake deleted file mode 100644 index 2c5c4e2..0000000 --- a/lib/tasks/spree_editor.rake +++ /dev/null @@ -1 +0,0 @@ -# add custom rake tasks here \ No newline at end of file diff --git a/spree_editor.gemspec b/spree_editor.gemspec index 75ccc18..1fdf754 100644 --- a/spree_editor.gemspec +++ b/spree_editor.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'spree_editor' - s.version = '0.50.1' + s.version = '0.70.0' s.summary = 'Adds support of several WYSIWYG editors to Spree' s.description = 'Atm supported: YUIRichEditor, WYMEditor, TinyMCE' s.required_ruby_version = '>= 1.8.7' @@ -17,4 +17,5 @@ Gem::Specification.new do |s| s.requirements << 'none' s.add_dependency('spree_core', '>= 0.70.0') + s.add_dependency('tinymce-rails', '>= 3.4.7') end