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.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +9 -14
  3. data/Gemfile.lock +84 -70
  4. data/README.md +4 -0
  5. data/app/assets/images/admin/add.png +0 -0
  6. data/app/assets/images/admin/archive_icon.png +0 -0
  7. data/app/assets/images/admin/audio_icon.png +0 -0
  8. data/app/assets/images/admin/audio_thumbnail.png +0 -0
  9. data/app/assets/images/admin/c_icon.png +0 -0
  10. data/app/assets/images/admin/copy.png +0 -0
  11. data/app/assets/images/admin/css_icon.png +0 -0
  12. data/app/assets/images/admin/database_icon.png +0 -0
  13. data/app/assets/images/admin/delete.png +0 -0
  14. data/app/assets/images/admin/document_icon.png +0 -0
  15. data/app/assets/images/admin/document_thumbnail.png +0 -0
  16. data/app/assets/images/admin/flash_icon.png +0 -0
  17. data/app/assets/images/admin/flash_thumbnail.png +0 -0
  18. data/app/assets/images/admin/font_icon.png +0 -0
  19. data/app/assets/images/admin/gzip_icon.png +0 -0
  20. data/app/assets/images/admin/html_icon.png +0 -0
  21. data/app/assets/images/admin/image_icon.png +0 -0
  22. data/app/assets/images/admin/image_thumbnail.png +0 -0
  23. data/app/assets/images/admin/java_icon.png +0 -0
  24. data/app/assets/images/admin/page_edit.png +0 -0
  25. data/app/assets/images/admin/pdf_icon.png +0 -0
  26. data/app/assets/images/admin/pdf_thumbnail.png +0 -0
  27. data/app/assets/images/admin/perl_icon.png +0 -0
  28. data/app/assets/images/admin/php_icon.png +0 -0
  29. data/app/assets/images/admin/presentation_icon.png +0 -0
  30. data/app/assets/images/admin/python_icon.png +0 -0
  31. data/app/assets/images/admin/reorder_assets.png +0 -0
  32. data/app/assets/images/admin/ruby_icon.png +0 -0
  33. data/app/assets/images/admin/script_icon.png +0 -0
  34. data/app/assets/images/admin/spinner.gif +0 -0
  35. data/app/assets/images/admin/spreadsheet_icon.png +0 -0
  36. data/app/assets/images/admin/tar_icon.png +0 -0
  37. data/app/assets/images/admin/unknown_icon.png +0 -0
  38. data/app/assets/images/admin/unknown_thumbnail.png +0 -0
  39. data/app/assets/images/admin/video_icon.png +0 -0
  40. data/app/assets/images/admin/video_thumbnail.png +0 -0
  41. data/app/assets/images/admin/xml_icon.png +0 -0
  42. data/app/assets/images/admin/zip_icon.png +0 -0
  43. data/app/assets/javascripts/admin/assets.js +268 -0
  44. data/app/assets/javascripts/admin/assets_admin.js +16 -0
  45. data/app/assets/javascripts/admin/jquery.fileupload.js +1457 -0
  46. data/app/assets/javascripts/admin/jquery.iframe-transport.js +214 -0
  47. data/app/assets/javascripts/admin/jquery.ui.widget.js +558 -0
  48. data/app/assets/stylesheets/admin/assets.scss +283 -0
  49. data/app/controllers/admin/assets_controller.rb +88 -0
  50. data/app/controllers/admin/page_attachments_controller.rb +23 -0
  51. data/app/helpers/admin/assets_helper.rb +16 -0
  52. data/app/helpers/admin/page_attachments_helper.rb +2 -0
  53. data/app/models/asset.rb +251 -0
  54. data/app/models/asset_type.rb +239 -0
  55. data/app/models/old_page_attachment.rb +26 -0
  56. data/app/models/page_attachment.rb +20 -0
  57. data/app/views/admin/assets/_asset.html.haml +12 -0
  58. data/app/views/admin/assets/_asset_table.html.haml +30 -0
  59. data/app/views/admin/assets/_errors.html.haml +3 -0
  60. data/app/views/admin/assets/_form.html.haml +18 -0
  61. data/app/views/admin/assets/_page_assets.html.haml +12 -0
  62. data/app/views/admin/assets/_search.html.haml +17 -0
  63. data/app/views/admin/assets/_search_results.html.haml +17 -0
  64. data/app/views/admin/assets/edit.html.haml +40 -0
  65. data/app/views/admin/assets/index.html.haml +15 -0
  66. data/app/views/admin/assets/new.html.haml +24 -0
  67. data/app/views/admin/assets/refresh.html.haml +14 -0
  68. data/app/views/admin/assets/remove.html.haml +16 -0
  69. data/app/views/admin/configuration/_clipped_edit.html.haml +8 -0
  70. data/app/views/admin/configuration/_clipped_show.html.haml +12 -0
  71. data/app/views/admin/page_attachments/_attachment.html.haml +25 -0
  72. data/app/views/admin/pages/_asset_popups.html.haml +37 -0
  73. data/app/views/admin/pages/_assets.html.haml +13 -0
  74. data/app/views/admin/removed/_assets_bucket.html.haml +8 -0
  75. data/app/views/admin/removed/_assets_container.html.haml +54 -0
  76. data/app/views/admin/removed/_bucket.html.haml +11 -0
  77. data/app/views/admin/removed/_bucket_asset.html.haml +9 -0
  78. data/app/views/admin/removed/_show_bucket_link.html.haml +4 -0
  79. data/app/views/admin/removed/_upload_to_page.html.haml +12 -0
  80. data/app/views/admin/removed/bucket/_iframe.html.haml +1 -0
  81. data/config/application.rb +0 -37
  82. data/config/initializers/assets.rb +1 -0
  83. data/config/initializers/interpolation.rb +6 -0
  84. data/config/initializers/kraken.rb +7 -0
  85. data/config/initializers/trusty_cms_config.rb +67 -0
  86. data/config/locales/en.yml +101 -0
  87. data/config/routes.rb +14 -3
  88. data/coverage/index.html +26 -26
  89. data/db/migrate/028_create_assets.rb +12 -0
  90. data/db/migrate/029_create_paperclip_attributes.rb +13 -0
  91. data/db/migrate/030_create_user_observer.rb +13 -0
  92. data/db/migrate/031_create_page_attachments.rb +19 -0
  93. data/db/migrate/032_rename_users.rb +13 -0
  94. data/db/migrate/20110513205050_asset_uuid.rb +11 -0
  95. data/db/migrate/20110606111250_update_configuration.rb +34 -0
  96. data/db/migrate/20110609101438_dimensions.rb +13 -0
  97. data/lib/trusty_cms.rb +1 -1
  98. data/spec/dummy/db/schema.rb +22 -0
  99. data/spec/dummy/log/test.log +95620 -0
  100. data/spec/dummy/tmp/cache/747/A70/TrustyCms%3A%3AConfig +0 -0
  101. data/spec/dummy/tmp/cache/85C/FA0/TrustyCms.cache_mtime +0 -0
  102. data/spec/dummy/tmp/capybara/capybara-20180312152412265881245.html +262 -0
  103. data/spec/dummy/tmp/capybara/capybara-201803121526139973682798.html +149 -0
  104. data/spec/factories/layout.rb +1 -1
  105. data/spec/factories/page.rb +3 -3
  106. data/spec/factories/page_part.rb +1 -1
  107. data/spec/factories/user.rb +1 -1
  108. data/spec/models/layout_spec.rb +6 -6
  109. data/spec/spec_helper.rb +4 -4
  110. data/trusty_cms.gemspec +27 -22
  111. data/vendor/extensions/clipped-extension/clipped_extension.rb +40 -0
  112. data/vendor/extensions/clipped-extension/lib/asset_tags.rb +346 -0
  113. data/vendor/extensions/clipped-extension/lib/clipped/engine.rb +11 -0
  114. data/vendor/extensions/clipped-extension/lib/clipped_admin_ui.rb +28 -0
  115. data/vendor/extensions/clipped-extension/lib/generators/templates/clipped_config.rb +53 -0
  116. data/vendor/extensions/clipped-extension/lib/page_asset_associations.rb +13 -0
  117. data/vendor/extensions/clipped-extension/lib/paperclip/frame_grab.rb +73 -0
  118. data/vendor/extensions/clipped-extension/lib/paperclip/geometry_transformation.rb +80 -0
  119. data/vendor/extensions/clipped-extension/lib/tasks/clipped_extension_tasks.rake +124 -0
  120. data/vendor/extensions/clipped-extension/lib/tasks/paperclip_tasks.rake +79 -0
  121. data/vendor/extensions/clipped-extension/lib/trusty-clipped-extension.rb +2 -0
  122. data/vendor/extensions/clipped-extension/lib/trusty_cms_clipped_extension/cloud.rb +41 -0
  123. metadata +219 -67
  124. data/config/initializers/ckeditor.rb +0 -3
  125. data/config/initializers/haml.rb +0 -2
  126. data/config/initializers/rails_patch.rb +0 -2
  127. data/config/initializers/string_extensions.rb +0 -1
  128. data/config/initializers/symbol_extensions.rb +0 -1
@@ -0,0 +1,268 @@
1
+ Assets = {
2
+ attachEvents: function() {
3
+ $('a.attach_asset').off('click').click(function(e){
4
+ e.preventDefault();
5
+ var link = $(this);
6
+ var container = link.parents('li.asset');
7
+ var title = link.parents('div.title').html();
8
+ var image = link.parents('img');
9
+ container.addClass('waiting');
10
+ $.ajax({
11
+ url: link.attr('href'),
12
+ success: function(data, textStatus, jqXHR) {
13
+ container.removeClass('waiting');
14
+ Assets.addToList(data);
15
+ }
16
+ });
17
+ });
18
+
19
+ $('a.detach_asset').off('click').click(function(e){
20
+ e.preventDefault();
21
+ var link = $(this);
22
+ Assets.removeFromList(link.parents('li.asset'));
23
+ });
24
+
25
+ $('a.insert_asset').off('click').click(function(e){
26
+ e.preventDefault();
27
+ var part_name = $("a.tab.here").children('span').html();
28
+ if (part_name.indexOf(' ')) part_name = part_name.replace(' ', '-').toLowerCase();
29
+ part_name = part_name.replace('_', '-');
30
+ var part_id = 'part_' + part_name + '_content';
31
+ var tag_parts = $(this).attr('rel').split('_');
32
+ var tag_name = tag_parts[0];
33
+ var asset_size = tag_parts[1];
34
+ var asset_id = tag_parts[2];
35
+ var radius_tag = '<r:asset:' + tag_name;
36
+ if (asset_size != '') radius_tag = radius_tag + ' size="' + asset_size + '"';
37
+ radius_tag = radius_tag +' id="' + asset_id + '" />';
38
+ Assets.insertAtCursor(part_id, radius_tag);
39
+
40
+ });
41
+
42
+ $(".pagination a").off('click').click(function(e){
43
+ e.preventDefault();
44
+ $.ajax({
45
+ method: 'get',
46
+ url: $(this).attr('href') + Assets.assetFilterParameters(),
47
+ complete: function(data, textStatus, jqXHR) {
48
+ Assets.updateTable(data.responseText);
49
+ Assets.attachEvents();
50
+ }
51
+ });
52
+ });
53
+
54
+ },
55
+
56
+ assetFilterParameters: function() {
57
+ var parameters = [];
58
+ if ($('#filesearchforminput').val() !== '') {
59
+ parameters.push(['search', $('#filesearchforminput').val()]);
60
+ }
61
+
62
+ if ($('#page_id').val() !== undefined) {
63
+ parameters.push(['page_id', $('#page_id').val()]);
64
+ }
65
+
66
+ var filters = [];
67
+ var url_params = "";
68
+ $('a.selective.pressed').each(function(){
69
+ filters.push($(this).attr('rel'));
70
+ });
71
+
72
+ if (filters.length > 0) {parameters.push(['filter', filters.toString()])}
73
+
74
+ for(var i = 0; i < parameters.length; i++) {
75
+ if (i > 0) {url_params = url_params + '&'}
76
+ url_params = url_params + parameters[i][0] + '=' + parameters[i][1];
77
+ }
78
+ return url_params + '&pp=20';
79
+ },
80
+
81
+ activateUpload: function(){
82
+ $('#upload-controls').hide();
83
+ $('#update-controls').show();
84
+ $('#asset_title').prop( "disabled", false );
85
+ $('#new_asset input[name="commit"]').prop( "disabled", false );
86
+ },
87
+ activateUpdate: function() {
88
+ $('#upload-controls').show();
89
+ $('#update-controls').hide();
90
+ $('#asset_title').prop( "disabled", true );
91
+ $('#new_asset input[name="commit"]').prop( "disabled", true );
92
+ },
93
+
94
+ insertAtCursor: function(part_id, insertion) {
95
+ if (CKEDITOR.instances[part_id].mode == 'wysiwyg') {
96
+ CKEDITOR.instances[part_id].insertText( insertion );
97
+ } else {
98
+ var textbox = $("textarea.cke_source[title~=" + part_id +"]");
99
+ var caretPos = textbox[0].selectionStart;
100
+ var textAreaTxt = textbox.val();
101
+ textbox.val(textAreaTxt.substring(0, caretPos) + insertion + textAreaTxt.substring(caretPos) );
102
+ }
103
+ },
104
+ filterAssets: function() {
105
+ var url = $("#filesearchform").attr('action');
106
+ var parameters = Assets.assetFilterParameters();
107
+
108
+ url = url + "?" + parameters;
109
+ $.ajax({
110
+ url: url,
111
+ complete: function(data, textStatus, jqXHR) {
112
+ Assets.updateTable(data.responseText);
113
+ }
114
+ });
115
+ },
116
+ updateTable: function(html) {
117
+ $("#assets_table").html(html);
118
+ Assets.attachEvents();
119
+ },
120
+ addToList: function(html){
121
+ var list = $('#attachment_fields');
122
+ list.append(html);
123
+ Assets.showListIfHidden();
124
+ Assets.notify('Save page to commit changes');
125
+ Assets.attachEvents();
126
+ // I'm not sure what Sortable does and can't find any example of
127
+ // its use in current Trusty, so I'm going to comment it out for now.
128
+
129
+ //Assets.makeSortable(list);
130
+
131
+ },
132
+ removeFromList: function(container) {
133
+ container.children('input.attacher').remove();
134
+ container.children('input.pos').remove();
135
+ container.children('input.destroyer').val(1);
136
+ container.fadeOut();
137
+ container.addClass('detached');
138
+ },
139
+ showListIfHidden: function() {
140
+ var list = $('#attachment_fields');
141
+ if (list.hasClass('empty')) {
142
+ list.removeClass('empty');
143
+ }
144
+ },
145
+ notify: function(message){
146
+ $('#attachment_list span.message').html(message).addClass('important');
147
+ }
148
+
149
+ };
150
+
151
+
152
+ $(function() {
153
+
154
+ $('a.selective').click(function(e){
155
+ e.preventDefault();
156
+ var element = $(this);
157
+ var type_id = element.attr('rel');
158
+ var type_check = $('#' + type_id + '-check');
159
+
160
+ if(element.hasClass('pressed')) {
161
+ element.removeClass('pressed');
162
+ $(type_check).prop('checked', false);
163
+ if ($('a.selective.pressed').length == 0) $('#select_all').addClass('pressed');
164
+ }
165
+ else {
166
+ element.addClass('pressed');
167
+ $('a.deselective').each(function() { $(this).removeClass('pressed'); });
168
+ $(type_check).prop('checked', true);
169
+ }
170
+ Assets.filterAssets();
171
+ Assets.attachEvents();
172
+
173
+ });
174
+
175
+ $('a.deselective').click(function(e){
176
+ e.preventDefault();
177
+ var element = $(this);
178
+ if(!element.hasClass('pressed')) {
179
+ $('a.selective').each(function() { $(this).removeClass('pressed'); });
180
+ $('input.selective').each(function() { $(this).prop('checked', false); });
181
+ element.addClass('pressed');
182
+ Assets.filterAssets();
183
+ Assets.attachEvents();
184
+ }
185
+ });
186
+
187
+ $('#filesearchforminput').keyup(function(){
188
+ Assets.filterAssets();
189
+ Assets.attachEvents();
190
+ });
191
+
192
+ $("#attach_assets").click(function(e) {
193
+ e.preventDefault();
194
+ Popup.show('attach_asset');
195
+ $('.close_popup').click(function(e){
196
+ e.preventDefault();
197
+ Popup.close();
198
+ $('#attach_asset').hide();
199
+ });
200
+ });
201
+
202
+ $('#filesearchforminput').keyup(function(){
203
+ Assets.filterAssets();
204
+ });
205
+
206
+ $("#upload_asset_link").click(function(e) {
207
+ e.preventDefault();
208
+ Popup.close();
209
+ $('#attach_asset').hide();
210
+ Assets.activateUpdate();
211
+ Popup.show('upload_asset');
212
+
213
+ $("#attach-popup").click(function(e) {
214
+ e.preventDefault();
215
+ Popup.close();
216
+ $('#upload_asset').hide();
217
+ Popup.show('attach_asset');
218
+ $('.close_popup').click(function(e){
219
+ e.preventDefault();
220
+ Popup.close();
221
+ $('#attach_asset').hide();
222
+ });
223
+ });
224
+
225
+ $('.close_popup').click(function(e){
226
+ e.preventDefault();
227
+ Popup.close();
228
+ $('#upload_asset').hide();
229
+ });
230
+ });
231
+
232
+ $('#update_asset').submit(function(e){
233
+ e.preventDefault();
234
+ $("#update-asset").attr("disabled", true);
235
+ $('#update-status').show();
236
+ $.ajax({
237
+ method: 'put',
238
+ url: $(this).attr('action') + $("#asset_id").val(),
239
+ data: $(this).serialize(),
240
+ complete: function(data, textStatus, jqXHR) {
241
+ Popup.close();
242
+ $('#upload_asset').hide();
243
+ $('#update-status').hide();
244
+ $("#update-asset").attr("disabled", false);
245
+ $('#update_asset').trigger("reset");
246
+ }
247
+ });
248
+ });
249
+
250
+ $('#asset_asset').fileupload({
251
+ add: function(e, data) {
252
+ $("#asset_asset").attr("disabled", true);
253
+ $('#upload-status').show();
254
+ data.submit();
255
+ },
256
+ done: function (e, data) {
257
+ $("#asset_id").val($(data.result).find(".attacher").val());
258
+ Assets.addToList($(data.result));
259
+ Assets.activateUpload();
260
+ $("#asset_asset").attr("disabled", false);
261
+ $('#upload-status').hide();
262
+ $("#popup_window").hide();
263
+ }
264
+ });
265
+
266
+ Assets.attachEvents();
267
+
268
+ });
@@ -0,0 +1,16 @@
1
+ // This is a manifest file that'll be compiled into admin.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require 'admin/jquery.ui.widget'
14
+ //= require 'admin/jquery.iframe-transport'
15
+ //= require 'admin/jquery.fileupload'
16
+ //= require 'admin/assets'