refinerycms-wymeditor 0.0.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +1 -0
  3. data/Gemfile.lock +8 -0
  4. data/app/assets/javascripts/refinery/boot_wym.js.erb +19 -41
  5. data/app/assets/javascripts/refinery/wymeditor.js +9 -7
  6. data/app/assets/javascripts/wymeditor/GPL-license.txt +278 -0
  7. data/app/assets/javascripts/wymeditor/MIT-license.txt +20 -0
  8. data/app/assets/javascripts/wymeditor/README.txt +35 -0
  9. data/app/assets/javascripts/wymeditor/browsers/mozilla.js.erb +10 -11
  10. data/app/assets/javascripts/wymeditor/browsers/webkit.js.erb +17 -18
  11. data/app/assets/javascripts/wymeditor/classes.js.erb +3 -5
  12. data/app/assets/javascripts/wymeditor/functions.js.erb +8 -4
  13. data/app/assets/javascripts/wymeditor/init_interface.js +45 -0
  14. data/app/assets/javascripts/wymeditor/lang/de.js +13 -1
  15. data/app/assets/javascripts/wymeditor/lang/fr.js +1 -0
  16. data/app/assets/javascripts/wymeditor/lang/nl.js +55 -45
  17. data/app/assets/javascripts/wymeditor/lang/pl.js +12 -1
  18. data/app/assets/javascripts/wymeditor/lang/ru.js +1 -0
  19. data/app/assets/javascripts/wymeditor/lang/{zh_cn.js → zh-CN.js} +1 -1
  20. data/app/assets/javascripts/wymeditor/lang/zh-TW.js +47 -0
  21. data/app/assets/javascripts/wymeditor/prototypes.js.erb +6 -9
  22. data/app/assets/javascripts/wymeditor/setup.js.erb +36 -36
  23. data/app/assets/javascripts/wymeditor/skins/refinery/skin.js +1 -4
  24. data/app/assets/javascripts/wymeditor/validators.js.erb +3 -2
  25. data/app/assets/stylesheets/wymeditor/skins/refinery/skin.css.scss +9 -9
  26. data/app/assets/stylesheets/wymeditor/skins/refinery/wymiframe.css.scss +29 -29
  27. data/app/decorators/controllers/refinery/fast_controller_decorator.rb +5 -0
  28. data/app/decorators/models/refinery/page/friendly_id_options_decorator.rb +8 -0
  29. data/app/views/refinery/admin/dialogs/show.html.erb +19 -0
  30. data/app/views/refinery/wymiframe.html.erb +1 -1
  31. data/config/routes.rb +3 -0
  32. data/lib/generators/refinery/wymeditor/templates/config/initializers/refinery/wymeditor.rb.erb +5 -0
  33. data/lib/generators/refinery/wymeditor/wymeditor_generator.rb +10 -0
  34. data/lib/refinery/wymeditor/engine.rb +17 -12
  35. data/lib/refinerycms-wymeditor.rb +2 -0
  36. data/readme.md +44 -32
  37. data/refinerycms-wymeditor.gemspec +3 -1
  38. data/spec/controllers/refinery/fast_controller_spec.rb +12 -0
  39. data/spec/spec_helper.rb +30 -0
  40. metadata +49 -13
  41. data/.gitignore +0 -88
@@ -5,7 +5,7 @@
5
5
  <meta charset='<%= ::Rails.application.config.encoding %>' />
6
6
  <meta httpequiv="XUACompatible" content="IE=edge,chrome=1" />
7
7
  <%= stylesheet_link_tag "wymeditor/skins/refinery/wymiframe", :media => "all" %>
8
- <%= stylesheet_link_tag "formatting", :media => "all" %>
8
+ <%= stylesheet_link_tag "formatting", :media => "all" if Rails.application.assets.find_asset('formatting.css') %>
9
9
  <%= stylesheet_link_tag "theme", :media => "all" %>
10
10
  <%= javascript_include_tag 'modernizr-min' %>
11
11
  </head>
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ Refinery::Core::Engine.routes.draw do
2
+ get 'wymiframe(/:id)', :to => 'fast#wymiframe', :as => :wymiframe
3
+ end
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+ Refinery::Wymeditor.configure do |config|
3
+ # Add extra tags to the wymeditor whitelist e.g. = {'tag' => {'attributes' => {'1' => 'href'}}} or just {'tag' => {}}
4
+ # config.whitelist_tags = <%= Refinery::Wymeditor.whitelist_tags.inspect %>
5
+ end
@@ -0,0 +1,10 @@
1
+ module Refinery
2
+ class WymeditorGenerator < Rails::Generators::Base
3
+ source_root File.expand_path('../templates', __FILE__)
4
+
5
+ def generate_refinery_initializer
6
+ template "config/initializers/refinery/wymeditor.rb.erb",
7
+ File.join(destination_root, "config", "initializers", "refinery", "wymeditor.rb")
8
+ end
9
+ end
10
+ end
@@ -7,23 +7,28 @@ module Refinery
7
7
  engine_name :refinery_wymeditor
8
8
 
9
9
  # set the manifests and assets to be precompiled
10
- initializer "refinery.wymeditor.assets.precompile" do |app|
11
- app.config.assets.precompile += [
12
- "wymeditor/lang/*",
13
- "wymeditor/skins/refinery/*",
14
- "wymeditor/skins/refinery/**/*"
15
- ]
10
+ config.to_prepare do
11
+ Rails.application.config.assets.precompile += %w(
12
+ wymeditor.css
13
+ theme.css
14
+ wymeditor/lang/*
15
+ wymeditor/skins/refinery/*
16
+ wymeditor/skins/refinery/**/*
17
+ )
16
18
  end
17
19
 
18
20
  config.after_initialize do
19
- Refinery.register_engine(Refinery::Wymeditor)
21
+ Refinery.register_engine Refinery::Wymeditor
20
22
  end
21
23
 
22
- config.to_prepare do
23
- Refinery::Core.register_stylesheet 'wymeditor'
24
- Refinery::Core.register_javascript 'refinery/wymeditor'
25
- Refinery::Core.register_javascript "wymeditor/lang/#{::I18n.locale}"
26
- Refinery::Core.register_javascript "wymeditor/skins/refinery/skin"
24
+ after_inclusion do
25
+ %w(wymeditor wymeditor/skins/refinery/skin).each do |stylesheet|
26
+ Refinery::Core.config.register_visual_editor_stylesheet stylesheet
27
+ end
28
+
29
+ %W(refinery/wymeditor wymeditor/lang/#{::I18n.locale} wymeditor/skins/refinery/skin).each do |javascript|
30
+ Refinery::Core.config.register_visual_editor_javascript javascript
31
+ end
27
32
  end
28
33
  end
29
34
  end
@@ -0,0 +1,2 @@
1
+ require 'refinerycms-core'
2
+ require 'refinery/wymeditor'
data/readme.md CHANGED
@@ -19,63 +19,75 @@ Some sites require a little more than just your standard bold and heading contro
19
19
  This is where the "css" style drop down comes in handy.
20
20
 
21
21
  It allows your users to select a style you define. You need to edit/create a CSS
22
- file called ``theme.css``.
22
+ file called `theme.css`.
23
23
 
24
- This file should be located in ``/public/stylesheets/themes.css``
24
+ This file should be located in `/public/stylesheets/themes.css`
25
25
 
26
26
  Inside that file you define your styles like this
27
27
 
28
- .category-name-style-name {
29
- // apply your CSS rules here
30
- }
28
+ ```css
29
+ .category-name-style-name {
30
+ // apply your CSS rules here
31
+ }
32
+ ```
31
33
 
32
34
  For example, if I wanted to add a style that allowed my users to highlight their
33
35
  text a light yellow colour, I would put this
34
36
 
35
- .text-highlight-yellow {
36
- background: LightYellow;
37
- }
37
+ ```css
38
+ .text-highlight-yellow {
39
+ background: LightYellow;
40
+ }
41
+ ```
38
42
 
39
- Now edit ``public/javascripts/admin.js``. We're going to need to tell WYMeditor
43
+ Now edit `public/javascripts/admin.js`. We're going to need to tell WYMeditor
40
44
  that we have some new styles it should load when the editor is loaded.
41
45
 
42
46
  Currently your ``admin.js`` file will have something like this
43
47
 
44
- var custom_wymeditor_boot_options = {
48
+ ```js
49
+ var custom_visual_editor_boot_options = {
45
50
 
46
- };
51
+ };
52
+ ```
47
53
 
48
- If we open ``public/javascripts/boot_wym.js`` we might see the default inside:
54
+ If we open `public/javascripts/boot_wym.js` we might see the default inside:
49
55
 
50
- , classesItems: [
51
- {name: 'text-align', rules:['left', 'center', 'right', 'justify'], join: '-'}
52
- , {name: 'image-align', rules:['left', 'right'], join: '-'}
53
- , {name: 'font-size', rules:['small', 'normal', 'large'], join: '-'}
54
- ]
56
+ ```js
57
+ , classesItems: [
58
+ {name: 'text-align', rules:['left', 'center', 'right', 'justify'], join: '-'}
59
+ , {name: 'image-align', rules:['left', 'right'], join: '-'}
60
+ , {name: 'font-size', rules:['small', 'normal', 'large'], join: '-'}
61
+ ]
62
+ ```
55
63
 
56
64
  Let's just breakdown a single WYMeditor line and understand it:
57
65
 
58
66
  {name: 'font-size', rules:['small','normal','large'], join: '-'}
59
67
 
60
- ``font-size`` is the name of the category and ``small``, ``normal``, ``large``
68
+ `font-size` is the name of the category and `small`, `normal`, `large`
61
69
  are the actual styles. So for this to match up with the styles in my theme.css
62
70
  file the class name has to be:
63
71
 
64
- .font-size-small { // CSS rules here }
65
- .font-size-normal { // CSS rules here }
66
- .font-size-large { // CSS rules here }
72
+ ```css
73
+ .font-size-small { // CSS rules here }
74
+ .font-size-normal { // CSS rules here }
75
+ .font-size-large { // CSS rules here }
76
+ ```
67
77
 
68
78
  So going back to our text highlighting style above, we make the new style show
69
- up in the editor by changing our ``admin.js`` file to:
70
-
71
- var custom_wymeditor_boot_options = {
72
- classesItems: [
73
-   {name: 'text-align', rules:['left', 'center', 'right', 'justify'], join: '-'}
74
- , {name: 'image-align', rules:['left', 'right'], join: '-'}
75
- , {name: 'font-size', rules:['small','normal','large'], join: '-'}
76
- , {name: 'text-highlight', rules:['yellow'], join: '-'}
77
- ]
78
- }
79
+ up in the editor by changing our `admin.js` file to:
80
+
81
+ ```js
82
+ var custom_visual_editor_boot_options = {
83
+ classesItems: [
84
+   {name: 'text-align', rules:['left', 'center', 'right', 'justify'], join: '-'}
85
+ , {name: 'image-align', rules:['left', 'right'], join: '-'}
86
+ , {name: 'font-size', rules:['small','normal','large'], join: '-'}
87
+ , {name: 'text-highlight', rules:['yellow'], join: '-'}
88
+ ]
89
+ }
90
+ ```
79
91
 
80
92
  ## Dialogs that show from WYMeditor
81
93
 
@@ -93,4 +105,4 @@ The link dialog lets you link in several different ways:
93
105
  ### Insert Image dialog
94
106
 
95
107
  Simply lets you select from an existing image found in the Images tab or upload
96
- a new one right within the dialog.
108
+ a new one right within the dialog.
@@ -2,7 +2,7 @@
2
2
  Gem::Specification.new do |s|
3
3
  s.platform = Gem::Platform::RUBY
4
4
  s.name = %q{refinerycms-wymeditor}
5
- s.version = '0.0.1'
5
+ s.version = '1.0.0'
6
6
  s.summary = %q{WYMeditor support for Refinery CMS}
7
7
  s.description = %q{This extension adds WYMeditor support to Refinery CMS for visual editing.}
8
8
  s.email = %q{info@refinerycms.com}
@@ -14,4 +14,6 @@ Gem::Specification.new do |s|
14
14
  s.files = `git ls-files`.split("\n")
15
15
  s.test_files = `git ls-files -- spec/*`.split("\n")
16
16
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
17
+
18
+ s.add_dependency 'refinerycms-core', '~> 3.0', '>= 3.0.0'
17
19
  end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ module Refinery
4
+ describe FastController do
5
+ it "should render the wymiframe template" do
6
+ get :wymiframe
7
+
8
+ response.should be_success
9
+ response.should render_template(:wymiframe)
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,30 @@
1
+ require 'rubygems'
2
+
3
+ # Configure Rails Environment
4
+ ENV["RAILS_ENV"] ||= 'test'
5
+
6
+ require File.expand_path("../dummy/config/environment", __FILE__)
7
+
8
+ require 'rspec/rails'
9
+ require 'capybara/rspec'
10
+ require 'factory_girl_rails'
11
+
12
+ Rails.backtrace_cleaner.remove_silencers!
13
+
14
+ RSpec.configure do |config|
15
+ config.mock_with :rspec
16
+ config.treat_symbols_as_metadata_keys_with_true_values = true
17
+ config.filter_run :focus => true
18
+ config.run_all_when_everything_filtered = true
19
+ end
20
+
21
+ # set javascript driver for capybara
22
+ Capybara.javascript_driver = :selenium
23
+
24
+ # Requires supporting files with custom matchers and macros, etc,
25
+ # in ./support/ and its subdirectories including factories.
26
+ ([Rails.root.to_s] | ::Refinery::Plugins.registered.pathnames).map{|p|
27
+ Dir[File.join(p, 'spec', 'support', '**', '*.rb').to_s]
28
+ }.flatten.sort.each do |support_file|
29
+ require support_file
30
+ end
metadata CHANGED
@@ -1,23 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refinerycms-wymeditor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 1.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Philip Arndt
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-02-24 00:00:00.000000000 Z
13
- dependencies: []
11
+ date: 2014-07-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: refinerycms-core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 3.0.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '3.0'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 3.0.0
14
33
  description: This extension adds WYMeditor support to Refinery CMS for visual editing.
15
34
  email: info@refinerycms.com
16
35
  executables: []
17
36
  extensions: []
18
37
  extra_rdoc_files: []
19
38
  files:
20
- - .gitignore
39
+ - Gemfile
40
+ - Gemfile.lock
21
41
  - app/assets/images/wymeditor/skins/refinery/arrow_redo.png
22
42
  - app/assets/images/wymeditor/skins/refinery/arrow_undo.png
23
43
  - app/assets/images/wymeditor/skins/refinery/eye.png
@@ -91,12 +111,16 @@ files:
91
111
  - app/assets/images/wymeditor/skins/wymeditor_icon.png
92
112
  - app/assets/javascripts/refinery/boot_wym.js.erb
93
113
  - app/assets/javascripts/refinery/wymeditor.js
114
+ - app/assets/javascripts/wymeditor/GPL-license.txt
115
+ - app/assets/javascripts/wymeditor/MIT-license.txt
116
+ - app/assets/javascripts/wymeditor/README.txt
94
117
  - app/assets/javascripts/wymeditor/browsers/ie.js.erb
95
118
  - app/assets/javascripts/wymeditor/browsers/mozilla.js.erb
96
119
  - app/assets/javascripts/wymeditor/browsers/opera.js.erb
97
120
  - app/assets/javascripts/wymeditor/browsers/webkit.js.erb
98
121
  - app/assets/javascripts/wymeditor/classes.js.erb
99
122
  - app/assets/javascripts/wymeditor/functions.js.erb
123
+ - app/assets/javascripts/wymeditor/init_interface.js
100
124
  - app/assets/javascripts/wymeditor/lang/bg.js
101
125
  - app/assets/javascripts/wymeditor/lang/ca.js
102
126
  - app/assets/javascripts/wymeditor/lang/cs.js
@@ -125,7 +149,8 @@ files:
125
149
  - app/assets/javascripts/wymeditor/lang/sv.js
126
150
  - app/assets/javascripts/wymeditor/lang/tr.js
127
151
  - app/assets/javascripts/wymeditor/lang/vi.js
128
- - app/assets/javascripts/wymeditor/lang/zh_cn.js
152
+ - app/assets/javascripts/wymeditor/lang/zh-CN.js
153
+ - app/assets/javascripts/wymeditor/lang/zh-TW.js
129
154
  - app/assets/javascripts/wymeditor/prototypes.js.erb
130
155
  - app/assets/javascripts/wymeditor/setup.js.erb
131
156
  - app/assets/javascripts/wymeditor/skins/refinery/skin.js
@@ -135,39 +160,50 @@ files:
135
160
  - app/assets/stylesheets/wymeditor/skins/refinery/skin.css.scss
136
161
  - app/assets/stylesheets/wymeditor/skins/refinery/wymiframe.css.scss
137
162
  - app/controllers/refinery/wymeditor_controller.rb
163
+ - app/decorators/controllers/refinery/fast_controller_decorator.rb
164
+ - app/decorators/models/refinery/page/friendly_id_options_decorator.rb
165
+ - app/views/refinery/admin/dialogs/show.html.erb
138
166
  - app/views/refinery/wymiframe.html.erb
139
167
  - config/initializers/refinery/wymeditor.rb.erb
168
+ - config/routes.rb
169
+ - lib/generators/refinery/wymeditor/templates/config/initializers/refinery/wymeditor.rb.erb
170
+ - lib/generators/refinery/wymeditor/wymeditor_generator.rb
140
171
  - lib/refinery/wymeditor.rb
141
172
  - lib/refinery/wymeditor/configuration.rb
142
173
  - lib/refinery/wymeditor/engine.rb
174
+ - lib/refinerycms-wymeditor.rb
143
175
  - public/wymeditor/GPL-license.txt
144
176
  - public/wymeditor/MIT-license.txt
145
177
  - public/wymeditor/README
146
178
  - readme.md
147
179
  - refinerycms-wymeditor.gemspec
180
+ - spec/controllers/refinery/fast_controller_spec.rb
181
+ - spec/spec_helper.rb
148
182
  homepage: http://refinerycms.com
149
183
  licenses:
150
184
  - MIT
185
+ metadata: {}
151
186
  post_install_message:
152
187
  rdoc_options: []
153
188
  require_paths:
154
189
  - lib
155
190
  required_ruby_version: !ruby/object:Gem::Requirement
156
- none: false
157
191
  requirements:
158
- - - ! '>='
192
+ - - ">="
159
193
  - !ruby/object:Gem::Version
160
194
  version: '0'
161
195
  required_rubygems_version: !ruby/object:Gem::Requirement
162
- none: false
163
196
  requirements:
164
- - - ! '>='
197
+ - - ">="
165
198
  - !ruby/object:Gem::Version
166
199
  version: '0'
167
200
  requirements: []
168
201
  rubyforge_project:
169
- rubygems_version: 1.8.16
202
+ rubygems_version: 2.2.2
170
203
  signing_key:
171
- specification_version: 3
204
+ specification_version: 4
172
205
  summary: WYMeditor support for Refinery CMS
173
- test_files: []
206
+ test_files:
207
+ - spec/controllers/refinery/fast_controller_spec.rb
208
+ - spec/spec_helper.rb
209
+ has_rdoc:
data/.gitignore DELETED
@@ -1,88 +0,0 @@
1
- # Rails
2
- .bundle
3
- db/*.sqlite3
4
- db/*.sqlite3-journal
5
- *.log
6
- tmp
7
- tmp/**/*
8
- pkg
9
- spec/dummy
10
-
11
- # Documentation
12
- doc/api
13
- doc/app
14
- .yardoc
15
- .yardopts
16
- coverage
17
-
18
- # Public Uploads
19
- public/system/*
20
- public/themes/*
21
-
22
- # Public Cache
23
- public/javascripts/cache
24
- public/stylesheets/cache
25
-
26
- # Vendor Cache
27
- vendor/cache
28
-
29
- # Acts as Indexed
30
- index/**/*
31
-
32
- # Refinery Specific
33
- *.tmproj
34
- *.autobackupbyrefinery.*
35
- refinerycms-*.gem
36
- .autotest
37
-
38
- # Mac
39
- .DS_Store
40
-
41
- # Windows
42
- Thumbs.db
43
-
44
- # NetBeans
45
- nbproject
46
-
47
- # Eclipse
48
- .project
49
-
50
- # Redcar
51
- .redcar
52
-
53
- # Rubinius
54
- *.rbc
55
- *.rbx
56
-
57
- # Vim
58
- *.swp
59
- *.swo
60
-
61
- # RubyMine
62
- .idea
63
-
64
- # E-texteditor
65
- .eprj
66
-
67
- # Backup
68
- *~
69
-
70
- # Capybara Bug
71
- capybara-*html
72
-
73
- # sass
74
- .sass-cache
75
- .sass-cache/*
76
-
77
- #rvm
78
- .rvmrc
79
- .rvmrc.*
80
-
81
- #rbenv
82
- .rbenv-version
83
-
84
- #Sprockets
85
- public/assets
86
-
87
- #Gemfile's lock file
88
- Gemfile.lock