alchemy_cms 3.1.0.rc1 → 3.1.0.rc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +4 -10
  3. data/.teatro.yml +7 -0
  4. data/Gemfile +13 -13
  5. data/README.md +20 -3
  6. data/app/assets/javascripts/alchemy/alchemy.translations.js.coffee +3 -3
  7. data/app/assets/javascripts/alchemy/alchemy.uploader.js.coffee +5 -0
  8. data/app/controllers/alchemy/admin/essence_files_controller.rb +23 -3
  9. data/app/controllers/alchemy/admin/essence_pictures_controller.rb +7 -2
  10. data/app/controllers/alchemy/admin/pictures_controller.rb +1 -4
  11. data/app/controllers/alchemy/base_controller.rb +3 -1
  12. data/app/controllers/alchemy/pages_controller.rb +3 -1
  13. data/app/models/alchemy/content.rb +0 -3
  14. data/app/models/alchemy/element.rb +1 -2
  15. data/app/models/alchemy/page/page_scopes.rb +3 -1
  16. data/app/models/alchemy/page/page_users.rb +10 -3
  17. data/app/models/alchemy/picture.rb +29 -6
  18. data/app/models/alchemy/picture/transformations.rb +14 -7
  19. data/app/views/alchemy/_menubar.html.erb +1 -1
  20. data/app/views/alchemy/admin/leave.html.erb +1 -1
  21. data/app/views/alchemy/essences/_essence_boolean_editor.html.erb +2 -1
  22. data/config/initializers/dragonfly.rb +0 -2
  23. data/lib/alchemy/engine.rb +0 -1
  24. data/lib/alchemy/locale.rb +15 -13
  25. data/lib/alchemy/upgrader.rb +1 -0
  26. data/lib/alchemy/upgrader/three_point_zero.rb +27 -9
  27. data/lib/alchemy/version.rb +1 -1
  28. data/lib/tasks/alchemy/tidy.rake +34 -16
  29. data/spec/controllers/admin/essence_files_controller_spec.rb +13 -2
  30. data/spec/controllers/admin/essence_pictures_controller_spec.rb +8 -0
  31. data/spec/controllers/pages_controller_spec.rb +42 -0
  32. data/spec/dummy/app/controllers/application_controller.rb +5 -1
  33. data/spec/dummy/app/models/dummy_user.rb +4 -0
  34. data/spec/dummy/bin/bundle +0 -0
  35. data/spec/dummy/bin/rails +0 -0
  36. data/spec/dummy/bin/rake +0 -0
  37. data/spec/dummy/config/environments/production.rb +1 -1
  38. data/spec/dummy/db/seeds.rb +1 -0
  39. data/spec/features/translation_integration_spec.rb +14 -11
  40. data/spec/models/page_spec.rb +143 -52
  41. data/spec/spec_helper.rb +0 -3
  42. data/spec/support/transformation_examples.rb +7 -0
  43. data/spec/views/essences/essence_boolean_editor_spec.rb +1 -0
  44. data/vendor/assets/javascripts/fileupload/jquery.fileupload-process.js +6 -3
  45. data/vendor/assets/javascripts/fileupload/jquery.fileupload-validate.js +5 -3
  46. data/vendor/assets/javascripts/fileupload/jquery.fileupload.js +97 -46
  47. data/vendor/assets/javascripts/fileupload/jquery.iframe-transport.js +11 -4
  48. metadata +6 -4
  49. data/lib/extensions/action_view.rb +0 -17
@@ -28,6 +28,13 @@ module Alchemy
28
28
  expect(picture.thumbnail_size()).to eq('111x83')
29
29
  end
30
30
  end
31
+
32
+ context "picture has crop_size of 0x0" do
33
+ it "returns default thumbnail size" do
34
+ allow(picture).to receive(:crop_size) { "0x0" }
35
+ expect(picture.thumbnail_size()).to eq('111x93')
36
+ end
37
+ end
31
38
  end
32
39
 
33
40
  describe '#landscape_format?' do
@@ -7,6 +7,7 @@ describe 'alchemy/essences/_essence_boolean_editor' do
7
7
  before do
8
8
  allow(view).to receive(:render_content_name).and_return(content.name)
9
9
  allow(view).to receive(:delete_content_link).and_return('')
10
+ allow(view).to receive(:render_hint_for).and_return('')
10
11
  end
11
12
 
12
13
  it "renders a checkbox" do
@@ -1,5 +1,5 @@
1
1
  /*
2
- * jQuery File Upload Processing Plugin 1.3.0
2
+ * jQuery File Upload Processing Plugin 1.3.1
3
3
  * https://github.com/blueimp/jQuery-File-Upload
4
4
  *
5
5
  * Copyright 2012, Sebastian Tschan
@@ -9,8 +9,8 @@
9
9
  * http://www.opensource.org/licenses/MIT
10
10
  */
11
11
 
12
- /*jslint nomen: true, unparam: true */
13
- /*global define, window */
12
+ /* jshint nomen:false */
13
+ /* global define, require, window */
14
14
 
15
15
  (function (factory) {
16
16
  'use strict';
@@ -20,6 +20,9 @@
20
20
  'jquery',
21
21
  './jquery.fileupload'
22
22
  ], factory);
23
+ } else if (typeof exports === 'object') {
24
+ // Node/CommonJS:
25
+ factory(require('jquery'));
23
26
  } else {
24
27
  // Browser globals:
25
28
  factory(
@@ -1,5 +1,5 @@
1
1
  /*
2
- * jQuery File Upload Validation Plugin 1.1.2
2
+ * jQuery File Upload Validation Plugin 1.1.3
3
3
  * https://github.com/blueimp/jQuery-File-Upload
4
4
  *
5
5
  * Copyright 2013, Sebastian Tschan
@@ -9,8 +9,7 @@
9
9
  * http://www.opensource.org/licenses/MIT
10
10
  */
11
11
 
12
- /*jslint nomen: true, unparam: true, regexp: true */
13
- /*global define, window */
12
+ /* global define, require, window */
14
13
 
15
14
  (function (factory) {
16
15
  'use strict';
@@ -20,6 +19,9 @@
20
19
  'jquery',
21
20
  './jquery.fileupload-process'
22
21
  ], factory);
22
+ } else if (typeof exports === 'object') {
23
+ // Node/CommonJS:
24
+ factory(require('jquery'));
23
25
  } else {
24
26
  // Browser globals:
25
27
  factory(
@@ -1,5 +1,5 @@
1
1
  /*
2
- * jQuery File Upload Plugin 5.38.0
2
+ * jQuery File Upload Plugin 5.42.3
3
3
  * https://github.com/blueimp/jQuery-File-Upload
4
4
  *
5
5
  * Copyright 2010, Sebastian Tschan
@@ -9,8 +9,8 @@
9
9
  * http://www.opensource.org/licenses/MIT
10
10
  */
11
11
 
12
- /*jslint nomen: true, unparam: true, regexp: true */
13
- /*global define, window, document, location, File, Blob, FormData */
12
+ /* jshint nomen:false */
13
+ /* global define, require, window, document, location, Blob, FormData */
14
14
 
15
15
  (function (factory) {
16
16
  'use strict';
@@ -20,6 +20,12 @@
20
20
  'jquery',
21
21
  'jquery.ui.widget'
22
22
  ], factory);
23
+ } else if (typeof exports === 'object') {
24
+ // Node/CommonJS:
25
+ factory(
26
+ require('jquery'),
27
+ require('./vendor/jquery.ui.widget')
28
+ );
23
29
  } else {
24
30
  // Browser globals:
25
31
  factory(window.jQuery);
@@ -51,6 +57,25 @@
51
57
  $.support.blobSlice = window.Blob && (Blob.prototype.slice ||
52
58
  Blob.prototype.webkitSlice || Blob.prototype.mozSlice);
53
59
 
60
+ // Helper function to create drag handlers for dragover/dragenter/dragleave:
61
+ function getDragHandler(type) {
62
+ var isDragOver = type === 'dragover';
63
+ return function (e) {
64
+ e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer;
65
+ var dataTransfer = e.dataTransfer;
66
+ if (dataTransfer && $.inArray('Files', dataTransfer.types) !== -1 &&
67
+ this._trigger(
68
+ type,
69
+ $.Event(type, {delegatedEvent: e})
70
+ ) !== false) {
71
+ e.preventDefault();
72
+ if (isDragOver) {
73
+ dataTransfer.dropEffect = 'copy';
74
+ }
75
+ }
76
+ };
77
+ }
78
+
54
79
  // The fileupload widget listens for change events on file input fields defined
55
80
  // via fileInput setting and paste or drop events of the given dropZone.
56
81
  // In addition to the default jQuery Widget methods, the fileupload widget
@@ -65,9 +90,9 @@
65
90
  // The drop target element(s), by the default the complete document.
66
91
  // Set to null to disable drag & drop support:
67
92
  dropZone: $(document),
68
- // The paste target element(s), by the default the complete document.
69
- // Set to null to disable paste support:
70
- pasteZone: $(document),
93
+ // The paste target element(s), by the default undefined.
94
+ // Set to a DOM node or jQuery object to enable file pasting:
95
+ pasteZone: undefined,
71
96
  // The file input field(s), that are listened to for change events.
72
97
  // If undefined, it is set to the file input fields inside
73
98
  // of the widget element on plugin initialization.
@@ -419,7 +444,8 @@
419
444
  file = options.files[0],
420
445
  // Ignore non-multipart setting if not supported:
421
446
  multipart = options.multipart || !$.support.xhrFileUpload,
422
- paramName = options.paramName[0];
447
+ paramName = $.type(options.paramName) === 'array' ?
448
+ options.paramName[0] : options.paramName;
423
449
  options.headers = $.extend({}, options.headers);
424
450
  if (options.contentRange) {
425
451
  options.headers['Content-Range'] = options.contentRange;
@@ -429,7 +455,7 @@
429
455
  encodeURI(file.name) + '"';
430
456
  }
431
457
  if (!multipart) {
432
- options.contentType = file.type;
458
+ options.contentType = file.type || 'application/octet-stream';
433
459
  options.data = options.blob || file;
434
460
  } else if ($.support.xhrFormDataFileUpload) {
435
461
  if (options.postMessage) {
@@ -446,7 +472,8 @@
446
472
  } else {
447
473
  $.each(options.files, function (index, file) {
448
474
  formData.push({
449
- name: options.paramName[index] || paramName,
475
+ name: ($.type(options.paramName) === 'array' &&
476
+ options.paramName[index]) || paramName,
450
477
  value: file
451
478
  });
452
479
  });
@@ -469,7 +496,8 @@
469
496
  if (that._isInstanceOf('File', file) ||
470
497
  that._isInstanceOf('Blob', file)) {
471
498
  formData.append(
472
- options.paramName[index] || paramName,
499
+ ($.type(options.paramName) === 'array' &&
500
+ options.paramName[index]) || paramName,
473
501
  file,
474
502
  file.uploadName || file.name
475
503
  );
@@ -651,7 +679,8 @@
651
679
  return this.jqXHR.abort();
652
680
  }
653
681
  this.errorThrown = 'abort';
654
- return that._getXHRPromise();
682
+ that._trigger('fail', null, this);
683
+ return that._getXHRPromise(false);
655
684
  };
656
685
  data.state = function () {
657
686
  if (this.jqXHR) {
@@ -978,8 +1007,8 @@
978
1007
  for (i = 0; i < filesLength; i = i + 1) {
979
1008
  batchSize += files[i].size + overhead;
980
1009
  if (i + 1 === filesLength ||
981
- (batchSize + files[i + 1].size + overhead) >
982
- limitSize) {
1010
+ ((batchSize + files[i + 1].size + overhead) > limitSize) ||
1011
+ (limit && i + 1 - j >= limit)) {
983
1012
  fileSet.push(files.slice(j, i + 1));
984
1013
  paramNameSlice = paramName.slice(j, i + 1);
985
1014
  if (!paramNameSlice.length) {
@@ -1011,8 +1040,11 @@
1011
1040
  return result;
1012
1041
  },
1013
1042
 
1014
- _replaceFileInput: function (input) {
1015
- var inputClone = input.clone(true);
1043
+ _replaceFileInput: function (data) {
1044
+ var input = data.fileInput,
1045
+ inputClone = input.clone(true);
1046
+ // Add a reference for the new cloned file input to the data argument:
1047
+ data.fileInputClone = inputClone;
1016
1048
  $('<form></form>').append(inputClone)[0].reset();
1017
1049
  // Detaching allows to insert the fileInput on another form
1018
1050
  // without loosing the file input value:
@@ -1048,7 +1080,25 @@
1048
1080
  // to be returned together in one set:
1049
1081
  dfd.resolve([e]);
1050
1082
  },
1051
- dirReader;
1083
+ successHandler = function (entries) {
1084
+ that._handleFileTreeEntries(
1085
+ entries,
1086
+ path + entry.name + '/'
1087
+ ).done(function (files) {
1088
+ dfd.resolve(files);
1089
+ }).fail(errorHandler);
1090
+ },
1091
+ readEntries = function () {
1092
+ dirReader.readEntries(function (results) {
1093
+ if (!results.length) {
1094
+ successHandler(entries);
1095
+ } else {
1096
+ entries = entries.concat(results);
1097
+ readEntries();
1098
+ }
1099
+ }, errorHandler);
1100
+ },
1101
+ dirReader, entries = [];
1052
1102
  path = path || '';
1053
1103
  if (entry.isFile) {
1054
1104
  if (entry._file) {
@@ -1063,14 +1113,7 @@
1063
1113
  }
1064
1114
  } else if (entry.isDirectory) {
1065
1115
  dirReader = entry.createReader();
1066
- dirReader.readEntries(function (entries) {
1067
- that._handleFileTreeEntries(
1068
- entries,
1069
- path + entry.name + '/'
1070
- ).done(function (files) {
1071
- dfd.resolve(files);
1072
- }).fail(errorHandler);
1073
- }, errorHandler);
1116
+ readEntries();
1074
1117
  } else {
1075
1118
  // Return an empy list for file system items
1076
1119
  // other than files or directories:
@@ -1172,7 +1215,7 @@
1172
1215
  this._getFileInputFiles(data.fileInput).always(function (files) {
1173
1216
  data.files = files;
1174
1217
  if (that.options.replaceFileInput) {
1175
- that._replaceFileInput(data.fileInput);
1218
+ that._replaceFileInput(data);
1176
1219
  }
1177
1220
  if (that._trigger(
1178
1221
  'change',
@@ -1225,24 +1268,21 @@
1225
1268
  }
1226
1269
  },
1227
1270
 
1228
- _onDragOver: function (e) {
1229
- e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer;
1230
- var dataTransfer = e.dataTransfer;
1231
- if (dataTransfer && $.inArray('Files', dataTransfer.types) !== -1 &&
1232
- this._trigger(
1233
- 'dragover',
1234
- $.Event('dragover', {delegatedEvent: e})
1235
- ) !== false) {
1236
- e.preventDefault();
1237
- dataTransfer.dropEffect = 'copy';
1238
- }
1239
- },
1271
+ _onDragOver: getDragHandler('dragover'),
1272
+
1273
+ _onDragEnter: getDragHandler('dragenter'),
1274
+
1275
+ _onDragLeave: getDragHandler('dragleave'),
1240
1276
 
1241
1277
  _initEventHandlers: function () {
1242
1278
  if (this._isXHRUpload(this.options)) {
1243
1279
  this._on(this.options.dropZone, {
1244
1280
  dragover: this._onDragOver,
1245
- drop: this._onDrop
1281
+ drop: this._onDrop,
1282
+ // event.preventDefault() on dragenter is required for IE10+:
1283
+ dragenter: this._onDragEnter,
1284
+ // dragleave is not required, but added for completeness:
1285
+ dragleave: this._onDragLeave
1246
1286
  });
1247
1287
  this._on(this.options.pasteZone, {
1248
1288
  paste: this._onPaste
@@ -1256,7 +1296,7 @@
1256
1296
  },
1257
1297
 
1258
1298
  _destroyEventHandlers: function () {
1259
- this._off(this.options.dropZone, 'dragover drop');
1299
+ this._off(this.options.dropZone, 'dragenter dragleave dragover drop');
1260
1300
  this._off(this.options.pasteZone, 'paste');
1261
1301
  this._off(this.options.fileInput, 'change');
1262
1302
  },
@@ -1303,15 +1343,25 @@
1303
1343
 
1304
1344
  _initDataAttributes: function () {
1305
1345
  var that = this,
1306
- options = this.options;
1346
+ options = this.options,
1347
+ data = this.element.data();
1307
1348
  // Initialize options set via HTML5 data-attributes:
1308
1349
  $.each(
1309
- $(this.element[0].cloneNode(false)).data(),
1310
- function (key, value) {
1311
- if (that._isRegExpOption(key, value)) {
1312
- value = that._getRegExp(value);
1350
+ this.element[0].attributes,
1351
+ function (index, attr) {
1352
+ var key = attr.name.toLowerCase(),
1353
+ value;
1354
+ if (/^data-/.test(key)) {
1355
+ // Convert hyphen-ated key to camelCase:
1356
+ key = key.slice(5).replace(/-[a-z]/g, function (str) {
1357
+ return str.charAt(1).toUpperCase();
1358
+ });
1359
+ value = data[key];
1360
+ if (that._isRegExpOption(key, value)) {
1361
+ value = that._getRegExp(value);
1362
+ }
1363
+ options[key] = value;
1313
1364
  }
1314
- options[key] = value;
1315
1365
  }
1316
1366
  );
1317
1367
  },
@@ -1391,7 +1441,8 @@
1391
1441
  return;
1392
1442
  }
1393
1443
  data.files = files;
1394
- jqXHR = that._onSend(null, data).then(
1444
+ jqXHR = that._onSend(null, data);
1445
+ jqXHR.then(
1395
1446
  function (result, textStatus, jqXHR) {
1396
1447
  dfd.resolve(result, textStatus, jqXHR);
1397
1448
  },
@@ -1,5 +1,5 @@
1
1
  /*
2
- * jQuery Iframe Transport Plugin 1.8.1
2
+ * jQuery Iframe Transport Plugin 1.8.3
3
3
  * https://github.com/blueimp/jQuery-File-Upload
4
4
  *
5
5
  * Copyright 2011, Sebastian Tschan
@@ -9,14 +9,16 @@
9
9
  * http://www.opensource.org/licenses/MIT
10
10
  */
11
11
 
12
- /*jslint unparam: true, nomen: true */
13
- /*global define, window, document */
12
+ /* global define, require, window, document */
14
13
 
15
14
  (function (factory) {
16
15
  'use strict';
17
16
  if (typeof define === 'function' && define.amd) {
18
17
  // Register as an anonymous AMD module:
19
18
  define(['jquery'], factory);
19
+ } else if (typeof exports === 'object') {
20
+ // Node/CommonJS:
21
+ factory(require('jquery'));
20
22
  } else {
21
23
  // Browser globals:
22
24
  factory(window.jQuery);
@@ -143,6 +145,8 @@
143
145
  .prop('enctype', 'multipart/form-data')
144
146
  // enctype must be set as encoding for IE:
145
147
  .prop('encoding', 'multipart/form-data');
148
+ // Remove the HTML5 form attribute from the input(s):
149
+ options.fileInput.removeAttr('form');
146
150
  }
147
151
  form.submit();
148
152
  // Insert the file input fields at their original location
@@ -150,7 +154,10 @@
150
154
  if (fileInputClones && fileInputClones.length) {
151
155
  options.fileInput.each(function (index, input) {
152
156
  var clone = $(fileInputClones[index]);
153
- $(input).prop('name', clone.prop('name'));
157
+ // Restore the original name and form properties:
158
+ $(input)
159
+ .prop('name', clone.prop('name'))
160
+ .attr('form', clone.attr('form'));
154
161
  clone.replaceWith(input);
155
162
  });
156
163
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0.rc1
4
+ version: 3.1.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2015-01-15 00:00:00.000000000 Z
15
+ date: 2015-02-20 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: actionpack-page_caching
@@ -449,6 +449,7 @@ files:
449
449
  - ".editorconfig"
450
450
  - ".gitignore"
451
451
  - ".rspec"
452
+ - ".teatro.yml"
452
453
  - ".travis.yml"
453
454
  - ".yardopts"
454
455
  - CONTRIBUTING.md
@@ -910,7 +911,6 @@ files:
910
911
  - lib/alchemy/userstamp.rb
911
912
  - lib/alchemy/version.rb
912
913
  - lib/alchemy_cms.rb
913
- - lib/extensions/action_view.rb
914
914
  - lib/rails/generators/alchemy/base.rb
915
915
  - lib/rails/generators/alchemy/deploy_script/deploy_script_generator.rb
916
916
  - lib/rails/generators/alchemy/deploy_script/templates/deploy.rb.tt
@@ -1032,6 +1032,7 @@ files:
1032
1032
  - spec/dummy/db/migrate/20140701160159_add_taggings_counter_cache_to_tags.rb
1033
1033
  - spec/dummy/db/migrate/20140701160225_add_missing_taggable_index.rb
1034
1034
  - spec/dummy/db/schema.rb
1035
+ - spec/dummy/db/seeds.rb
1035
1036
  - spec/dummy/lib/assets/.gitkeep
1036
1037
  - spec/dummy/public/404.html
1037
1038
  - spec/dummy/public/422.html
@@ -1217,7 +1218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1217
1218
  requirements:
1218
1219
  - ImageMagick (libmagick), v6.6 or greater.
1219
1220
  rubyforge_project:
1220
- rubygems_version: 2.4.5
1221
+ rubygems_version: 2.4.3
1221
1222
  signing_key:
1222
1223
  specification_version: 4
1223
1224
  summary: A powerful, userfriendly and flexible CMS for Rails 4
@@ -1301,6 +1302,7 @@ test_files:
1301
1302
  - spec/dummy/db/migrate/20140701160159_add_taggings_counter_cache_to_tags.rb
1302
1303
  - spec/dummy/db/migrate/20140701160225_add_missing_taggable_index.rb
1303
1304
  - spec/dummy/db/schema.rb
1305
+ - spec/dummy/db/seeds.rb
1304
1306
  - spec/dummy/lib/assets/.gitkeep
1305
1307
  - spec/dummy/public/404.html
1306
1308
  - spec/dummy/public/422.html