symphonia 2.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +674 -0
  3. data/README.md +16 -0
  4. data/Rakefile +44 -0
  5. data/app/assets/images/bg-checker.png +0 -0
  6. data/app/assets/images/bullet.gif +0 -0
  7. data/app/assets/images/close.png +0 -0
  8. data/app/assets/images/loading.gif +0 -0
  9. data/app/assets/images/next.png +0 -0
  10. data/app/assets/images/prev.png +0 -0
  11. data/app/assets/javascripts/ckeditor/plugins/autogrow/plugin.js +232 -0
  12. data/app/assets/javascripts/ckeditor/plugins/autogrow/samples/autogrow.html +102 -0
  13. data/app/assets/javascripts/ckeditor/plugins/image_chooser/icons/addimage.png +0 -0
  14. data/app/assets/javascripts/ckeditor/plugins/image_chooser/plugin.js +15 -0
  15. data/app/assets/javascripts/symphonia/Sortable.js +1249 -0
  16. data/app/assets/javascripts/symphonia/_core.js +45 -0
  17. data/app/assets/javascripts/symphonia/application.js.erb +147 -0
  18. data/app/assets/javascripts/symphonia/filters.js +44 -0
  19. data/app/assets/javascripts/symphonia/symphonia_bootstrap_dialog.js +136 -0
  20. data/app/assets/javascripts/symphonia/symphonia_ckeditor.js +55 -0
  21. data/app/assets/stylesheets/symphonia/application.css +4 -0
  22. data/app/assets/stylesheets/symphonia/basic.scss +218 -0
  23. data/app/assets/stylesheets/symphonia/filters.scss +19 -0
  24. data/app/assets/stylesheets/symphonia/symphonia_bootstrap.scss +56 -0
  25. data/app/channels/application_cable/channel.rb +5 -0
  26. data/app/controllers/symphonia/accounts_controller.rb +169 -0
  27. data/app/controllers/symphonia/admin_controller.rb +22 -0
  28. data/app/controllers/symphonia/api_controller.rb +64 -0
  29. data/app/controllers/symphonia/application_controller.rb +8 -0
  30. data/app/controllers/symphonia/attachments_controller.rb +37 -0
  31. data/app/controllers/symphonia/filters_controller.rb +23 -0
  32. data/app/controllers/symphonia/images_controller.rb +16 -0
  33. data/app/controllers/symphonia/login_controller.rb +80 -0
  34. data/app/controllers/symphonia/roles_controller.rb +100 -0
  35. data/app/controllers/symphonia/user_sessions_controller.rb +16 -0
  36. data/app/controllers/symphonia/users_controller.rb +168 -0
  37. data/app/helpers/symphonia/application_helper.rb +422 -0
  38. data/app/helpers/symphonia/bootstrap_modal_helper.rb +59 -0
  39. data/app/helpers/symphonia/form_helper.rb +50 -0
  40. data/app/helpers/symphonia/renderer_helper.rb +85 -0
  41. data/app/mailers/symphonia/application_mailer.rb +6 -0
  42. data/app/mailers/symphonia/notifier.rb +42 -0
  43. data/app/models/symphonia/admin_module.rb +18 -0
  44. data/app/models/symphonia/application_record.rb +14 -0
  45. data/app/models/symphonia/attachment.rb +16 -0
  46. data/app/models/symphonia/common_file.rb +9 -0
  47. data/app/models/symphonia/email_preference.rb +5 -0
  48. data/app/models/symphonia/image.rb +46 -0
  49. data/app/models/symphonia/preference.rb +12 -0
  50. data/app/models/symphonia/role.rb +55 -0
  51. data/app/models/symphonia/swagger/error_model.rb +19 -0
  52. data/app/models/symphonia/swagger/responses.rb +27 -0
  53. data/app/models/symphonia/user.rb +141 -0
  54. data/app/models/symphonia/user_session.rb +19 -0
  55. data/app/views/common/403.html.erb +5 -0
  56. data/app/views/common/404.html.erb +2 -0
  57. data/app/views/layouts/symphonia/_modal.html.erb +19 -0
  58. data/app/views/layouts/symphonia/_query.html.erb +51 -0
  59. data/app/views/layouts/symphonia/application.html.erb +45 -0
  60. data/app/views/layouts/symphonia/application.pdf.erb +15 -0
  61. data/app/views/layouts/symphonia/mailer.html.erb +13 -0
  62. data/app/views/symphonia/accounts/_detail.html.erb +65 -0
  63. data/app/views/symphonia/accounts/_form.html.erb +14 -0
  64. data/app/views/symphonia/accounts/edit.html.erb +9 -0
  65. data/app/views/symphonia/accounts/edit.js.erb +5 -0
  66. data/app/views/symphonia/accounts/lost_password.html.erb +6 -0
  67. data/app/views/symphonia/accounts/lost_password.js.erb +3 -0
  68. data/app/views/symphonia/accounts/new_activation.html.erb +11 -0
  69. data/app/views/symphonia/accounts/new_activation.js.erb +6 -0
  70. data/app/views/symphonia/accounts/register.html.erb +20 -0
  71. data/app/views/symphonia/accounts/reset_password.html.erb +18 -0
  72. data/app/views/symphonia/accounts/update.js.erb +1 -0
  73. data/app/views/symphonia/admin/index.html.erb +15 -0
  74. data/app/views/symphonia/attachments/destroy.js.erb +1 -0
  75. data/app/views/symphonia/common/_editable_images_grid.html.erb +12 -0
  76. data/app/views/symphonia/common/_filters.html.erb +23 -0
  77. data/app/views/symphonia/common/_locale_chooser.html.erb +16 -0
  78. data/app/views/symphonia/common/_share_links.html.erb +5 -0
  79. data/app/views/symphonia/filters/options.html.erb +36 -0
  80. data/app/views/symphonia/filters/options.js.erb +9 -0
  81. data/app/views/symphonia/filters/table.html.erb +21 -0
  82. data/app/views/symphonia/login/_form.html.erb +19 -0
  83. data/app/views/symphonia/login/new.html.erb +11 -0
  84. data/app/views/symphonia/login_sessions/new.html.erb +1 -0
  85. data/app/views/symphonia/notifier/activation_user.html.erb +7 -0
  86. data/app/views/symphonia/notifier/activation_user.text.erb +3 -0
  87. data/app/views/symphonia/notifier/reset_password_user.html.erb +7 -0
  88. data/app/views/symphonia/notifier/reset_password_user.text.erb +3 -0
  89. data/app/views/symphonia/notifier/test_mail.html.erb +2 -0
  90. data/app/views/symphonia/notifier/test_mail.text.erb +3 -0
  91. data/app/views/symphonia/notifier/user_change_to_active.html.erb +3 -0
  92. data/app/views/symphonia/notifier/user_change_to_active.text.erb +1 -0
  93. data/app/views/symphonia/notifier/user_registered.html.erb +13 -0
  94. data/app/views/symphonia/notifier/user_registered.text.erb +8 -0
  95. data/app/views/symphonia/roles/_form.html.erb +30 -0
  96. data/app/views/symphonia/roles/edit.html.erb +5 -0
  97. data/app/views/symphonia/roles/index.html.erb +6 -0
  98. data/app/views/symphonia/roles/new.html.erb +4 -0
  99. data/app/views/symphonia/roles/show.html.erb +5 -0
  100. data/app/views/symphonia/users/_form.html.erb +13 -0
  101. data/app/views/symphonia/users/edit.html.erb +26 -0
  102. data/app/views/symphonia/users/edit.js.erb +3 -0
  103. data/app/views/symphonia/users/edit_current.html.erb +7 -0
  104. data/app/views/symphonia/users/index.html.erb +5 -0
  105. data/app/views/symphonia/users/new.html.erb +8 -0
  106. data/app/views/symphonia/users/show.html.erb +63 -0
  107. data/config/locales/cs.yml +233 -0
  108. data/config/locales/en.yml +47 -0
  109. data/config/routes.rb +52 -0
  110. data/db/migrate/20130714140500_create_users.rb +49 -0
  111. data/db/migrate/20130714140501_create_roles.rb +16 -0
  112. data/db/migrate/20130714140502_create_preferences.rb +26 -0
  113. data/db/migrate/20130828175114_create_attachments.rb +20 -0
  114. data/db/migrate/20141213204351_create_admin_modules.rb +20 -0
  115. data/db/seeds.rb +12 -0
  116. data/lib/generators/symphonia/entity_controller/entity_controller_generator.rb +48 -0
  117. data/lib/generators/symphonia/entity_controller/templates/controller.rb +100 -0
  118. data/lib/generators/symphonia/query/query_generator.rb +37 -0
  119. data/lib/generators/symphonia/setup/setup_generator.rb +52 -0
  120. data/lib/generators/symphonia/setup/templates/404.html +26 -0
  121. data/lib/generators/symphonia/setup/templates/500.html +37 -0
  122. data/lib/generators/symphonia/setup/templates/Gemfile +18 -0
  123. data/lib/generators/symphonia/setup/templates/base_layout.html.erb +46 -0
  124. data/lib/generators/symphonia/setup/templates/design.scss +4 -0
  125. data/lib/generators/symphonia/setup/templates/settings.rb +65 -0
  126. data/lib/generators/symphonia/setup/templates/spec_helper.rb +18 -0
  127. data/lib/symphonia/action_cable/connection.rb +31 -0
  128. data/lib/symphonia/admin_constraint.rb +9 -0
  129. data/lib/symphonia/attachable.rb +35 -0
  130. data/lib/symphonia/base_controller.rb +96 -0
  131. data/lib/symphonia/bootstrap_link_render.rb +69 -0
  132. data/lib/symphonia/controller_extensions.rb +200 -0
  133. data/lib/symphonia/engine.rb +137 -0
  134. data/lib/symphonia/form_builder.rb +137 -0
  135. data/lib/symphonia/menu_manager.rb +23 -0
  136. data/lib/symphonia/model_attributes/attribute.rb +137 -0
  137. data/lib/symphonia/model_attributes.rb +102 -0
  138. data/lib/symphonia/model_filters/base.rb +82 -0
  139. data/lib/symphonia/model_filters/boolean_filter.rb +26 -0
  140. data/lib/symphonia/model_filters/date_filter.rb +81 -0
  141. data/lib/symphonia/model_filters/integer_filter.rb +18 -0
  142. data/lib/symphonia/model_filters/select_filter.rb +48 -0
  143. data/lib/symphonia/model_filters/string_filter.rb +18 -0
  144. data/lib/symphonia/model_filters.rb +10 -0
  145. data/lib/symphonia/object.rb +31 -0
  146. data/lib/symphonia/permissions.rb +93 -0
  147. data/lib/symphonia/query.rb +275 -0
  148. data/lib/symphonia/query_columns/attribute_column.rb +43 -0
  149. data/lib/symphonia/query_columns/generic_column.rb +165 -0
  150. data/lib/symphonia/query_columns.rb +8 -0
  151. data/lib/symphonia/spec_helper.rb +4 -0
  152. data/lib/symphonia/user_management.rb +58 -0
  153. data/lib/symphonia/version.rb +4 -0
  154. data/lib/symphonia.rb +20 -0
  155. data/spec/controllers/account_controller_spec.rb +90 -0
  156. data/spec/controllers/admin_controller_spec.rb +35 -0
  157. data/spec/controllers/api_controller_spec.rb +9 -0
  158. data/spec/controllers/filters_controller_spec.rb +35 -0
  159. data/spec/controllers/images_controller_spec.rb +5 -0
  160. data/spec/controllers/login_controller_spec.rb +20 -0
  161. data/spec/controllers/roles_controller_spec.rb +12 -0
  162. data/spec/controllers/users_controller_spec.rb +47 -0
  163. data/spec/factories/factories.rb +52 -0
  164. data/spec/helpers/symphonia/application_helper_spec.rb +62 -0
  165. data/spec/mailers/previews/symphonia/notifier_preview.rb +27 -0
  166. data/spec/mailers/symphonia/notifier_spec.rb +76 -0
  167. data/spec/models/attachment_spec.rb +22 -0
  168. data/spec/models/query/attribute_spec.rb +8 -0
  169. data/spec/models/query/symphonia_query_spec.rb +70 -0
  170. data/spec/models/role_spec.rb +13 -0
  171. data/spec/models/user_spec.rb +10 -0
  172. data/spec/rails_helper.rb +13 -0
  173. data/spec/requests/accounts_spec.rb +118 -0
  174. data/spec/requests/attachments_controller_spec.rb +23 -0
  175. data/spec/requests/login_spec.rb +26 -0
  176. data/spec/requests/roles_spec.rb +10 -0
  177. data/spec/requests/users_spec.rb +50 -0
  178. data/spec/spec_helper.rb +101 -0
  179. data/spec/support/common_file.txt +2 -0
  180. data/spec/support/query.rb +36 -0
  181. data/spec/support/shared.rb +62 -0
  182. data/spec/support/shared_controllers.rb +31 -0
  183. data/spec/support/stub_users.rb +32 -0
  184. data/spec/support/symphonia.jpg +0 -0
  185. data/spec/support/wait_for_ajax.rb +15 -0
  186. data/spec/version_spec.rb +5 -0
  187. data/spec/views/filters/options.html.erb_spec.rb +14 -0
  188. metadata +697 -0
data/README.md ADDED
@@ -0,0 +1,16 @@
1
+ # Symphonia
2
+ > simple core toolkit for my rails apps
3
+
4
+ ## Installation
5
+
6
+ add to your Gemfile: `gem 'symphonia`, path: '$SYMPHONIA_PATH'
7
+
8
+ or
9
+
10
+ `gem 'symphonia', git: 'git@git.easy.cz:lukas/symphonia.git', branch: 'v2'`
11
+
12
+ after `bundle install` run post-installation: `rails g symphonia:setup`
13
+
14
+ > Setup prepare `config/initializers/settings.rb`, create `spec/spec_helper.rb`, add stylesheets and javascripts references and copy basic layout.
15
+
16
+
data/Rakefile ADDED
@@ -0,0 +1,44 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Symphonia'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+ load 'rails/tasks/statistics.rake'
22
+
23
+
24
+
25
+ require 'bundler/gem_tasks'
26
+
27
+ # require 'rake/testtask'
28
+ #
29
+ # Rake::TestTask.new(:test) do |t|
30
+ # t.libs << 'test'
31
+ # t.pattern = 'test/**/*_test.rb'
32
+ # t.verbose = false
33
+ # end
34
+ #
35
+ #
36
+ # task default: :test
37
+
38
+ require 'rspec/core'
39
+ require 'rspec/core/rake_task'
40
+
41
+ desc 'Run all specs in spec directory (excluding plugin specs)'
42
+ RSpec::Core::RakeTask.new(spec: 'app:db:test:prepare')
43
+
44
+ task default: :spec
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,232 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
3
+ * For licensing, see LICENSE.md or http://ckeditor.com/license
4
+ */
5
+
6
+ /**
7
+ * @fileOverview The Auto Grow plugin.
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ ( function() {
13
+ CKEDITOR.plugins.add( 'autogrow', {
14
+ init: function( editor ) {
15
+ // This feature is available only for themed ui instance.
16
+ if ( editor.elementMode == CKEDITOR.ELEMENT_MODE_INLINE )
17
+ return;
18
+
19
+ editor.on( 'instanceReady', function() {
20
+ // Simply set auto height with div wysiwyg.
21
+ if ( editor.editable().isInline() )
22
+ editor.ui.space( 'contents' ).setStyle( 'height', 'auto' );
23
+ // For classic (`iframe`-based) wysiwyg we need to resize the editor.
24
+ else
25
+ initIframeAutogrow( editor );
26
+ } );
27
+ }
28
+ } );
29
+
30
+ function initIframeAutogrow( editor ) {
31
+ var lastHeight,
32
+ doc,
33
+ markerContainer,
34
+ scrollable,
35
+ marker,
36
+ configBottomSpace = editor.config.autoGrow_bottomSpace || 0,
37
+ configMinHeight = editor.config.autoGrow_minHeight !== undefined ? editor.config.autoGrow_minHeight : 200,
38
+ configMaxHeight = editor.config.autoGrow_maxHeight || Infinity,
39
+ maxHeightIsUnlimited = !editor.config.autoGrow_maxHeight;
40
+
41
+ editor.addCommand( 'autogrow', {
42
+ exec: resizeEditor,
43
+ modes: { wysiwyg: 1 },
44
+ readOnly: 1,
45
+ canUndo: false,
46
+ editorFocus: false
47
+ } );
48
+
49
+ var eventsList = { contentDom: 1, key: 1, selectionChange: 1, insertElement: 1, mode: 1 };
50
+ for ( var eventName in eventsList ) {
51
+ editor.on( eventName, function( evt ) {
52
+ // Some time is required for insertHtml, and it gives other events better performance as well.
53
+ if ( evt.editor.mode == 'wysiwyg' ) {
54
+ setTimeout( function() {
55
+ if ( isNotResizable() ) {
56
+ lastHeight = null;
57
+ return;
58
+ }
59
+
60
+ resizeEditor();
61
+
62
+ // Second pass to make correction upon the first resize, e.g. scrollbar.
63
+ // If height is unlimited vertical scrollbar was removed in the first
64
+ // resizeEditor() call, so we don't need the second pass.
65
+ if ( !maxHeightIsUnlimited )
66
+ resizeEditor();
67
+ }, 100 );
68
+ }
69
+ } );
70
+ }
71
+
72
+ // Coordinate with the "maximize" plugin. (#9311)
73
+ editor.on( 'afterCommandExec', function( evt ) {
74
+ if ( evt.data.name == 'maximize' && evt.editor.mode == 'wysiwyg' ) {
75
+ if ( evt.data.command.state == CKEDITOR.TRISTATE_ON )
76
+ scrollable.removeStyle( 'overflow-y' );
77
+ else
78
+ resizeEditor();
79
+ }
80
+ } );
81
+
82
+ editor.on( 'contentDom', refreshCache );
83
+
84
+ refreshCache();
85
+
86
+ if ( editor.config.autoGrow_onStartup && editor.editable().isVisible() ) {
87
+ editor.execCommand( 'autogrow' );
88
+ }
89
+
90
+ function refreshCache() {
91
+ doc = editor.document;
92
+ markerContainer = doc[ CKEDITOR.env.ie ? 'getBody' : 'getDocumentElement' ]();
93
+
94
+ // Quirks mode overflows body, standards overflows document element.
95
+ scrollable = CKEDITOR.env.quirks ? doc.getBody() : doc.getDocumentElement();
96
+
97
+ // Reset scrollable body height and min-height css values.
98
+ // While set by outside code it may break resizing. (#14620)
99
+ var body = CKEDITOR.env.quirks ? scrollable : scrollable.findOne( 'body' );
100
+ if ( body ) {
101
+ body.setStyle( 'height', 'auto' );
102
+ body.setStyle( 'min-height', CKEDITOR.env.safari ? '0%' : 'auto' ); // Safari does not support 'min-height: auto'.
103
+ }
104
+
105
+ marker = CKEDITOR.dom.element.createFromHtml(
106
+ '<span style="margin:0;padding:0;border:0;clear:both;width:1px;height:1px;display:block;">' +
107
+ ( CKEDITOR.env.webkit ? '&nbsp;' : '' ) +
108
+ '</span>',
109
+ doc );
110
+ }
111
+
112
+ function isNotResizable() {
113
+ var maximizeCommand = editor.getCommand( 'maximize' );
114
+
115
+ return (
116
+ !editor.window ||
117
+ // Disable autogrow when the editor is maximized. (#6339)
118
+ maximizeCommand && maximizeCommand.state == CKEDITOR.TRISTATE_ON
119
+ );
120
+ }
121
+
122
+ // Actual content height, figured out by appending check the last element's document position.
123
+ function contentHeight() {
124
+ // Append a temporary marker element.
125
+ markerContainer.append( marker );
126
+ var height = marker.getDocumentPosition( doc ).y + marker.$.offsetHeight;
127
+ marker.remove();
128
+
129
+ return height;
130
+ }
131
+
132
+ function resizeEditor() {
133
+ // Hide scroll because we won't need it at all.
134
+ // Thanks to that we'll need only one resizeEditor() call per change.
135
+ if ( maxHeightIsUnlimited )
136
+ scrollable.setStyle( 'overflow-y', 'hidden' );
137
+
138
+ var currentHeight = editor.window.getViewPaneSize().height,
139
+ newHeight = contentHeight();
140
+
141
+ // Additional space specified by user.
142
+ newHeight += configBottomSpace;
143
+ newHeight = Math.max( newHeight, configMinHeight );
144
+ newHeight = Math.min( newHeight, configMaxHeight );
145
+
146
+ // #10196 Do not resize editor if new height is equal
147
+ // to the one set by previous resizeEditor() call.
148
+ if ( newHeight != currentHeight && lastHeight != newHeight ) {
149
+ newHeight = editor.fire( 'autoGrow', { currentHeight: currentHeight, newHeight: newHeight } ).newHeight;
150
+ editor.resize( editor.container.getStyle( 'width' ), newHeight, true );
151
+ lastHeight = newHeight;
152
+ }
153
+
154
+ if ( !maxHeightIsUnlimited ) {
155
+ if ( newHeight < configMaxHeight && scrollable.$.scrollHeight > scrollable.$.clientHeight )
156
+ scrollable.setStyle( 'overflow-y', 'hidden' );
157
+ else
158
+ scrollable.removeStyle( 'overflow-y' );
159
+ }
160
+ }
161
+ }
162
+ } )();
163
+
164
+ /**
165
+ * The minimum height that the editor can assume when adjusting to content by using the Auto Grow
166
+ * feature. This option accepts a value in pixels, without the unit (for example: `300`).
167
+ *
168
+ * Read more in the [documentation](#!/guide/dev_autogrow)
169
+ * and see the [SDK sample](http://sdk.ckeditor.com/samples/autogrow.html).
170
+ *
171
+ * config.autoGrow_minHeight = 300;
172
+ *
173
+ * @since 3.4
174
+ * @cfg {Number} [autoGrow_minHeight=200]
175
+ * @member CKEDITOR.config
176
+ */
177
+
178
+ /**
179
+ * The maximum height that the editor can assume when adjusting to content by using the Auto Grow
180
+ * feature. This option accepts a value in pixels, without the unit (for example: `600`).
181
+ * Zero (`0`) means that the maximum height is not limited and the editor will expand infinitely.
182
+ *
183
+ * Read more in the [documentation](#!/guide/dev_autogrow)
184
+ * and see the [SDK sample](http://sdk.ckeditor.com/samples/autogrow.html).
185
+ *
186
+ * config.autoGrow_maxHeight = 400;
187
+ *
188
+ * @since 3.4
189
+ * @cfg {Number} [autoGrow_maxHeight=0]
190
+ * @member CKEDITOR.config
191
+ */
192
+
193
+ /**
194
+ * Whether automatic editor height adjustment brought by the Auto Grow feature should happen on
195
+ * editor creation.
196
+ *
197
+ * Read more in the [documentation](#!/guide/dev_autogrow)
198
+ * and see the [SDK sample](http://sdk.ckeditor.com/samples/autogrow.html).
199
+ *
200
+ * config.autoGrow_onStartup = true;
201
+ *
202
+ * @since 3.6.2
203
+ * @cfg {Boolean} [autoGrow_onStartup=false]
204
+ * @member CKEDITOR.config
205
+ */
206
+
207
+ /**
208
+ * Extra vertical space to be added between the content and the editor bottom bar when adjusting
209
+ * editor height to content by using the Auto Grow feature. This option accepts a value in pixels,
210
+ * without the unit (for example: `50`).
211
+ *
212
+ * Read more in the [documentation](#!/guide/dev_autogrow)
213
+ * and see the [SDK sample](http://sdk.ckeditor.com/samples/autogrow.html).
214
+ *
215
+ * config.autoGrow_bottomSpace = 50;
216
+ *
217
+ * @since 3.6.2
218
+ * @cfg {Number} [autoGrow_bottomSpace=0]
219
+ * @member CKEDITOR.config
220
+ */
221
+
222
+ /**
223
+ * Fired when the Auto Grow plugin is about to change the size of the editor.
224
+ *
225
+ * @event autogrow
226
+ * @member CKEDITOR.editor
227
+ * @param {CKEDITOR.editor} editor This editor instance.
228
+ * @param data
229
+ * @param {Number} data.currentHeight The current editor height (before resizing).
230
+ * @param {Number} data.newHeight The new editor height (after resizing). It can be changed
231
+ * to achieve a different height value to be used instead.
232
+ */
@@ -0,0 +1,102 @@
1
+ <!DOCTYPE html>
2
+ <!--
3
+ Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
4
+ For licensing, see LICENSE.md or http://ckeditor.com/license
5
+ -->
6
+ <html>
7
+ <head>
8
+ <meta charset="utf-8">
9
+ <title>AutoGrow Plugin &mdash; CKEditor Sample</title>
10
+ <script src="../../../ckeditor.js"></script>
11
+ <link rel="stylesheet" href="../../../samples/old/sample.css">
12
+ <meta name="ckeditor-sample-name" content="AutoGrow plugin">
13
+ <meta name="ckeditor-sample-group" content="Plugins">
14
+ <meta name="ckeditor-sample-description" content="Using the AutoGrow plugin in order to make the editor grow to fit the size of its content.">
15
+ </head>
16
+ <body>
17
+ <h1 class="samples">
18
+ <a href="../../../samples/old/index.html">CKEditor Samples</a> &raquo; Using AutoGrow Plugin
19
+ </h1>
20
+ <div class="warning deprecated">
21
+ This sample is not maintained anymore. Check out its <a href="http://sdk.ckeditor.com/samples/autogrow.html">brand new version in CKEditor SDK</a>.
22
+ </div>
23
+ <div class="description">
24
+ <p>
25
+ This sample shows how to configure CKEditor instances to use the
26
+ <strong>AutoGrow</strong> (<code>autogrow</code>) plugin that lets the editor window expand
27
+ and shrink depending on the amount and size of content entered in the editing area.
28
+ </p>
29
+ <p>
30
+ In its default implementation the <strong>AutoGrow feature</strong> can expand the
31
+ CKEditor window infinitely in order to avoid introducing scrollbars to the editing area.
32
+ </p>
33
+ <p>
34
+ It is also possible to set a maximum height for the editor window. Once CKEditor
35
+ editing area reaches the value in pixels specified in the
36
+ <code><a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-autoGrow_maxHeight">autoGrow_maxHeight</a></code>
37
+ configuration setting, scrollbars will be added and the editor window will no longer expand.
38
+ </p>
39
+ <p>
40
+ To add a CKEditor instance using the <code>autogrow</code> plugin and its
41
+ <code>autoGrow_maxHeight</code> attribute, insert the following JavaScript call to your code:
42
+ </p>
43
+ <pre class="samples">
44
+ CKEDITOR.replace( '<em>textarea_id</em>', {
45
+ <strong>extraPlugins: 'autogrow',</strong>
46
+ autoGrow_maxHeight: 800,
47
+
48
+ // Remove the Resize plugin as it does not make sense to use it in conjunction with the AutoGrow plugin.
49
+ removePlugins: 'resize'
50
+ });</pre>
51
+ <p>
52
+ Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
53
+ the <code>&lt;textarea&gt;</code> element to be replaced with CKEditor. The maximum height should
54
+ be given in pixels.
55
+ </p>
56
+ </div>
57
+ <form action="../../../samples/sample_posteddata.php" method="post">
58
+ <p>
59
+ <label for="editor1">
60
+ CKEditor using the <code>autogrow</code> plugin with its default configuration:
61
+ </label>
62
+ <textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
63
+ <script>
64
+
65
+ CKEDITOR.replace( 'editor1', {
66
+ extraPlugins: 'autogrow',
67
+ removePlugins: 'resize'
68
+ });
69
+
70
+ </script>
71
+ </p>
72
+ <p>
73
+ <label for="editor2">
74
+ CKEditor using the <code>autogrow</code> plugin with maximum height set to 400 pixels:
75
+ </label>
76
+ <textarea cols="80" id="editor2" name="editor2" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
77
+ <script>
78
+
79
+ CKEDITOR.replace( 'editor2', {
80
+ extraPlugins: 'autogrow',
81
+ autoGrow_maxHeight: 400,
82
+ removePlugins: 'resize'
83
+ });
84
+
85
+ </script>
86
+ </p>
87
+ <p>
88
+ <input type="submit" value="Submit">
89
+ </p>
90
+ </form>
91
+ <div id="footer">
92
+ <hr>
93
+ <p>
94
+ CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
95
+ </p>
96
+ <p id="copy">
97
+ Copyright &copy; 2003-2016, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
98
+ Knabben. All rights reserved.
99
+ </p>
100
+ </div>
101
+ </body>
102
+ </html>
@@ -0,0 +1,15 @@
1
+ CKEDITOR.plugins.add('image_chooser', {
2
+ icons: 'addimage',
3
+ init: function (editor) {
4
+ editor.addCommand('addImageDialog', {
5
+ exec: function (editor) {
6
+ $.get(editor.element.$.dataset.addImageUrl)
7
+ }
8
+ });
9
+ editor.ui.addButton('AddImage', {
10
+ label: 'Add Image from gallery',
11
+ command: 'addImageDialog',
12
+ toolbar: 'basic'
13
+ });
14
+ }
15
+ });