trusty-cms 3.1.11 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +9 -14
- data/Gemfile.lock +84 -70
- data/README.md +4 -0
- data/app/assets/images/admin/add.png +0 -0
- data/app/assets/images/admin/archive_icon.png +0 -0
- data/app/assets/images/admin/audio_icon.png +0 -0
- data/app/assets/images/admin/audio_thumbnail.png +0 -0
- data/app/assets/images/admin/c_icon.png +0 -0
- data/app/assets/images/admin/copy.png +0 -0
- data/app/assets/images/admin/css_icon.png +0 -0
- data/app/assets/images/admin/database_icon.png +0 -0
- data/app/assets/images/admin/delete.png +0 -0
- data/app/assets/images/admin/document_icon.png +0 -0
- data/app/assets/images/admin/document_thumbnail.png +0 -0
- data/app/assets/images/admin/flash_icon.png +0 -0
- data/app/assets/images/admin/flash_thumbnail.png +0 -0
- data/app/assets/images/admin/font_icon.png +0 -0
- data/app/assets/images/admin/gzip_icon.png +0 -0
- data/app/assets/images/admin/html_icon.png +0 -0
- data/app/assets/images/admin/image_icon.png +0 -0
- data/app/assets/images/admin/image_thumbnail.png +0 -0
- data/app/assets/images/admin/java_icon.png +0 -0
- data/app/assets/images/admin/page_edit.png +0 -0
- data/app/assets/images/admin/pdf_icon.png +0 -0
- data/app/assets/images/admin/pdf_thumbnail.png +0 -0
- data/app/assets/images/admin/perl_icon.png +0 -0
- data/app/assets/images/admin/php_icon.png +0 -0
- data/app/assets/images/admin/presentation_icon.png +0 -0
- data/app/assets/images/admin/python_icon.png +0 -0
- data/app/assets/images/admin/reorder_assets.png +0 -0
- data/app/assets/images/admin/ruby_icon.png +0 -0
- data/app/assets/images/admin/script_icon.png +0 -0
- data/app/assets/images/admin/spinner.gif +0 -0
- data/app/assets/images/admin/spreadsheet_icon.png +0 -0
- data/app/assets/images/admin/tar_icon.png +0 -0
- data/app/assets/images/admin/unknown_icon.png +0 -0
- data/app/assets/images/admin/unknown_thumbnail.png +0 -0
- data/app/assets/images/admin/video_icon.png +0 -0
- data/app/assets/images/admin/video_thumbnail.png +0 -0
- data/app/assets/images/admin/xml_icon.png +0 -0
- data/app/assets/images/admin/zip_icon.png +0 -0
- data/app/assets/javascripts/admin/assets.js +268 -0
- data/app/assets/javascripts/admin/assets_admin.js +16 -0
- data/app/assets/javascripts/admin/jquery.fileupload.js +1457 -0
- data/app/assets/javascripts/admin/jquery.iframe-transport.js +214 -0
- data/app/assets/javascripts/admin/jquery.ui.widget.js +558 -0
- data/app/assets/stylesheets/admin/assets.scss +283 -0
- data/app/controllers/admin/assets_controller.rb +88 -0
- data/app/controllers/admin/page_attachments_controller.rb +23 -0
- data/app/helpers/admin/assets_helper.rb +16 -0
- data/app/helpers/admin/page_attachments_helper.rb +2 -0
- data/app/models/asset.rb +251 -0
- data/app/models/asset_type.rb +239 -0
- data/app/models/old_page_attachment.rb +26 -0
- data/app/models/page_attachment.rb +20 -0
- data/app/views/admin/assets/_asset.html.haml +12 -0
- data/app/views/admin/assets/_asset_table.html.haml +30 -0
- data/app/views/admin/assets/_errors.html.haml +3 -0
- data/app/views/admin/assets/_form.html.haml +18 -0
- data/app/views/admin/assets/_page_assets.html.haml +12 -0
- data/app/views/admin/assets/_search.html.haml +17 -0
- data/app/views/admin/assets/_search_results.html.haml +17 -0
- data/app/views/admin/assets/edit.html.haml +40 -0
- data/app/views/admin/assets/index.html.haml +15 -0
- data/app/views/admin/assets/new.html.haml +24 -0
- data/app/views/admin/assets/refresh.html.haml +14 -0
- data/app/views/admin/assets/remove.html.haml +16 -0
- data/app/views/admin/configuration/_clipped_edit.html.haml +8 -0
- data/app/views/admin/configuration/_clipped_show.html.haml +12 -0
- data/app/views/admin/page_attachments/_attachment.html.haml +25 -0
- data/app/views/admin/pages/_asset_popups.html.haml +37 -0
- data/app/views/admin/pages/_assets.html.haml +13 -0
- data/app/views/admin/removed/_assets_bucket.html.haml +8 -0
- data/app/views/admin/removed/_assets_container.html.haml +54 -0
- data/app/views/admin/removed/_bucket.html.haml +11 -0
- data/app/views/admin/removed/_bucket_asset.html.haml +9 -0
- data/app/views/admin/removed/_show_bucket_link.html.haml +4 -0
- data/app/views/admin/removed/_upload_to_page.html.haml +12 -0
- data/app/views/admin/removed/bucket/_iframe.html.haml +1 -0
- data/config/application.rb +0 -37
- data/config/initializers/assets.rb +1 -0
- data/config/initializers/interpolation.rb +6 -0
- data/config/initializers/kraken.rb +7 -0
- data/config/initializers/trusty_cms_config.rb +67 -0
- data/config/locales/en.yml +101 -0
- data/config/routes.rb +14 -3
- data/coverage/index.html +26 -26
- data/db/migrate/028_create_assets.rb +12 -0
- data/db/migrate/029_create_paperclip_attributes.rb +13 -0
- data/db/migrate/030_create_user_observer.rb +13 -0
- data/db/migrate/031_create_page_attachments.rb +19 -0
- data/db/migrate/032_rename_users.rb +13 -0
- data/db/migrate/20110513205050_asset_uuid.rb +11 -0
- data/db/migrate/20110606111250_update_configuration.rb +34 -0
- data/db/migrate/20110609101438_dimensions.rb +13 -0
- data/lib/trusty_cms.rb +1 -1
- data/spec/dummy/db/schema.rb +22 -0
- data/spec/dummy/log/test.log +95620 -0
- data/spec/dummy/tmp/cache/747/A70/TrustyCms%3A%3AConfig +0 -0
- data/spec/dummy/tmp/cache/85C/FA0/TrustyCms.cache_mtime +0 -0
- data/spec/dummy/tmp/capybara/capybara-20180312152412265881245.html +262 -0
- data/spec/dummy/tmp/capybara/capybara-201803121526139973682798.html +149 -0
- data/spec/factories/layout.rb +1 -1
- data/spec/factories/page.rb +3 -3
- data/spec/factories/page_part.rb +1 -1
- data/spec/factories/user.rb +1 -1
- data/spec/models/layout_spec.rb +6 -6
- data/spec/spec_helper.rb +4 -4
- data/trusty_cms.gemspec +27 -22
- data/vendor/extensions/clipped-extension/clipped_extension.rb +40 -0
- data/vendor/extensions/clipped-extension/lib/asset_tags.rb +346 -0
- data/vendor/extensions/clipped-extension/lib/clipped/engine.rb +11 -0
- data/vendor/extensions/clipped-extension/lib/clipped_admin_ui.rb +28 -0
- data/vendor/extensions/clipped-extension/lib/generators/templates/clipped_config.rb +53 -0
- data/vendor/extensions/clipped-extension/lib/page_asset_associations.rb +13 -0
- data/vendor/extensions/clipped-extension/lib/paperclip/frame_grab.rb +73 -0
- data/vendor/extensions/clipped-extension/lib/paperclip/geometry_transformation.rb +80 -0
- data/vendor/extensions/clipped-extension/lib/tasks/clipped_extension_tasks.rake +124 -0
- data/vendor/extensions/clipped-extension/lib/tasks/paperclip_tasks.rake +79 -0
- data/vendor/extensions/clipped-extension/lib/trusty-clipped-extension.rb +2 -0
- data/vendor/extensions/clipped-extension/lib/trusty_cms_clipped_extension/cloud.rb +41 -0
- metadata +219 -67
- data/config/initializers/ckeditor.rb +0 -3
- data/config/initializers/haml.rb +0 -2
- data/config/initializers/rails_patch.rb +0 -2
- data/config/initializers/string_extensions.rb +0 -1
- data/config/initializers/symbol_extensions.rb +0 -1
@@ -0,0 +1,214 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery Iframe Transport Plugin 1.8.2
|
3
|
+
* https://github.com/blueimp/jQuery-File-Upload
|
4
|
+
*
|
5
|
+
* Copyright 2011, Sebastian Tschan
|
6
|
+
* https://blueimp.net
|
7
|
+
*
|
8
|
+
* Licensed under the MIT license:
|
9
|
+
* http://www.opensource.org/licenses/MIT
|
10
|
+
*/
|
11
|
+
|
12
|
+
/* global define, window, document */
|
13
|
+
|
14
|
+
(function (factory) {
|
15
|
+
'use strict';
|
16
|
+
if (typeof define === 'function' && define.amd) {
|
17
|
+
// Register as an anonymous AMD module:
|
18
|
+
define(['jquery'], factory);
|
19
|
+
} else {
|
20
|
+
// Browser globals:
|
21
|
+
factory(window.jQuery);
|
22
|
+
}
|
23
|
+
}(function ($) {
|
24
|
+
'use strict';
|
25
|
+
|
26
|
+
// Helper variable to create unique names for the transport iframes:
|
27
|
+
var counter = 0;
|
28
|
+
|
29
|
+
// The iframe transport accepts four additional options:
|
30
|
+
// options.fileInput: a jQuery collection of file input fields
|
31
|
+
// options.paramName: the parameter name for the file form data,
|
32
|
+
// overrides the name property of the file input field(s),
|
33
|
+
// can be a string or an array of strings.
|
34
|
+
// options.formData: an array of objects with name and value properties,
|
35
|
+
// equivalent to the return data of .serializeArray(), e.g.:
|
36
|
+
// [{name: 'a', value: 1}, {name: 'b', value: 2}]
|
37
|
+
// options.initialIframeSrc: the URL of the initial iframe src,
|
38
|
+
// by default set to "javascript:false;"
|
39
|
+
$.ajaxTransport('iframe', function (options) {
|
40
|
+
if (options.async) {
|
41
|
+
// javascript:false as initial iframe src
|
42
|
+
// prevents warning popups on HTTPS in IE6:
|
43
|
+
/*jshint scripturl: true */
|
44
|
+
var initialIframeSrc = options.initialIframeSrc || 'javascript:false;',
|
45
|
+
/*jshint scripturl: false */
|
46
|
+
form,
|
47
|
+
iframe,
|
48
|
+
addParamChar;
|
49
|
+
return {
|
50
|
+
send: function (_, completeCallback) {
|
51
|
+
form = $('<form style="display:none;"></form>');
|
52
|
+
form.attr('accept-charset', options.formAcceptCharset);
|
53
|
+
addParamChar = /\?/.test(options.url) ? '&' : '?';
|
54
|
+
// XDomainRequest only supports GET and POST:
|
55
|
+
if (options.type === 'DELETE') {
|
56
|
+
options.url = options.url + addParamChar + '_method=DELETE';
|
57
|
+
options.type = 'POST';
|
58
|
+
} else if (options.type === 'PUT') {
|
59
|
+
options.url = options.url + addParamChar + '_method=PUT';
|
60
|
+
options.type = 'POST';
|
61
|
+
} else if (options.type === 'PATCH') {
|
62
|
+
options.url = options.url + addParamChar + '_method=PATCH';
|
63
|
+
options.type = 'POST';
|
64
|
+
}
|
65
|
+
// IE versions below IE8 cannot set the name property of
|
66
|
+
// elements that have already been added to the DOM,
|
67
|
+
// so we set the name along with the iframe HTML markup:
|
68
|
+
counter += 1;
|
69
|
+
iframe = $(
|
70
|
+
'<iframe src="' + initialIframeSrc +
|
71
|
+
'" name="iframe-transport-' + counter + '"></iframe>'
|
72
|
+
).bind('load', function () {
|
73
|
+
var fileInputClones,
|
74
|
+
paramNames = $.isArray(options.paramName) ?
|
75
|
+
options.paramName : [options.paramName];
|
76
|
+
iframe
|
77
|
+
.unbind('load')
|
78
|
+
.bind('load', function () {
|
79
|
+
var response;
|
80
|
+
// Wrap in a try/catch block to catch exceptions thrown
|
81
|
+
// when trying to access cross-domain iframe contents:
|
82
|
+
try {
|
83
|
+
response = iframe.contents();
|
84
|
+
// Google Chrome and Firefox do not throw an
|
85
|
+
// exception when calling iframe.contents() on
|
86
|
+
// cross-domain requests, so we unify the response:
|
87
|
+
if (!response.length || !response[0].firstChild) {
|
88
|
+
throw new Error();
|
89
|
+
}
|
90
|
+
} catch (e) {
|
91
|
+
response = undefined;
|
92
|
+
}
|
93
|
+
// The complete callback returns the
|
94
|
+
// iframe content document as response object:
|
95
|
+
completeCallback(
|
96
|
+
200,
|
97
|
+
'success',
|
98
|
+
{'iframe': response}
|
99
|
+
);
|
100
|
+
// Fix for IE endless progress bar activity bug
|
101
|
+
// (happens on form submits to iframe targets):
|
102
|
+
$('<iframe src="' + initialIframeSrc + '"></iframe>')
|
103
|
+
.appendTo(form);
|
104
|
+
window.setTimeout(function () {
|
105
|
+
// Removing the form in a setTimeout call
|
106
|
+
// allows Chrome's developer tools to display
|
107
|
+
// the response result
|
108
|
+
form.remove();
|
109
|
+
}, 0);
|
110
|
+
});
|
111
|
+
form
|
112
|
+
.prop('target', iframe.prop('name'))
|
113
|
+
.prop('action', options.url)
|
114
|
+
.prop('method', options.type);
|
115
|
+
if (options.formData) {
|
116
|
+
$.each(options.formData, function (index, field) {
|
117
|
+
$('<input type="hidden"/>')
|
118
|
+
.prop('name', field.name)
|
119
|
+
.val(field.value)
|
120
|
+
.appendTo(form);
|
121
|
+
});
|
122
|
+
}
|
123
|
+
if (options.fileInput && options.fileInput.length &&
|
124
|
+
options.type === 'POST') {
|
125
|
+
fileInputClones = options.fileInput.clone();
|
126
|
+
// Insert a clone for each file input field:
|
127
|
+
options.fileInput.after(function (index) {
|
128
|
+
return fileInputClones[index];
|
129
|
+
});
|
130
|
+
if (options.paramName) {
|
131
|
+
options.fileInput.each(function (index) {
|
132
|
+
$(this).prop(
|
133
|
+
'name',
|
134
|
+
paramNames[index] || options.paramName
|
135
|
+
);
|
136
|
+
});
|
137
|
+
}
|
138
|
+
// Appending the file input fields to the hidden form
|
139
|
+
// removes them from their original location:
|
140
|
+
form
|
141
|
+
.append(options.fileInput)
|
142
|
+
.prop('enctype', 'multipart/form-data')
|
143
|
+
// enctype must be set as encoding for IE:
|
144
|
+
.prop('encoding', 'multipart/form-data');
|
145
|
+
// Remove the HTML5 form attribute from the input(s):
|
146
|
+
options.fileInput.removeAttr('form');
|
147
|
+
}
|
148
|
+
form.submit();
|
149
|
+
// Insert the file input fields at their original location
|
150
|
+
// by replacing the clones with the originals:
|
151
|
+
if (fileInputClones && fileInputClones.length) {
|
152
|
+
options.fileInput.each(function (index, input) {
|
153
|
+
var clone = $(fileInputClones[index]);
|
154
|
+
// Restore the original name and form properties:
|
155
|
+
$(input)
|
156
|
+
.prop('name', clone.prop('name'))
|
157
|
+
.attr('form', clone.attr('form'));
|
158
|
+
clone.replaceWith(input);
|
159
|
+
});
|
160
|
+
}
|
161
|
+
});
|
162
|
+
form.append(iframe).appendTo(document.body);
|
163
|
+
},
|
164
|
+
abort: function () {
|
165
|
+
if (iframe) {
|
166
|
+
// javascript:false as iframe src aborts the request
|
167
|
+
// and prevents warning popups on HTTPS in IE6.
|
168
|
+
// concat is used to avoid the "Script URL" JSLint error:
|
169
|
+
iframe
|
170
|
+
.unbind('load')
|
171
|
+
.prop('src', initialIframeSrc);
|
172
|
+
}
|
173
|
+
if (form) {
|
174
|
+
form.remove();
|
175
|
+
}
|
176
|
+
}
|
177
|
+
};
|
178
|
+
}
|
179
|
+
});
|
180
|
+
|
181
|
+
// The iframe transport returns the iframe content document as response.
|
182
|
+
// The following adds converters from iframe to text, json, html, xml
|
183
|
+
// and script.
|
184
|
+
// Please note that the Content-Type for JSON responses has to be text/plain
|
185
|
+
// or text/html, if the browser doesn't include application/json in the
|
186
|
+
// Accept header, else IE will show a download dialog.
|
187
|
+
// The Content-Type for XML responses on the other hand has to be always
|
188
|
+
// application/xml or text/xml, so IE properly parses the XML response.
|
189
|
+
// See also
|
190
|
+
// https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#content-type-negotiation
|
191
|
+
$.ajaxSetup({
|
192
|
+
converters: {
|
193
|
+
'iframe text': function (iframe) {
|
194
|
+
return iframe && $(iframe[0].body).text();
|
195
|
+
},
|
196
|
+
'iframe json': function (iframe) {
|
197
|
+
return iframe && $.parseJSON($(iframe[0].body).text());
|
198
|
+
},
|
199
|
+
'iframe html': function (iframe) {
|
200
|
+
return iframe && $(iframe[0].body).html();
|
201
|
+
},
|
202
|
+
'iframe xml': function (iframe) {
|
203
|
+
var xmlDoc = iframe && iframe[0];
|
204
|
+
return xmlDoc && $.isXMLDoc(xmlDoc) ? xmlDoc :
|
205
|
+
$.parseXML((xmlDoc.XMLDocument && xmlDoc.XMLDocument.xml) ||
|
206
|
+
$(xmlDoc.body).html());
|
207
|
+
},
|
208
|
+
'iframe script': function (iframe) {
|
209
|
+
return iframe && $.globalEval($(iframe[0].body).text());
|
210
|
+
}
|
211
|
+
}
|
212
|
+
});
|
213
|
+
|
214
|
+
}));
|