ckeditor 3.5.4 → 3.6.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +23 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +96 -97
- data/Rakefile +16 -33
- data/app/controllers/ckeditor/attachment_files_controller.rb +4 -4
- data/app/controllers/ckeditor/base_controller.rb +15 -42
- data/app/controllers/ckeditor/pictures_controller.rb +3 -3
- data/app/views/ckeditor/attachment_files/index.html.erb +13 -51
- data/app/views/ckeditor/pictures/index.html.erb +14 -52
- data/app/views/ckeditor/shared/_asset.html.erb +19 -0
- data/app/views/ckeditor/shared/_asset_tmpl.html.erb +21 -0
- data/app/views/layouts/ckeditor.html.erb +16 -23
- data/config/locales/en.ckeditor.yml +3 -7
- data/config/locales/ru.ckeditor.yml +4 -8
- data/config/locales/uk.ckeditor.yml +4 -8
- data/config/routes.rb +3 -3
- data/lib/ckeditor.rb +30 -79
- data/lib/ckeditor/engine.rb +14 -13
- data/lib/ckeditor/helpers/controllers.rb +30 -0
- data/lib/ckeditor/helpers/form_builder.rb +11 -0
- data/lib/ckeditor/helpers/form_helper.rb +25 -0
- data/lib/ckeditor/helpers/view_helper.rb +19 -0
- data/lib/ckeditor/http.rb +81 -0
- data/lib/ckeditor/orm/active_record.rb +91 -0
- data/lib/ckeditor/utils.rb +51 -70
- data/lib/ckeditor/version.rb +2 -7
- data/lib/generators/ckeditor/install_generator.rb +62 -0
- data/lib/generators/ckeditor/models_generator.rb +51 -0
- data/lib/generators/ckeditor/templates/ckeditor.rb +18 -0
- data/lib/generators/ckeditor/templates/ckeditor/config.js +52 -0
- data/lib/generators/ckeditor/templates/ckeditor/filebrowser/images/gal_add.jpg +0 -0
- data/lib/generators/ckeditor/templates/ckeditor/filebrowser/images/gal_add.png +0 -0
- data/lib/generators/ckeditor/templates/ckeditor/filebrowser/images/gal_del.png +0 -0
- data/lib/generators/ckeditor/templates/ckeditor/filebrowser/images/gal_more.gif +0 -0
- data/lib/generators/ckeditor/templates/ckeditor/filebrowser/images/preloader.gif +0 -0
- data/lib/generators/ckeditor/{base/templates/ckeditor/images → templates/ckeditor/filebrowser/images/thumbs}/ckfnothumb.gif +0 -0
- data/lib/generators/ckeditor/{base/templates/ckeditor/images → templates/ckeditor/filebrowser/images/thumbs}/mp3.gif +0 -0
- data/lib/generators/ckeditor/{base/templates/ckeditor/images → templates/ckeditor/filebrowser/images/thumbs}/pdf.gif +0 -0
- data/lib/generators/ckeditor/{base/templates/ckeditor/images → templates/ckeditor/filebrowser/images/thumbs}/rar.gif +0 -0
- data/lib/generators/ckeditor/{base/templates/ckeditor/images → templates/ckeditor/filebrowser/images/thumbs}/swf.gif +0 -0
- data/lib/generators/ckeditor/{base/templates/ckeditor/images → templates/ckeditor/filebrowser/images/thumbs}/xls.gif +0 -0
- data/lib/generators/ckeditor/templates/ckeditor/filebrowser/javascripts/application.js +222 -0
- data/lib/generators/ckeditor/templates/ckeditor/filebrowser/stylesheets/uploader.css +112 -0
- data/lib/generators/ckeditor/{base/templates → templates}/ckeditor/plugins/attachment/dialogs/attachment.js +0 -0
- data/lib/generators/ckeditor/{base/templates/ckeditor/_source → templates/ckeditor}/plugins/attachment/images/attachment.png +0 -0
- data/lib/generators/ckeditor/{base/templates/ckeditor/_source → templates/ckeditor}/plugins/attachment/lang/en.js +0 -0
- data/lib/generators/ckeditor/{base/templates/ckeditor/_source → templates/ckeditor}/plugins/attachment/lang/ru.js +0 -0
- data/lib/generators/ckeditor/{base/templates/ckeditor/_source → templates/ckeditor}/plugins/attachment/lang/uk.js +0 -0
- data/lib/generators/ckeditor/{base/templates → templates}/ckeditor/plugins/attachment/plugin.js +0 -0
- data/lib/generators/ckeditor/{base/templates → templates}/ckeditor/plugins/embed/dialogs/embed.js +0 -0
- data/lib/generators/ckeditor/{base/templates/ckeditor/_source → templates/ckeditor}/plugins/embed/images/embed.png +0 -0
- data/lib/generators/ckeditor/{base/templates/ckeditor/_source → templates/ckeditor}/plugins/embed/lang/en.js +0 -0
- data/lib/generators/ckeditor/{base/templates/ckeditor/_source → templates/ckeditor}/plugins/embed/lang/ru.js +0 -0
- data/lib/generators/ckeditor/{base/templates/ckeditor/_source → templates/ckeditor}/plugins/embed/lang/uk.js +0 -0
- data/lib/generators/ckeditor/{base/templates → templates}/ckeditor/plugins/embed/plugin.js +0 -0
- data/lib/generators/ckeditor/templates/models/active_record/asset.rb +7 -0
- data/lib/generators/ckeditor/templates/models/active_record/attachment_file.rb +15 -0
- data/lib/generators/ckeditor/{migration/templates/models/paperclip → templates/models/active_record}/migration.rb +3 -8
- data/lib/generators/ckeditor/templates/models/active_record/picture.rb +13 -0
- data/test/ckeditor_test.rb +13 -0
- data/test/controllers/attachment_files_controller_test.rb +52 -0
- data/test/controllers/pictures_controller_test.rb +52 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/controllers/application_controller.rb +4 -0
- data/test/dummy/app/controllers/posts_controller.rb +83 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/helpers/posts_helper.rb +2 -0
- data/test/dummy/app/models/ckeditor/asset.rb +7 -0
- data/test/dummy/app/models/ckeditor/attachment_file.rb +15 -0
- data/test/dummy/app/models/ckeditor/picture.rb +13 -0
- data/test/dummy/app/models/post.rb +3 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/posts/_form.html.erb +30 -0
- data/test/dummy/app/views/posts/edit.html.erb +6 -0
- data/test/dummy/app/views/posts/index.html.erb +27 -0
- data/test/dummy/app/views/posts/new.html.erb +5 -0
- data/test/dummy/app/views/posts/show.html.erb +5 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +46 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +34 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +26 -0
- data/test/dummy/config/environments/production.rb +49 -0
- data/test/dummy/config/environments/test.rb +35 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/ckeditor.rb +18 -0
- data/test/dummy/config/initializers/inflections.rb +10 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/db/migrate/20110623120047_create_posts.rb +14 -0
- data/test/dummy/db/migrate/20110705195648_create_ckeditor_assets.rb +26 -0
- data/test/dummy/db/schema.rb +36 -0
- data/test/dummy/log/development.log +818 -0
- data/test/dummy/log/production.log +0 -0
- data/test/dummy/log/server.log +0 -0
- data/test/dummy/log/test.log +5398 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +26 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/public/javascripts/application.js +2 -0
- data/test/dummy/public/javascripts/controls.js +965 -0
- data/test/dummy/public/javascripts/dragdrop.js +974 -0
- data/test/dummy/public/javascripts/effects.js +1123 -0
- data/test/dummy/public/javascripts/prototype.js +6001 -0
- data/test/dummy/public/javascripts/rails.js +191 -0
- data/test/dummy/public/stylesheets/scaffold.css +56 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/test/fixtures/files/rails.png +0 -0
- data/test/dummy/test/fixtures/files/rails.tar.gz +0 -0
- data/test/generators/install_generator_test.rb +18 -0
- data/test/generators/models_generator_test.rb +21 -0
- data/test/integration/navigation_test.rb +7 -0
- data/test/integration/posts_test.rb +41 -0
- data/test/routes_test.rb +47 -0
- data/test/support/integration_case.rb +5 -0
- data/test/test_helper.rb +28 -0
- data/test/tmp/app/models/ckeditor/asset.rb +7 -0
- data/test/tmp/app/models/ckeditor/attachment_file.rb +15 -0
- data/test/tmp/app/models/ckeditor/picture.rb +13 -0
- data/test/tmp/db/migrate/20110711170413_create_ckeditor_assets.rb +26 -0
- metadata +220 -99
- data/CHANGELOG +0 -15
- data/app/helpers/ckeditor/base_helper.rb +0 -21
- data/app/views/ckeditor/_asset.html.erb +0 -20
- data/app/views/ckeditor/_swfupload.html.erb +0 -73
- data/lib/ckeditor/form_builder.rb +0 -22
- data/lib/ckeditor/middleware.rb +0 -18
- data/lib/ckeditor/view_helper.rb +0 -92
- data/lib/generators/ckeditor/base/USAGE +0 -9
- data/lib/generators/ckeditor/base/base_generator.rb +0 -41
- data/lib/generators/ckeditor/base/templates/ckeditor.rb +0 -54
- data/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/attachment/dialogs/attachment.js +0 -384
- data/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/attachment/plugin.js +0 -44
- data/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/embed/dialogs/embed.js +0 -65
- data/lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/embed/plugin.js +0 -43
- data/lib/generators/ckeditor/base/templates/ckeditor/config.js +0 -43
- data/lib/generators/ckeditor/base/templates/ckeditor/css/ckfinder.css +0 -316
- data/lib/generators/ckeditor/base/templates/ckeditor/css/fck_dialog.css +0 -119
- data/lib/generators/ckeditor/base/templates/ckeditor/css/fck_editor.css +0 -448
- data/lib/generators/ckeditor/base/templates/ckeditor/css/swfupload.css +0 -94
- data/lib/generators/ckeditor/base/templates/ckeditor/images/add.gif +0 -0
- data/lib/generators/ckeditor/base/templates/ckeditor/images/cancelbutton.gif +0 -0
- data/lib/generators/ckeditor/base/templates/ckeditor/images/doc.gif +0 -0
- data/lib/generators/ckeditor/base/templates/ckeditor/images/refresh.gif +0 -0
- data/lib/generators/ckeditor/base/templates/ckeditor/images/select_files.png +0 -0
- data/lib/generators/ckeditor/base/templates/ckeditor/images/spacer.gif +0 -0
- data/lib/generators/ckeditor/base/templates/ckeditor/images/toolbar.start.gif +0 -0
- data/lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/images/attachment.png +0 -0
- data/lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/lang/en.js +0 -10
- data/lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/lang/ru.js +0 -10
- data/lib/generators/ckeditor/base/templates/ckeditor/plugins/attachment/lang/uk.js +0 -10
- data/lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/images/embed.png +0 -0
- data/lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/lang/en.js +0 -9
- data/lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/lang/ru.js +0 -9
- data/lib/generators/ckeditor/base/templates/ckeditor/plugins/embed/lang/uk.js +0 -9
- data/lib/generators/ckeditor/base/templates/ckeditor/swfupload/fileprogress.js +0 -266
- data/lib/generators/ckeditor/base/templates/ckeditor/swfupload/handlers.js +0 -181
- data/lib/generators/ckeditor/base/templates/ckeditor/swfupload/jquery-1.5.1.min.js +0 -16
- data/lib/generators/ckeditor/base/templates/ckeditor/swfupload/querystring.js +0 -40
- data/lib/generators/ckeditor/base/templates/ckeditor/swfupload/rails.js +0 -158
- data/lib/generators/ckeditor/base/templates/ckeditor/swfupload/swfupload.js +0 -1
- data/lib/generators/ckeditor/base/templates/ckeditor/swfupload/swfupload.queue.js +0 -1
- data/lib/generators/ckeditor/base/templates/ckeditor/swfupload/swfupload.swf +0 -0
- data/lib/generators/ckeditor/base/templates/ckeditor/swfupload/swfupload.swfobject.js +0 -111
- data/lib/generators/ckeditor/migration/USAGE +0 -12
- data/lib/generators/ckeditor/migration/migration_generator.rb +0 -46
- data/lib/generators/ckeditor/migration/templates/models/attachment_fu/asset.rb +0 -32
- data/lib/generators/ckeditor/migration/templates/models/attachment_fu/attachment_file.rb +0 -24
- data/lib/generators/ckeditor/migration/templates/models/attachment_fu/migration.rb +0 -30
- data/lib/generators/ckeditor/migration/templates/models/attachment_fu/picture.rb +0 -25
- data/lib/generators/ckeditor/migration/templates/models/paperclip/asset.rb +0 -97
- data/lib/generators/ckeditor/migration/templates/models/paperclip/attachment_file.rb +0 -40
- data/lib/generators/ckeditor/migration/templates/models/paperclip/picture.rb +0 -23
- data/lib/tasks/ckeditor_tasks.rake +0 -3
@@ -1,12 +1,12 @@
|
|
1
1
|
class Ckeditor::PicturesController < Ckeditor::BaseController
|
2
2
|
|
3
3
|
def index
|
4
|
-
@pictures = Ckeditor.
|
4
|
+
@pictures = Ckeditor.picture_model.find_all(ckeditor_pictures_scope)
|
5
5
|
respond_with(@pictures)
|
6
6
|
end
|
7
7
|
|
8
8
|
def create
|
9
|
-
@picture = Ckeditor.
|
9
|
+
@picture = Ckeditor::Picture.new
|
10
10
|
respond_with_asset(@picture)
|
11
11
|
end
|
12
12
|
|
@@ -18,6 +18,6 @@ class Ckeditor::PicturesController < Ckeditor::BaseController
|
|
18
18
|
protected
|
19
19
|
|
20
20
|
def find_asset
|
21
|
-
@picture = Ckeditor.
|
21
|
+
@picture = Ckeditor.picture_model.get!(params[:id])
|
22
22
|
end
|
23
23
|
end
|
@@ -1,53 +1,15 @@
|
|
1
|
+
<div id="fileupload" class="gal-holder">
|
2
|
+
<div class="gal-item">
|
3
|
+
<div class="fileupload-button gal-upload-holder">
|
4
|
+
<%= link_to I18n.t(:upload, :scope => [:ckeditor, :buttons]), '#', :class => "add" %>
|
5
|
+
</div>
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<div class="fileupload-list">
|
9
|
+
<%= render :partial => 'ckeditor/shared/asset', :collection => @attachments %>
|
10
|
+
</div>
|
11
|
+
</div>
|
12
|
+
|
1
13
|
<script type="text/javascript">
|
2
|
-
|
14
|
+
<%= Ckeditor::Utils.js_fileuploader('attachments') %>
|
3
15
|
</script>
|
4
|
-
|
5
|
-
<table width="100%" cellspacing="0" cellpadding="0">
|
6
|
-
<tbody>
|
7
|
-
<tr>
|
8
|
-
<td class="TB_ToolbarSet" id="nv"></td>
|
9
|
-
</tr>
|
10
|
-
|
11
|
-
<tr id="fj" style='display:none;'>
|
12
|
-
<td style="white-space: normal;" class="FCKUploadArea">
|
13
|
-
<div class="PopupTitle">
|
14
|
-
<span><%= I18n.t('upload_files', :scope => [:ckeditor]) %></span>
|
15
|
-
</div>
|
16
|
-
<div id="cY">
|
17
|
-
<table cellspacing="0" cellpadding="0" style="padding: 10px;">
|
18
|
-
<tbody>
|
19
|
-
<tr>
|
20
|
-
<td>
|
21
|
-
<span id='spanButtonPlaceholder'></span>
|
22
|
-
<div id="divFileProgressContainer" style="clear:both;"></div>
|
23
|
-
|
24
|
-
<%= render :partial => "ckeditor/swfupload" %>
|
25
|
-
</td>
|
26
|
-
</tr>
|
27
|
-
</tbody>
|
28
|
-
</table>
|
29
|
-
<div class="PopupButtons">
|
30
|
-
<div style="width: 100%;">
|
31
|
-
<table width="100%" cellspacing="0" cellpadding="0">
|
32
|
-
<tbody><tr>
|
33
|
-
<td width="100%"></td>
|
34
|
-
<td nowrap="nowrap">
|
35
|
-
<button onclick="uploadButton()" class="Button"><span ckf:lang="CancelBtn"><%= I18n.t('cancel', :scope => [:ckeditor, :buttons]) %></span></button>
|
36
|
-
</td>
|
37
|
-
</tr>
|
38
|
-
</tbody></table>
|
39
|
-
</div>
|
40
|
-
</div>
|
41
|
-
</div>
|
42
|
-
</td>
|
43
|
-
</tr>
|
44
|
-
|
45
|
-
<tr>
|
46
|
-
<td style="height: 100%;" id="qu">
|
47
|
-
<div style="overflow:auto; height:550px;" id='container'>
|
48
|
-
<%= render :partial => "ckeditor/asset", :collection => @attachments, :as => :asset %>
|
49
|
-
</div>
|
50
|
-
</td>
|
51
|
-
</tr>
|
52
|
-
</tbody>
|
53
|
-
</table>
|
@@ -1,53 +1,15 @@
|
|
1
|
-
<
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
<div id="fileupload" class="gal-holder">
|
2
|
+
<div class="gal-item">
|
3
|
+
<div class="fileupload-button gal-upload-holder">
|
4
|
+
<%= link_to I18n.t(:upload, :scope => [:ckeditor, :buttons]), '#', :class => "add" %>
|
5
|
+
</div>
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<div class="fileupload-list">
|
9
|
+
<%= render :partial => 'ckeditor/shared/asset', :collection => @pictures %>
|
10
|
+
</div>
|
11
|
+
</div>
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
<span><%= I18n.t('upload_files', :scope => [:ckeditor]) %></span>
|
15
|
-
</div>
|
16
|
-
<div id="cY">
|
17
|
-
<table cellspacing="0" cellpadding="0" style="padding: 10px;">
|
18
|
-
<tbody>
|
19
|
-
<tr>
|
20
|
-
<td>
|
21
|
-
<span id='spanButtonPlaceholder'></span>
|
22
|
-
<div id="divFileProgressContainer" style="clear:both;"></div>
|
23
|
-
|
24
|
-
<%= render :partial => "ckeditor/swfupload" %>
|
25
|
-
</td>
|
26
|
-
</tr>
|
27
|
-
</tbody>
|
28
|
-
</table>
|
29
|
-
<div class="PopupButtons">
|
30
|
-
<div style="width: 100%;">
|
31
|
-
<table width="100%" cellspacing="0" cellpadding="0">
|
32
|
-
<tbody><tr>
|
33
|
-
<td width="100%"></td>
|
34
|
-
<td nowrap="nowrap">
|
35
|
-
<button onclick="uploadButton()" class="Button"><span ckf:lang="CancelBtn"><%= I18n.t('cancel', :scope => [:ckeditor, :buttons]) %></span></button>
|
36
|
-
</td>
|
37
|
-
</tr>
|
38
|
-
</tbody></table>
|
39
|
-
</div>
|
40
|
-
</div>
|
41
|
-
</div>
|
42
|
-
</td>
|
43
|
-
</tr>
|
44
|
-
|
45
|
-
<tr>
|
46
|
-
<td style="height: 100%;" id="qu">
|
47
|
-
<div style="overflow:auto; height:550px;" id='container'>
|
48
|
-
<%= render :partial => "ckeditor/asset", :collection => @pictures, :as => :asset %>
|
49
|
-
</div>
|
50
|
-
</td>
|
51
|
-
</tr>
|
52
|
-
</tbody>
|
53
|
-
</table>
|
13
|
+
<script type="text/javascript">
|
14
|
+
<%= Ckeditor::Utils.js_fileuploader('image') %>
|
15
|
+
</script>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%= content_tag(:div, :id => dom_id(asset), :class => "gal-item", :"data-url" => asset.url_content) do %>
|
2
|
+
<%= link_to image_tag("/javascripts/ckeditor/filebrowser/images/gal_del.png", :title => I18n.t('ckeditor.buttons.delete')),
|
3
|
+
polymorphic_path(asset, :format => :json),
|
4
|
+
:remote => true,
|
5
|
+
:method => :delete,
|
6
|
+
:confirm => t('ckeditor.confirm_delete'),
|
7
|
+
:class => "fileupload-cancel gal-del" %>
|
8
|
+
|
9
|
+
<div class="fileupload-file gal-inner-holder">
|
10
|
+
<div class="img"><%= image_tag(asset.url_thumb, :title => asset.filename) %></div>
|
11
|
+
<div class="img-data">
|
12
|
+
<div class="img-name"><%= asset.filename %></div>
|
13
|
+
<div class="time-size">
|
14
|
+
<div class="time"><%= asset.format_created_at %></div>
|
15
|
+
<div class="fileupload-size size"><%= number_to_human_size(asset.size) %></div>
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
<% end %>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<script id="fileupload_tmpl" type="text/x-jquery-tmpl">
|
2
|
+
<div id="asset_${id}" class="gal-item" data-url="${url_content}">
|
3
|
+
<%= link_to image_tag("/javascripts/ckeditor/filebrowser/images/gal_del.png", :title => I18n.t('ckeditor.buttons.delete')),
|
4
|
+
"/ckeditor/${controller}/${id}.json",
|
5
|
+
:remote => true,
|
6
|
+
:method => :delete,
|
7
|
+
:confirm => t('ckeditor.confirm_delete'),
|
8
|
+
:class => "fileupload-cancel gal-del" %>
|
9
|
+
|
10
|
+
<div class="fileupload-file gal-inner-holder">
|
11
|
+
<div class="img"><img src="${url_thumb}" title="${filename}"></div>
|
12
|
+
<div class="img-data">
|
13
|
+
<div class="img-name">${filename}</div>
|
14
|
+
<div class="time-size">
|
15
|
+
<div class="time">${format_created_at}</div>
|
16
|
+
<div class="fileupload-size size">${size}</div>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
</script>
|
@@ -1,32 +1,25 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
1
2
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
2
3
|
<head>
|
3
|
-
|
4
|
-
|
5
|
-
<meta name="robots" content="noindex, nofollow">
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
5
|
+
<meta name="robots" content="noindex, nofollow">
|
6
6
|
<%= csrf_meta_tag %>
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
<script src="/javascripts/ckeditor/swfupload/swfupload.js" type="text/javascript"></script>
|
15
|
-
<script src="/javascripts/ckeditor/swfupload/swfupload.queue.js" type="text/javascript"></script>
|
16
|
-
<script src="/javascripts/ckeditor/swfupload/fileprogress.js" type="text/javascript"></script>
|
17
|
-
<script src="/javascripts/ckeditor/swfupload/handlers.js" type="text/javascript"></script>
|
18
|
-
<script src="/javascripts/ckeditor/swfupload/querystring.js" type="text/javascript"></script>
|
19
|
-
<script src="/javascripts/ckeditor/swfupload/rails.js" type="text/javascript"></script>
|
20
|
-
|
7
|
+
<title><%= I18n.t('page_title', :scope => [:ckeditor]) %></title>
|
8
|
+
<link href="/javascripts/ckeditor/filebrowser/stylesheets/uploader.css" type="text/css" rel="stylesheet">
|
9
|
+
<script src="/javascripts/ckeditor/filebrowser/javascripts/jquery.js" type="text/javascript"></script>
|
10
|
+
<script src="/javascripts/ckeditor/filebrowser/javascripts/jquery.tmpl.js" type="text/javascript"></script>
|
11
|
+
<script src="/javascripts/ckeditor/filebrowser/javascripts/fileuploader.js" type="text/javascript"></script>
|
12
|
+
<script src="/javascripts/ckeditor/filebrowser/javascripts/rails.js" type="text/javascript"></script>
|
13
|
+
<script src="/javascripts/ckeditor/filebrowser/javascripts/application.js" type="text/javascript"></script>
|
21
14
|
<script type="text/javascript">
|
22
|
-
|
23
|
-
var
|
24
|
-
var CKEditorName = params.get("CKEditor");
|
15
|
+
var CKEditorFuncNum = $.QueryString["CKEditorFuncNum"];
|
16
|
+
var CKEditorName = $.QueryString["CKEditor"];
|
25
17
|
var CKEDITOR = window.opener.CKEDITOR;
|
26
|
-
var
|
18
|
+
var EDITOR = CKEDITOR.instances[CKEditorName];
|
27
19
|
</script>
|
28
20
|
</head>
|
29
|
-
<body
|
30
|
-
|
21
|
+
<body>
|
22
|
+
<%= yield %>
|
23
|
+
<%= render :partial => 'ckeditor/shared/asset_tmpl' %>
|
31
24
|
</body>
|
32
25
|
</html>
|
@@ -1,12 +1,8 @@
|
|
1
1
|
en:
|
2
2
|
ckeditor:
|
3
3
|
page_title: "CKEditor Files Manager"
|
4
|
-
|
4
|
+
confirm_delete: "Delete file?"
|
5
5
|
buttons:
|
6
6
|
cancel: "Cancel"
|
7
|
-
|
8
|
-
|
9
|
-
hint: "Refresh page"
|
10
|
-
upload:
|
11
|
-
title: "Upload"
|
12
|
-
hint: "Upload New File"
|
7
|
+
upload: "Upload"
|
8
|
+
delete: "Delete"
|
@@ -1,12 +1,8 @@
|
|
1
1
|
ru:
|
2
2
|
ckeditor:
|
3
|
-
page_title: "CKEditor
|
4
|
-
|
3
|
+
page_title: "CKEditor Загрузка файлов"
|
4
|
+
confirm_delete: "Удалить файл?"
|
5
5
|
buttons:
|
6
6
|
cancel: "Отмена"
|
7
|
-
|
8
|
-
|
9
|
-
hint: "Обновить страницу"
|
10
|
-
upload:
|
11
|
-
title: "Загрузить"
|
12
|
-
hint: "Загрузить файл"
|
7
|
+
upload: "Загрузить"
|
8
|
+
delete: "Удалить"
|
@@ -1,12 +1,8 @@
|
|
1
1
|
uk:
|
2
2
|
ckeditor:
|
3
|
-
page_title: "CKEditor
|
4
|
-
|
3
|
+
page_title: "CKEditor Завантаження файлів"
|
4
|
+
confirm_delete: "Видалити файл?"
|
5
5
|
buttons:
|
6
6
|
cancel: "Відміна"
|
7
|
-
|
8
|
-
|
9
|
-
hint: "Оновити сторінку"
|
10
|
-
upload:
|
11
|
-
title: "Завантажити"
|
12
|
-
hint: "Завантажити новий файл"
|
7
|
+
upload: "Завантажити"
|
8
|
+
delete: "Видалити"
|
data/config/routes.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
|
-
namespace :ckeditor do
|
3
|
-
resources :pictures
|
4
|
-
resources :attachment_files
|
2
|
+
namespace :ckeditor, :only => [:index, :create, :destroy] do
|
3
|
+
resources :pictures
|
4
|
+
resources :attachment_files
|
5
5
|
end
|
6
6
|
end
|
data/lib/ckeditor.rb
CHANGED
@@ -1,96 +1,47 @@
|
|
1
|
+
require 'orm_adapter'
|
2
|
+
|
1
3
|
module Ckeditor
|
2
|
-
autoload :ViewHelper, 'ckeditor/view_helper'
|
3
|
-
autoload :FormBuilder, 'ckeditor/form_builder'
|
4
|
-
autoload :Middleware, 'ckeditor/middleware'
|
5
|
-
autoload :Utils, 'ckeditor/utils'
|
6
|
-
|
7
|
-
module Hooks
|
8
|
-
autoload :FormtasticBuilder, 'ckeditor/hooks/formtastic'
|
9
|
-
autoload :SimpleFormBuilder, 'ckeditor/hooks/simple_form'
|
10
|
-
end
|
11
|
-
|
12
|
-
mattr_accessor :swf_file_post_name
|
13
|
-
@@swf_file_post_name = "data"
|
14
|
-
|
15
|
-
mattr_accessor :swf_image_file_types_description
|
16
|
-
@@swf_image_file_types_description = "Images"
|
17
|
-
|
18
|
-
mattr_accessor :swf_image_file_types
|
19
|
-
@@swf_image_file_types = "*.jpg;*.jpeg;*.png;*.gif"
|
20
|
-
|
21
|
-
mattr_accessor :swf_image_file_size_limit
|
22
|
-
@@swf_image_file_size_limit = "5 MB"
|
23
|
-
|
24
|
-
mattr_accessor :swf_image_file_upload_limit
|
25
|
-
@@swf_image_file_upload_limit = 10
|
26
|
-
|
27
|
-
mattr_accessor :swf_file_types_description
|
28
|
-
@@swf_file_types_description = "Files"
|
29
|
-
|
30
|
-
mattr_accessor :swf_file_types
|
31
|
-
@@swf_file_types = "*.doc;*.wpd;*.pdf;*.swf;*.xls"
|
32
|
-
|
33
|
-
mattr_accessor :swf_file_size_limit
|
34
|
-
@@swf_file_size_limit = "10 MB"
|
35
|
-
|
36
|
-
mattr_accessor :swf_file_upload_limit
|
37
|
-
@@swf_file_file_upload_limit = 5
|
38
|
-
|
39
|
-
mattr_accessor :public_uri
|
40
|
-
@@public_uri = "/uploads"
|
41
|
-
|
42
|
-
mattr_accessor :public_path
|
43
|
-
@@public_path = "public/uploads"
|
44
|
-
|
45
|
-
mattr_accessor :file_manager_uri
|
46
|
-
@@file_manager_uri = "/ckeditor/attachment_files"
|
47
|
-
|
48
|
-
mattr_accessor :file_manager_upload_uri
|
49
|
-
@@file_manager_upload_uri = "/ckeditor/attachment_files"
|
50
|
-
|
51
|
-
mattr_accessor :file_manager_image_upload_uri
|
52
|
-
@@file_manager_image_upload_uri = "/ckeditor/pictures"
|
53
|
-
|
54
|
-
mattr_accessor :file_manager_image_uri
|
55
|
-
@@file_manager_image_uri = "/ckeditor/pictures"
|
56
|
-
|
57
4
|
IMAGE_TYPES = ['image/jpeg', 'image/png', 'image/gif', 'image/jpg', 'image/pjpeg', 'image/tiff', 'image/x-png']
|
58
5
|
|
59
|
-
|
60
|
-
|
61
|
-
if self.class_variables.include?('@@image_model_ref')
|
62
|
-
@@image_model_ref.get
|
63
|
-
else
|
64
|
-
self.file_manager_image_model = "Ckeditor::Picture"
|
65
|
-
@@image_model_ref.get
|
66
|
-
end
|
67
|
-
end
|
6
|
+
autoload :Utils, 'ckeditor/utils'
|
7
|
+
autoload :Http, 'ckeditor/http'
|
68
8
|
|
69
|
-
|
70
|
-
|
71
|
-
|
9
|
+
module Helpers
|
10
|
+
autoload :ViewHelper, 'ckeditor/helpers/view_helper'
|
11
|
+
autoload :FormHelper, 'ckeditor/helpers/form_helper'
|
12
|
+
autoload :FormBuilder, 'ckeditor/helpers/form_builder'
|
13
|
+
autoload :Controllers, 'ckeditor/helpers/controllers'
|
72
14
|
end
|
73
15
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
@@file_model_ref.get
|
78
|
-
else
|
79
|
-
self.file_manager_file_model = "Ckeditor::AttachmentFile"
|
80
|
-
@@file_model_ref.get
|
81
|
-
end
|
16
|
+
module Hooks
|
17
|
+
autoload :FormtasticBuilder, 'ckeditor/hooks/formtastic'
|
18
|
+
autoload :SimpleFormBuilder, 'ckeditor/hooks/simple_form'
|
82
19
|
end
|
83
20
|
|
84
|
-
#
|
85
|
-
|
86
|
-
|
87
|
-
|
21
|
+
# Allowed image file types for upload.
|
22
|
+
# Set to nil or [] (empty array) for all file types
|
23
|
+
mattr_accessor :image_file_types
|
24
|
+
@@image_file_types = ["jpg", "jpeg", "png", "gif", "tiff"]
|
25
|
+
|
26
|
+
# Allowed attachment file types for upload.
|
27
|
+
# Set to nil or [] (empty array) for all file types
|
28
|
+
mattr_accessor :attachment_file_types
|
29
|
+
@@attachment_file_types = ["doc", "docx", "rar", "zip", "xls", "swf"]
|
88
30
|
|
89
31
|
# Default way to setup Ckeditor. Run rails generate ckeditor to create
|
90
32
|
# a fresh initializer with all configuration values.
|
91
33
|
def self.setup
|
92
34
|
yield self
|
93
35
|
end
|
36
|
+
|
37
|
+
def self.picture_model
|
38
|
+
Ckeditor::Picture.to_adapter
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.attachment_file_model
|
42
|
+
Ckeditor::AttachmentFile.to_adapter
|
43
|
+
end
|
94
44
|
end
|
95
45
|
|
96
46
|
require 'ckeditor/engine'
|
47
|
+
require 'ckeditor/version'
|
data/lib/ckeditor/engine.rb
CHANGED
@@ -1,21 +1,22 @@
|
|
1
1
|
require 'rails'
|
2
|
-
require 'ckeditor'
|
3
2
|
|
4
3
|
module Ckeditor
|
5
4
|
class Engine < ::Rails::Engine
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
config.action_view.javascript_expansions[:ckeditor] = "ckeditor/ckeditor"
|
6
|
+
|
7
|
+
initializer "ckeditor.helpers" do
|
8
|
+
ActiveSupport.on_load(:action_controller) do
|
9
|
+
ActionController::Base.send :include, Ckeditor::Helpers::Controllers
|
10
|
+
end
|
11
|
+
|
12
|
+
ActiveSupport.on_load :action_view do
|
13
|
+
ActionView::Base.send :include, Ckeditor::Helpers::ViewHelper
|
14
|
+
ActionView::Base.send :include, Ckeditor::Helpers::FormHelper
|
15
|
+
ActionView::Helpers::FormBuilder.send :include, Ckeditor::Helpers::FormBuilder
|
16
|
+
end
|
11
17
|
end
|
12
|
-
|
13
|
-
|
14
|
-
ActionView::Base.send :include, Ckeditor::ViewHelper
|
15
|
-
ActionView::Helpers::FormBuilder.send :include, Ckeditor::FormBuilder
|
16
|
-
|
17
|
-
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :ckeditor => ["ckeditor/ckeditor"]
|
18
|
-
|
18
|
+
|
19
|
+
initializer "ckeditor.hooks" do
|
19
20
|
if Object.const_defined?("Formtastic")
|
20
21
|
::Formtastic::SemanticFormBuilder.send :include, Ckeditor::Hooks::FormtasticBuilder
|
21
22
|
end
|