cleditor-rails 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Cleditor::Rails
2
2
 
3
- TODO: Write a gem description
3
+
4
+ Integrates CLEditor into Rails 3.1+ asset pipeline
5
+
6
+ Url: http://premiumsoftware.net/cleditor/
4
7
 
5
8
  ## Installation
6
9
 
@@ -18,7 +21,19 @@ Or install it yourself as:
18
21
 
19
22
  ## Usage
20
23
 
21
- TODO: Write usage instructions here
24
+ 1.) Run
25
+
26
+ $ rails g cleditor:install
27
+
28
+ 2.) Add this to your application.js
29
+
30
+ $(document).ready(function() {
31
+ $(".editable").cleditor();
32
+ });
33
+
34
+ Assuming that your textareas have .editable class.
35
+
36
+ More configuration options here: http://premiumsoftware.net/cleditor/docs/GettingStarted.html#usage
22
37
 
23
38
  ## Contributing
24
39
 
@@ -1,5 +1,5 @@
1
1
  module Cleditor
2
2
  module Rails
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -0,0 +1,46 @@
1
+ require 'rails/generators'
2
+
3
+ module Cleditor
4
+ module Generators
5
+ class InstallGenerator < ::Rails::Generators::Base
6
+
7
+ source_root File.expand_path("../templates", __FILE__)
8
+
9
+ desc "This generator installs CLEditor to Asset Pipeline"
10
+ def add_assets
11
+ insert_javascript("app/assets/javascripts/application.js")
12
+ insert_javascript("app/assets/javascripts/application.js.coffee")
13
+
14
+ insert_style("app/assets/stylesheets/application.css")
15
+ insert_style("app/assets/stylesheets/application.css.scss")
16
+ end
17
+
18
+ private
19
+
20
+ def insert_style(file_name)
21
+ if File.exist?(file_name)
22
+ style_require_block = " *= require cleditor/cleditor\n"
23
+ insert_into_file file_name, style_require_block, :after => "require_self\n"
24
+ else
25
+ if file_name == "app/assets/stylesheets/application.css"
26
+ unless File.exist?("app/assets/stylesheets/application.css.scss")
27
+ copy_file "application.css", "app/assets/stylesheets/application.css"
28
+ end
29
+ end
30
+ end
31
+ end
32
+
33
+ def insert_javascript(file_name)
34
+ if File.exist?(file_name)
35
+ insert_into_file file_name, "//= require cleditor/cleditor\n//= require cleditor/jquery.cleditor.advancedtable\n", :after => "jquery_ujs\n"
36
+ else
37
+ if file_name == "app/assets/javascripts/application.js"
38
+ unless File.exist?("app/assets/stylesheets/application.js.coffee")
39
+ copy_file "application.js", "app/assets/javascripts/application.js"
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,8 @@
1
+ /*
2
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
3
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
5
+ *= require_self
6
+ *= require cleditor/cleditor
7
+ *= require_tree .
8
+ */
@@ -0,0 +1,11 @@
1
+ // This is a manifest file that'll be compiled into including all the files listed below.
2
+ // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
+ // be included in the compiled file accessible from http://example.com/assets/application.js
4
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
+ // the compiled file.
6
+ //
7
+ //= require jquery
8
+ //= require jquery_ujs
9
+ //= require cleditor/cleditor
10
+ //= require cleditor/jquery.cleditor.advancedtable
11
+ //= require_tree .
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cleditor-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-30 00:00:00.000000000 Z
12
+ date: 2012-06-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -36,6 +36,9 @@ extra_rdoc_files: []
36
36
  files:
37
37
  - lib/cleditor-rails/version.rb
38
38
  - lib/cleditor-rails.rb
39
+ - lib/generators/cleditor/install/install_generator.rb
40
+ - lib/generators/cleditor/install/templates/application.css
41
+ - lib/generators/cleditor/install/templates/application.js
39
42
  - vendor/assets/images/cleditor/buttons.gif
40
43
  - vendor/assets/images/cleditor/table.gif
41
44
  - vendor/assets/images/cleditor/toolbar.gif