effective_ckeditor 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (183) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +28 -0
  4. data/Rakefile +23 -0
  5. data/app/assets/javascripts/ckeditor/CHANGES.md +589 -0
  6. data/app/assets/javascripts/ckeditor/LICENSE.md +1264 -0
  7. data/app/assets/javascripts/ckeditor/README.md +39 -0
  8. data/app/assets/javascripts/ckeditor/adapters/jquery.js +10 -0
  9. data/app/assets/javascripts/ckeditor/build-config.js +95 -0
  10. data/app/assets/javascripts/ckeditor/ckeditor.js +986 -0
  11. data/app/assets/javascripts/ckeditor/config.js +34 -0
  12. data/app/assets/javascripts/ckeditor/contents.css +134 -0
  13. data/app/assets/javascripts/ckeditor/lang/en.js +5 -0
  14. data/app/assets/javascripts/ckeditor/plugins/clipboard/dialogs/paste.js +11 -0
  15. data/app/assets/javascripts/ckeditor/plugins/colordialog/dialogs/colordialog.js +13 -0
  16. data/app/assets/javascripts/ckeditor/plugins/dialog/dialogDefinition.js +4 -0
  17. data/app/assets/javascripts/ckeditor/plugins/effective_assets/icons/effectiveassets.png +0 -0
  18. data/app/assets/javascripts/ckeditor/plugins/effective_assets/icons/hidpi/effectiveassets.png +0 -0
  19. data/app/assets/javascripts/ckeditor/plugins/effective_assets/plugin.js.coffee +17 -0
  20. data/app/assets/javascripts/ckeditor/plugins/effective_regions/icons/exit.png +0 -0
  21. data/app/assets/javascripts/ckeditor/plugins/effective_regions/icons/hidpi/exit.png +0 -0
  22. data/app/assets/javascripts/ckeditor/plugins/effective_regions/icons/hidpi/save.png +0 -0
  23. data/app/assets/javascripts/ckeditor/plugins/effective_regions/icons/save.png +0 -0
  24. data/app/assets/javascripts/ckeditor/plugins/effective_regions/icons/saving.png +0 -0
  25. data/app/assets/javascripts/ckeditor/plugins/effective_regions/plugin.js.coffee +241 -0
  26. data/app/assets/javascripts/ckeditor/plugins/find/dialogs/find.js +24 -0
  27. data/app/assets/javascripts/ckeditor/plugins/icons.png +0 -0
  28. data/app/assets/javascripts/ckeditor/plugins/icons_hidpi.png +0 -0
  29. data/app/assets/javascripts/ckeditor/plugins/image/dialogs/image.js +43 -0
  30. data/app/assets/javascripts/ckeditor/plugins/image/images/noimage.png +0 -0
  31. data/app/assets/javascripts/ckeditor/plugins/image2/dialogs/image2.js +14 -0
  32. data/app/assets/javascripts/ckeditor/plugins/imagepaste/docs/install.html +66 -0
  33. data/app/assets/javascripts/ckeditor/plugins/imagepaste/docs/styles.css +59 -0
  34. data/app/assets/javascripts/ckeditor/plugins/link/dialogs/anchor.js +7 -0
  35. data/app/assets/javascripts/ckeditor/plugins/link/dialogs/link.js +26 -0
  36. data/app/assets/javascripts/ckeditor/plugins/link/images/anchor.png +0 -0
  37. data/app/assets/javascripts/ckeditor/plugins/link/images/hidpi/anchor.png +0 -0
  38. data/app/assets/javascripts/ckeditor/plugins/liststyle/dialogs/liststyle.js +10 -0
  39. data/app/assets/javascripts/ckeditor/plugins/magicline/images/hidpi/icon.png +0 -0
  40. data/app/assets/javascripts/ckeditor/plugins/magicline/images/icon.png +0 -0
  41. data/app/assets/javascripts/ckeditor/plugins/pagebreak/images/pagebreak.gif +0 -0
  42. data/app/assets/javascripts/ckeditor/plugins/pastefromword/filter/default.js +31 -0
  43. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_address.png +0 -0
  44. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_blockquote.png +0 -0
  45. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_div.png +0 -0
  46. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_h1.png +0 -0
  47. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_h2.png +0 -0
  48. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_h3.png +0 -0
  49. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_h4.png +0 -0
  50. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_h5.png +0 -0
  51. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_h6.png +0 -0
  52. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_p.png +0 -0
  53. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_pre.png +0 -0
  54. data/app/assets/javascripts/ckeditor/plugins/smiley/dialogs/smiley.js +10 -0
  55. data/app/assets/javascripts/ckeditor/plugins/smiley/images/angel_smile.gif +0 -0
  56. data/app/assets/javascripts/ckeditor/plugins/smiley/images/angel_smile.png +0 -0
  57. data/app/assets/javascripts/ckeditor/plugins/smiley/images/angry_smile.gif +0 -0
  58. data/app/assets/javascripts/ckeditor/plugins/smiley/images/angry_smile.png +0 -0
  59. data/app/assets/javascripts/ckeditor/plugins/smiley/images/broken_heart.gif +0 -0
  60. data/app/assets/javascripts/ckeditor/plugins/smiley/images/broken_heart.png +0 -0
  61. data/app/assets/javascripts/ckeditor/plugins/smiley/images/confused_smile.gif +0 -0
  62. data/app/assets/javascripts/ckeditor/plugins/smiley/images/confused_smile.png +0 -0
  63. data/app/assets/javascripts/ckeditor/plugins/smiley/images/cry_smile.gif +0 -0
  64. data/app/assets/javascripts/ckeditor/plugins/smiley/images/cry_smile.png +0 -0
  65. data/app/assets/javascripts/ckeditor/plugins/smiley/images/devil_smile.gif +0 -0
  66. data/app/assets/javascripts/ckeditor/plugins/smiley/images/devil_smile.png +0 -0
  67. data/app/assets/javascripts/ckeditor/plugins/smiley/images/embaressed_smile.gif +0 -0
  68. data/app/assets/javascripts/ckeditor/plugins/smiley/images/embarrassed_smile.gif +0 -0
  69. data/app/assets/javascripts/ckeditor/plugins/smiley/images/embarrassed_smile.png +0 -0
  70. data/app/assets/javascripts/ckeditor/plugins/smiley/images/envelope.gif +0 -0
  71. data/app/assets/javascripts/ckeditor/plugins/smiley/images/envelope.png +0 -0
  72. data/app/assets/javascripts/ckeditor/plugins/smiley/images/heart.gif +0 -0
  73. data/app/assets/javascripts/ckeditor/plugins/smiley/images/heart.png +0 -0
  74. data/app/assets/javascripts/ckeditor/plugins/smiley/images/kiss.gif +0 -0
  75. data/app/assets/javascripts/ckeditor/plugins/smiley/images/kiss.png +0 -0
  76. data/app/assets/javascripts/ckeditor/plugins/smiley/images/lightbulb.gif +0 -0
  77. data/app/assets/javascripts/ckeditor/plugins/smiley/images/lightbulb.png +0 -0
  78. data/app/assets/javascripts/ckeditor/plugins/smiley/images/omg_smile.gif +0 -0
  79. data/app/assets/javascripts/ckeditor/plugins/smiley/images/omg_smile.png +0 -0
  80. data/app/assets/javascripts/ckeditor/plugins/smiley/images/regular_smile.gif +0 -0
  81. data/app/assets/javascripts/ckeditor/plugins/smiley/images/regular_smile.png +0 -0
  82. data/app/assets/javascripts/ckeditor/plugins/smiley/images/sad_smile.gif +0 -0
  83. data/app/assets/javascripts/ckeditor/plugins/smiley/images/sad_smile.png +0 -0
  84. data/app/assets/javascripts/ckeditor/plugins/smiley/images/shades_smile.gif +0 -0
  85. data/app/assets/javascripts/ckeditor/plugins/smiley/images/shades_smile.png +0 -0
  86. data/app/assets/javascripts/ckeditor/plugins/smiley/images/teeth_smile.gif +0 -0
  87. data/app/assets/javascripts/ckeditor/plugins/smiley/images/teeth_smile.png +0 -0
  88. data/app/assets/javascripts/ckeditor/plugins/smiley/images/thumbs_down.gif +0 -0
  89. data/app/assets/javascripts/ckeditor/plugins/smiley/images/thumbs_down.png +0 -0
  90. data/app/assets/javascripts/ckeditor/plugins/smiley/images/thumbs_up.gif +0 -0
  91. data/app/assets/javascripts/ckeditor/plugins/smiley/images/thumbs_up.png +0 -0
  92. data/app/assets/javascripts/ckeditor/plugins/smiley/images/tongue_smile.gif +0 -0
  93. data/app/assets/javascripts/ckeditor/plugins/smiley/images/tongue_smile.png +0 -0
  94. data/app/assets/javascripts/ckeditor/plugins/smiley/images/tounge_smile.gif +0 -0
  95. data/app/assets/javascripts/ckeditor/plugins/smiley/images/whatchutalkingabout_smile.gif +0 -0
  96. data/app/assets/javascripts/ckeditor/plugins/smiley/images/whatchutalkingabout_smile.png +0 -0
  97. data/app/assets/javascripts/ckeditor/plugins/smiley/images/wink_smile.gif +0 -0
  98. data/app/assets/javascripts/ckeditor/plugins/smiley/images/wink_smile.png +0 -0
  99. data/app/assets/javascripts/ckeditor/plugins/sourcedialog/dialogs/sourcedialog.js +6 -0
  100. data/app/assets/javascripts/ckeditor/plugins/syntaxhighlight/dialogs/syntaxhighlight.js +16 -0
  101. data/app/assets/javascripts/ckeditor/plugins/table/dialogs/table.js +21 -0
  102. data/app/assets/javascripts/ckeditor/plugins/tabletools/dialogs/tableCell.js +17 -0
  103. data/app/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.css +84 -0
  104. data/app/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.js +10 -0
  105. data/app/assets/javascripts/ckeditor/plugins/templates/templates/default.js +6 -0
  106. data/app/assets/javascripts/ckeditor/plugins/templates/templates/images/template1.gif +0 -0
  107. data/app/assets/javascripts/ckeditor/plugins/templates/templates/images/template2.gif +0 -0
  108. data/app/assets/javascripts/ckeditor/plugins/templates/templates/images/template3.gif +0 -0
  109. data/app/assets/javascripts/ckeditor/plugins/tliyoutube/dialogs/tliyoutube.js +7 -0
  110. data/app/assets/javascripts/ckeditor/plugins/widget/images/handle.png +0 -0
  111. data/app/assets/javascripts/ckeditor/skins/moonocolor/dialog.css +5 -0
  112. data/app/assets/javascripts/ckeditor/skins/moonocolor/dialog_ie.css +5 -0
  113. data/app/assets/javascripts/ckeditor/skins/moonocolor/dialog_ie7.css +5 -0
  114. data/app/assets/javascripts/ckeditor/skins/moonocolor/dialog_ie8.css +5 -0
  115. data/app/assets/javascripts/ckeditor/skins/moonocolor/dialog_iequirks.css +5 -0
  116. data/app/assets/javascripts/ckeditor/skins/moonocolor/dialog_opera.css +5 -0
  117. data/app/assets/javascripts/ckeditor/skins/moonocolor/editor.css +5 -0
  118. data/app/assets/javascripts/ckeditor/skins/moonocolor/editor_gecko.css +5 -0
  119. data/app/assets/javascripts/ckeditor/skins/moonocolor/editor_ie.css +5 -0
  120. data/app/assets/javascripts/ckeditor/skins/moonocolor/editor_ie7.css +5 -0
  121. data/app/assets/javascripts/ckeditor/skins/moonocolor/editor_ie8.css +5 -0
  122. data/app/assets/javascripts/ckeditor/skins/moonocolor/editor_iequirks.css +5 -0
  123. data/app/assets/javascripts/ckeditor/skins/moonocolor/icons.png +0 -0
  124. data/app/assets/javascripts/ckeditor/skins/moonocolor/icons_hidpi.png +0 -0
  125. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/arrow.png +0 -0
  126. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/close.png +0 -0
  127. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/hidpi/close.png +0 -0
  128. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/hidpi/lock-open.png +0 -0
  129. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/hidpi/lock.png +0 -0
  130. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/hidpi/refresh.png +0 -0
  131. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/lock-open.png +0 -0
  132. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/lock.png +0 -0
  133. data/app/assets/javascripts/ckeditor/skins/moonocolor/images/refresh.png +0 -0
  134. data/app/assets/javascripts/ckeditor/skins/moonocolor/readme.md +51 -0
  135. data/app/assets/javascripts/ckeditor/styles.js +111 -0
  136. data/app/assets/javascripts/effective_ckeditor.js +7 -0
  137. data/app/assets/javascripts/effective_ckeditor/before_init.js.erb +21 -0
  138. data/app/assets/javascripts/effective_ckeditor/config.js.coffee +46 -0
  139. data/app/assets/javascripts/effective_ckeditor/init.js.coffee +90 -0
  140. data/app/assets/javascripts/vendor/jquery.cookie.js +117 -0
  141. data/app/assets/stylesheets/effective_ckeditor.css.scss +2 -0
  142. data/app/assets/stylesheets/effective_ckeditor/layout.css.scss +10 -0
  143. data/app/assets/stylesheets/effective_ckeditor/overrides.css.scss +40 -0
  144. data/lib/effective_ckeditor.rb +10 -0
  145. data/lib/effective_ckeditor/engine.rb +21 -0
  146. data/lib/effective_ckeditor/version.rb +3 -0
  147. data/lib/generators/effective_ckeditor/install_generator.rb +15 -0
  148. data/lib/generators/templates/README +1 -0
  149. data/lib/tasks/effective_ckeditor_tasks.rake +19 -0
  150. data/spec/dummy/README.rdoc +261 -0
  151. data/spec/dummy/Rakefile +7 -0
  152. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  153. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  154. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  155. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  156. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  157. data/spec/dummy/config.ru +4 -0
  158. data/spec/dummy/config/application.rb +65 -0
  159. data/spec/dummy/config/boot.rb +10 -0
  160. data/spec/dummy/config/database.yml +25 -0
  161. data/spec/dummy/config/environment.rb +5 -0
  162. data/spec/dummy/config/environments/development.rb +37 -0
  163. data/spec/dummy/config/environments/production.rb +67 -0
  164. data/spec/dummy/config/environments/test.rb +37 -0
  165. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  166. data/spec/dummy/config/initializers/inflections.rb +15 -0
  167. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  168. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  169. data/spec/dummy/config/initializers/session_store.rb +8 -0
  170. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  171. data/spec/dummy/config/locales/en.yml +5 -0
  172. data/spec/dummy/config/routes.rb +58 -0
  173. data/spec/dummy/db/schema.rb +34 -0
  174. data/spec/dummy/public/404.html +26 -0
  175. data/spec/dummy/public/422.html +26 -0
  176. data/spec/dummy/public/500.html +25 -0
  177. data/spec/dummy/public/favicon.ico +0 -0
  178. data/spec/dummy/script/rails +6 -0
  179. data/spec/dummy/spec_link +3 -0
  180. data/spec/effective_ckeditor_spec.rb +7 -0
  181. data/spec/spec_helper.rb +34 -0
  182. data/spec/support/factories.rb +4 -0
  183. metadata +274 -0
@@ -0,0 +1,46 @@
1
+ CKEDITOR.editorConfig = (config) ->
2
+ config.startupShowBorders = true
3
+
4
+ config.extraPlugins = 'effective_regions,effective_assets'
5
+ config.format_tags = 'p;h1;h2;h3;h4;h5;h6;pre;div'
6
+
7
+ config.templates = 'effective_regions'
8
+ config.templates_files = []
9
+ config.templates_replaceContent = false
10
+
11
+ config.filebrowserWindowHeight = 600
12
+ config.filebrowserWindowWidth = 800
13
+ config.filebrowserBrowseUrl = '/effective/assets?only=images'
14
+
15
+ CKEDITOR.dtd.$removeEmpty['i'] = false
16
+
17
+ config.toolbar_full = [
18
+ { name: 'save', items: ['Save', '-', 'NewPage'] },
19
+ { name: 'html', items: ['Sourcedialog', '-', 'ShowBlocks'] },
20
+ { name: 'editing', items: ['Undo', 'Redo'] },
21
+ { name: 'clipboard', items: ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'] },
22
+ { name: 'basicstyles', items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat'] },
23
+ ['Exit']
24
+ '/',
25
+ { name: 'definedstyles', items: ['Format'] },
26
+ { name: 'links', items: ['Link', 'Unlink'] },
27
+ { name: 'insert', items: ['Image', 'tliyoutube', 'EffectiveAssets'] },
28
+ { name: 'lists', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent'] },
29
+ { name: 'insert2', items: ['Table', 'HorizontalRule', 'Blockquote', 'PageBreak'] },
30
+ { name: 'snippets', items: ['Templates', 'InsertSnippet'] }
31
+ ]
32
+
33
+ config.toolbar_snippets = [
34
+ ['Save', '-', 'NewPage'],
35
+ ['Sourcedialog', '-', 'ShowBlocks'],
36
+ ['Undo', 'Redo'],
37
+ { name: 'snippets', items: ['InsertSnippet'] },
38
+ ['Exit']
39
+ ]
40
+
41
+ config.toolbar_simple = [
42
+ ['Save', '-', 'NewPage'],
43
+ ['Undo', 'Redo'],
44
+ ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
45
+ ['Exit']
46
+ ]
@@ -0,0 +1,90 @@
1
+ CKEDITOR.disableAutoInline = true
2
+
3
+ # Disable drag & dropping into regions (fixes issues with simple regions)
4
+ $(document).on 'drop', '.effective-region', (event) -> event.preventDefault()
5
+
6
+ # Don't propogate click events up
7
+ $(document).on 'click', '.effective-region', (event) ->
8
+ event.stopPropagation()
9
+ event.preventDefault()
10
+
11
+ $ -> init()
12
+
13
+ init = ->
14
+ instance.destroy(true) for instance in CKEDITOR.instances
15
+
16
+ ckeditors = $('[data-effective-ckeditor]')
17
+
18
+ if ckeditors.length
19
+ $('body').prepend("<div id='effective-ckeditor-top'></div>").addClass('effective-ckeditor-editting')
20
+
21
+ $(window).on 'beforeunload', (event) -> promptToSaveIfDirty(event)
22
+ $(window).on 'unload', (event) -> $.cookie('effective_regions_editting', '', {path: '/', expires: -1})
23
+
24
+ ckeditors.each ->
25
+ editor_div = $(this)
26
+
27
+ if editor_div.is(':visible')
28
+ initEditor(this)
29
+ else
30
+ affixBootstrapMenu(editor_div)
31
+ editor_div.on 'click', -> try initEditor(this)
32
+
33
+ initEditor = (editor_div) ->
34
+ region = $(editor_div).data('effective-ckeditor')
35
+
36
+ switch region
37
+ when 'full'
38
+ enterMode = CKEDITOR.ENTER_P
39
+ shiftEnterMode = CKEDITOR.ENTER_BR
40
+ startupOutlineBlocks = true
41
+ toolbar = 'full'
42
+ when 'snippets'
43
+ enterMode = CKEDITOR.ENTER_BR
44
+ shiftEnterMode = CKEDITOR.ENTER_BR
45
+ startupOutlineBlocks = false
46
+ toolbar = 'snippets'
47
+ when 'simple'
48
+ enterMode = CKEDITOR.ENTER_BR
49
+ shiftEnterMode = CKEDITOR.ENTER_BR
50
+ startupOutlineBlocks = false
51
+ toolbar = 'simple'
52
+
53
+ CKEDITOR.inline(editor_div.id,
54
+ toolbar: toolbar
55
+ allowedSnippets: $(editor_div).data('allowed-snippets')
56
+ effectiveRegionType: region
57
+ customConfig: '/assets/effective_ckeditor/config.js'
58
+ enterMode: enterMode
59
+ shiftEnterMode: shiftEnterMode
60
+ startupOutlineBlocks: startupOutlineBlocks
61
+ disableNativeTableHandles: true
62
+ sharedSpaces:
63
+ top: 'effective-ckeditor-top'
64
+ )
65
+
66
+ promptToSaveIfDirty = (event) ->
67
+ dirty = false
68
+
69
+ for name, instance of CKEDITOR.instances
70
+ if instance.checkDirty()
71
+ dirty = true
72
+ break
73
+
74
+ if dirty
75
+ 'You have unsaved changes'
76
+ else
77
+ event.stopPropagation()
78
+
79
+ affixBootstrapMenu = (editor_div) ->
80
+ dropdown_menu = editor_div.closest('.dropdown-menu')
81
+
82
+ if dropdown_menu.length > 0
83
+ dropdown_menu.on 'click', (event) -> event.stopPropagation()
84
+
85
+ dropdown = editor_div.closest('.dropdown')
86
+ dropdown.on 'hide.bs.dropdown', (event) -> event.preventDefault()
87
+ dropdown.on 'click.bs.dropdown', (event) -> event.preventDefault()
88
+ dropdown.on 'click', (event) ->
89
+ $(this).removeClass('open') and event.stopPropagation() if $(this).hasClass('open')
90
+
@@ -0,0 +1,117 @@
1
+ /*!
2
+ * jQuery Cookie Plugin v1.4.0
3
+ * https://github.com/carhartl/jquery-cookie
4
+ *
5
+ * Copyright 2013 Klaus Hartl
6
+ * Released under the MIT license
7
+ */
8
+ (function (factory) {
9
+ if (typeof define === 'function' && define.amd) {
10
+ // AMD. Register as anonymous module.
11
+ define(['jquery'], factory);
12
+ } else {
13
+ // Browser globals.
14
+ factory(jQuery);
15
+ }
16
+ }(function ($) {
17
+
18
+ var pluses = /\+/g;
19
+
20
+ function encode(s) {
21
+ return config.raw ? s : encodeURIComponent(s);
22
+ }
23
+
24
+ function decode(s) {
25
+ return config.raw ? s : decodeURIComponent(s);
26
+ }
27
+
28
+ function stringifyCookieValue(value) {
29
+ return encode(config.json ? JSON.stringify(value) : String(value));
30
+ }
31
+
32
+ function parseCookieValue(s) {
33
+ if (s.indexOf('"') === 0) {
34
+ // This is a quoted cookie as according to RFC2068, unescape...
35
+ s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
36
+ }
37
+
38
+ try {
39
+ // Replace server-side written pluses with spaces.
40
+ // If we can't decode the cookie, ignore it, it's unusable.
41
+ s = decodeURIComponent(s.replace(pluses, ' '));
42
+ } catch(e) {
43
+ return;
44
+ }
45
+
46
+ try {
47
+ // If we can't parse the cookie, ignore it, it's unusable.
48
+ return config.json ? JSON.parse(s) : s;
49
+ } catch(e) {}
50
+ }
51
+
52
+ function read(s, converter) {
53
+ var value = config.raw ? s : parseCookieValue(s);
54
+ return $.isFunction(converter) ? converter(value) : value;
55
+ }
56
+
57
+ var config = $.cookie = function (key, value, options) {
58
+
59
+ // Write
60
+ if (value !== undefined && !$.isFunction(value)) {
61
+ options = $.extend({}, config.defaults, options);
62
+
63
+ if (typeof options.expires === 'number') {
64
+ var days = options.expires, t = options.expires = new Date();
65
+ t.setDate(t.getDate() + days);
66
+ }
67
+
68
+ return (document.cookie = [
69
+ encode(key), '=', stringifyCookieValue(value),
70
+ options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
71
+ options.path ? '; path=' + options.path : '',
72
+ options.domain ? '; domain=' + options.domain : '',
73
+ options.secure ? '; secure' : ''
74
+ ].join(''));
75
+ }
76
+
77
+ // Read
78
+
79
+ var result = key ? undefined : {};
80
+
81
+ // To prevent the for loop in the first place assign an empty array
82
+ // in case there are no cookies at all. Also prevents odd result when
83
+ // calling $.cookie().
84
+ var cookies = document.cookie ? document.cookie.split('; ') : [];
85
+
86
+ for (var i = 0, l = cookies.length; i < l; i++) {
87
+ var parts = cookies[i].split('=');
88
+ var name = decode(parts.shift());
89
+ var cookie = parts.join('=');
90
+
91
+ if (key && key === name) {
92
+ // If second argument (value) is a function it's a converter...
93
+ result = read(cookie, value);
94
+ break;
95
+ }
96
+
97
+ // Prevent storing a cookie that we couldn't decode.
98
+ if (!key && (cookie = read(cookie)) !== undefined) {
99
+ result[name] = cookie;
100
+ }
101
+ }
102
+
103
+ return result;
104
+ };
105
+
106
+ config.defaults = {};
107
+
108
+ $.removeCookie = function (key, options) {
109
+ if ($.cookie(key) !== undefined) {
110
+ // Must not alter options, thus extending a fresh object...
111
+ $.cookie(key, '', $.extend({}, options, { expires: -1 }));
112
+ return true;
113
+ }
114
+ return false;
115
+ };
116
+
117
+ }));
@@ -0,0 +1,2 @@
1
+ @import 'effective_ckeditor/layout';
2
+ @import 'effective_ckeditor/overrides';
@@ -0,0 +1,10 @@
1
+ .effective-ckeditor-editting {
2
+ padding-top: 80px; // Whatever the height of our top bar will be
3
+ }
4
+
5
+ #effective-ckeditor-top {
6
+ position: fixed;
7
+ top: 0;
8
+ width: 100%;
9
+ z-index: 9000;
10
+ }
@@ -0,0 +1,40 @@
1
+ // This is the 'Insert Snippet' dropdown
2
+ span.cke_combo__insertsnippet > a > .cke_combo_text {
3
+ width: 88px;
4
+ }
5
+
6
+ // The 'Insert Snippet' dropped down panel
7
+ .cke_combopanel.cke_combopanel__insertsnippet {
8
+ width: 250px;
9
+ }
10
+
11
+ // The 'Styles' dropped down panel
12
+ .cke_combopanel.cke_combopanel__styles {
13
+ width: 250px;
14
+ }
15
+
16
+ // The 'Styles' dropped down panel
17
+ .cke_combopanel.cke_combopanel__format {
18
+ width: 180px;
19
+ }
20
+
21
+ span.cke_button__exit_label {
22
+ display: inline;
23
+ }
24
+
25
+ .effective-region {
26
+ outline: none;
27
+ display: inherit;
28
+ border: 1px dotted #4195fc;
29
+ min-height: 10px;
30
+ min-width: 10px;
31
+
32
+ &:focus {
33
+ outline: none;
34
+ border: 1px solid #4195fc;
35
+
36
+ -webkit-box-shadow: 0px 0px 6px #4195fc;
37
+ -moz-box-shadow: 0px 0px 6px #4195fc;
38
+ box-shadow: 0px 0px 6px #4195fc;
39
+ }
40
+ }
@@ -0,0 +1,10 @@
1
+ require "effective_ckeditor/engine"
2
+ require "effective_ckeditor/version"
3
+
4
+ module EffectiveCkeditor
5
+
6
+ def self.setup
7
+ yield self
8
+ end
9
+
10
+ end
@@ -0,0 +1,21 @@
1
+ module EffectiveCkeditor
2
+ class Engine < ::Rails::Engine
3
+ engine_name 'effective_ckeditor'
4
+ isolate_namespace EffectiveCkeditor
5
+
6
+ # Append some precompiled assets we need access to
7
+ # This works in conjunction with the effective_ckeditor rake task that enhances assets:precompile
8
+ initializer "effective_ckeditor.append_precompiled_assets" do |app|
9
+ precompile = [
10
+ 'effective_ckeditor.js',
11
+ 'effective_ckeditor.css',
12
+ 'effective_ckeditor/config.js',
13
+ 'ckeditor/*',
14
+ 'effective/snippets/*'
15
+ ]
16
+
17
+ Rails.application.config.assets.precompile += precompile
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,3 @@
1
+ module EffectiveCkeditor
2
+ VERSION = '1.0.0'.freeze
3
+ end
@@ -0,0 +1,15 @@
1
+ module EffectiveCkeditor
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+ include Rails::Generators::Migration
5
+
6
+ desc "Creates an EffectiveCKeditor initializer in your application."
7
+
8
+ source_root File.expand_path("../../templates", __FILE__)
9
+
10
+ def show_readme
11
+ readme "README" if behavior == :invoke
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1 @@
1
+ Thanks for using EffectiveCkeditor
@@ -0,0 +1,19 @@
1
+ # This was modified from https://github.com/galetahub/ckeditor
2
+
3
+ namespace :ckeditor do
4
+ desc 'Create nondigest versions of some ckeditor assets (e.g. moono skin png)'
5
+ task :create_nondigest_assets do
6
+ fingerprint = /\-[0-9a-f]{32}\./
7
+ for file in Dir['public/assets/ckeditor/**/*.*', 'public/assets/effective_ckeditor/**/*.*', 'public/assets/effective/**/*.*']
8
+ next unless file =~ fingerprint
9
+ nondigest = file.sub fingerprint, '.' # contents-0d8ffa186a00f5063461bc0ba0d96087.css => contents.css
10
+ FileUtils.cp file, nondigest, verbose: true
11
+ end
12
+ end
13
+ end
14
+
15
+ # auto run ckeditor:create_nondigest_assets after assets:precompile
16
+ Rake::Task['assets:precompile'].enhance do
17
+ puts 'undigesting required effective_ckeditor assets'
18
+ Rake::Task['ckeditor:create_nondigest_assets'].invoke
19
+ end
@@ -0,0 +1,261 @@
1
+ == Welcome to Rails
2
+
3
+ Rails is a web-application framework that includes everything needed to create
4
+ database-backed web applications according to the Model-View-Control pattern.
5
+
6
+ This pattern splits the view (also called the presentation) into "dumb"
7
+ templates that are primarily responsible for inserting pre-built data in between
8
+ HTML tags. The model contains the "smart" domain objects (such as Account,
9
+ Product, Person, Post) that holds all the business logic and knows how to
10
+ persist themselves to a database. The controller handles the incoming requests
11
+ (such as Save New Account, Update Product, Show Post) by manipulating the model
12
+ and directing data to the view.
13
+
14
+ In Rails, the model is handled by what's called an object-relational mapping
15
+ layer entitled Active Record. This layer allows you to present the data from
16
+ database rows as objects and embellish these data objects with business logic
17
+ methods. You can read more about Active Record in
18
+ link:files/vendor/rails/activerecord/README.html.
19
+
20
+ The controller and view are handled by the Action Pack, which handles both
21
+ layers by its two parts: Action View and Action Controller. These two layers
22
+ are bundled in a single package due to their heavy interdependence. This is
23
+ unlike the relationship between the Active Record and Action Pack that is much
24
+ more separate. Each of these packages can be used independently outside of
25
+ Rails. You can read more about Action Pack in
26
+ link:files/vendor/rails/actionpack/README.html.
27
+
28
+
29
+ == Getting Started
30
+
31
+ 1. At the command prompt, create a new Rails application:
32
+ <tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
33
+
34
+ 2. Change directory to <tt>myapp</tt> and start the web server:
35
+ <tt>cd myapp; rails server</tt> (run with --help for options)
36
+
37
+ 3. Go to http://localhost:3000/ and you'll see:
38
+ "Welcome aboard: You're riding Ruby on Rails!"
39
+
40
+ 4. Follow the guidelines to start developing your application. You can find
41
+ the following resources handy:
42
+
43
+ * The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
44
+ * Ruby on Rails Tutorial Book: http://www.railstutorial.org/
45
+
46
+
47
+ == Debugging Rails
48
+
49
+ Sometimes your application goes wrong. Fortunately there are a lot of tools that
50
+ will help you debug it and get it back on the rails.
51
+
52
+ First area to check is the application log files. Have "tail -f" commands
53
+ running on the server.log and development.log. Rails will automatically display
54
+ debugging and runtime information to these files. Debugging info will also be
55
+ shown in the browser on requests from 127.0.0.1.
56
+
57
+ You can also log your own messages directly into the log file from your code
58
+ using the Ruby logger class from inside your controllers. Example:
59
+
60
+ class WeblogController < ActionController::Base
61
+ def destroy
62
+ @weblog = Weblog.find(params[:id])
63
+ @weblog.destroy
64
+ logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
65
+ end
66
+ end
67
+
68
+ The result will be a message in your log file along the lines of:
69
+
70
+ Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
71
+
72
+ More information on how to use the logger is at http://www.ruby-doc.org/core/
73
+
74
+ Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
75
+ several books available online as well:
76
+
77
+ * Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
78
+ * Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
79
+
80
+ These two books will bring you up to speed on the Ruby language and also on
81
+ programming in general.
82
+
83
+
84
+ == Debugger
85
+
86
+ Debugger support is available through the debugger command when you start your
87
+ Mongrel or WEBrick server with --debugger. This means that you can break out of
88
+ execution at any point in the code, investigate and change the model, and then,
89
+ resume execution! You need to install ruby-debug to run the server in debugging
90
+ mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
91
+
92
+ class WeblogController < ActionController::Base
93
+ def index
94
+ @posts = Post.all
95
+ debugger
96
+ end
97
+ end
98
+
99
+ So the controller will accept the action, run the first line, then present you
100
+ with a IRB prompt in the server window. Here you can do things like:
101
+
102
+ >> @posts.inspect
103
+ => "[#<Post:0x14a6be8
104
+ @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
105
+ #<Post:0x14a6620
106
+ @attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
107
+ >> @posts.first.title = "hello from a debugger"
108
+ => "hello from a debugger"
109
+
110
+ ...and even better, you can examine how your runtime objects actually work:
111
+
112
+ >> f = @posts.first
113
+ => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
114
+ >> f.
115
+ Display all 152 possibilities? (y or n)
116
+
117
+ Finally, when you're ready to resume execution, you can enter "cont".
118
+
119
+
120
+ == Console
121
+
122
+ The console is a Ruby shell, which allows you to interact with your
123
+ application's domain model. Here you'll have all parts of the application
124
+ configured, just like it is when the application is running. You can inspect
125
+ domain models, change values, and save to the database. Starting the script
126
+ without arguments will launch it in the development environment.
127
+
128
+ To start the console, run <tt>rails console</tt> from the application
129
+ directory.
130
+
131
+ Options:
132
+
133
+ * Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
134
+ made to the database.
135
+ * Passing an environment name as an argument will load the corresponding
136
+ environment. Example: <tt>rails console production</tt>.
137
+
138
+ To reload your controllers and models after launching the console run
139
+ <tt>reload!</tt>
140
+
141
+ More information about irb can be found at:
142
+ link:http://www.rubycentral.org/pickaxe/irb.html
143
+
144
+
145
+ == dbconsole
146
+
147
+ You can go to the command line of your database directly through <tt>rails
148
+ dbconsole</tt>. You would be connected to the database with the credentials
149
+ defined in database.yml. Starting the script without arguments will connect you
150
+ to the development database. Passing an argument will connect you to a different
151
+ database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
152
+ PostgreSQL and SQLite 3.
153
+
154
+ == Description of Contents
155
+
156
+ The default directory structure of a generated Ruby on Rails application:
157
+
158
+ |-- app
159
+ | |-- assets
160
+ | | |-- images
161
+ | | |-- javascripts
162
+ | | `-- stylesheets
163
+ | |-- controllers
164
+ | |-- helpers
165
+ | |-- mailers
166
+ | |-- models
167
+ | `-- views
168
+ | `-- layouts
169
+ |-- config
170
+ | |-- environments
171
+ | |-- initializers
172
+ | `-- locales
173
+ |-- db
174
+ |-- doc
175
+ |-- lib
176
+ | |-- assets
177
+ | `-- tasks
178
+ |-- log
179
+ |-- public
180
+ |-- script
181
+ |-- test
182
+ | |-- fixtures
183
+ | |-- functional
184
+ | |-- integration
185
+ | |-- performance
186
+ | `-- unit
187
+ |-- tmp
188
+ | `-- cache
189
+ | `-- assets
190
+ `-- vendor
191
+ |-- assets
192
+ | |-- javascripts
193
+ | `-- stylesheets
194
+ `-- plugins
195
+
196
+ app
197
+ Holds all the code that's specific to this particular application.
198
+
199
+ app/assets
200
+ Contains subdirectories for images, stylesheets, and JavaScript files.
201
+
202
+ app/controllers
203
+ Holds controllers that should be named like weblogs_controller.rb for
204
+ automated URL mapping. All controllers should descend from
205
+ ApplicationController which itself descends from ActionController::Base.
206
+
207
+ app/models
208
+ Holds models that should be named like post.rb. Models descend from
209
+ ActiveRecord::Base by default.
210
+
211
+ app/views
212
+ Holds the template files for the view that should be named like
213
+ weblogs/index.html.erb for the WeblogsController#index action. All views use
214
+ eRuby syntax by default.
215
+
216
+ app/views/layouts
217
+ Holds the template files for layouts to be used with views. This models the
218
+ common header/footer method of wrapping views. In your views, define a layout
219
+ using the <tt>layout :default</tt> and create a file named default.html.erb.
220
+ Inside default.html.erb, call <% yield %> to render the view using this
221
+ layout.
222
+
223
+ app/helpers
224
+ Holds view helpers that should be named like weblogs_helper.rb. These are
225
+ generated for you automatically when using generators for controllers.
226
+ Helpers can be used to wrap functionality for your views into methods.
227
+
228
+ config
229
+ Configuration files for the Rails environment, the routing map, the database,
230
+ and other dependencies.
231
+
232
+ db
233
+ Contains the database schema in schema.rb. db/migrate contains all the
234
+ sequence of Migrations for your schema.
235
+
236
+ doc
237
+ This directory is where your application documentation will be stored when
238
+ generated using <tt>rake doc:app</tt>
239
+
240
+ lib
241
+ Application specific libraries. Basically, any kind of custom code that
242
+ doesn't belong under controllers, models, or helpers. This directory is in
243
+ the load path.
244
+
245
+ public
246
+ The directory available for the web server. Also contains the dispatchers and the
247
+ default HTML files. This should be set as the DOCUMENT_ROOT of your web
248
+ server.
249
+
250
+ script
251
+ Helper scripts for automation and generation.
252
+
253
+ test
254
+ Unit and functional tests along with fixtures. When using the rails generate
255
+ command, template test files will be generated for you and placed in this
256
+ directory.
257
+
258
+ vendor
259
+ External libraries that the application depends on. Also includes the plugins
260
+ subdirectory. If the app has frozen rails, those gems also go here, under
261
+ vendor/rails/. This directory is in the load path.