infopark_fiona7 1.2.0.1.3 → 1.2.0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fiona7/builder/obj_builder.rb +11 -1
- data/lib/fiona7/version.rb +1 -1
- metadata +2 -10
- data/app/assets/javascripts/fiona7/templates.js +0 -106
- data/app/assets/javascripts/scrivito_patches/ajax_error_handling.js +0 -24
- data/app/assets/javascripts/scrivito_patches/attribute_serializer.js +0 -259
- data/app/assets/javascripts/scrivito_patches/binary_utils.js +0 -33
- data/app/assets/javascripts/scrivito_patches/cms_rest_api.js +0 -490
- data/app/assets/javascripts/scrivito_patches/models/api/basic_obj.js +0 -650
- data/app/assets/javascripts/scrivito_patches/models/binary_field_element.js +0 -53
- data/app/assets/javascripts/scrivito_patches/obj_serializer.js +0 -91
@@ -1,53 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
(function () {
|
4
|
-
// -- PATCH BEGINS HERE --
|
5
|
-
// remove old scrivito.binaryFieldElement
|
6
|
-
var definitions = scrivito.cms_element.definitions;
|
7
|
-
for (var i = 0; i < definitions.length; ++i) {
|
8
|
-
if (definitions[i] === scrivito.binaryFieldElement) {
|
9
|
-
definitions.splice(i, 1);
|
10
|
-
break;
|
11
|
-
}
|
12
|
-
}
|
13
|
-
// -- PATCH ENDS HERE --
|
14
|
-
|
15
|
-
scrivito.binaryFieldElement = {
|
16
|
-
create_instance: function create_instance(cmsElement) {
|
17
|
-
if (cmsElement.dom_element().attr('data-scrivito-field-type') === 'binary') {
|
18
|
-
var that = scrivito.cms_field_element.create_instance(cmsElement);
|
19
|
-
// -- PATCH BEGINS HERE --
|
20
|
-
/*
|
21
|
-
const bufferedWriter = new scrivito.BufferedWriter((value) => {
|
22
|
-
if (scrivito.BinaryUtils.isFile(value)) {
|
23
|
-
return scrivito.Binary.upload(value).into(that.basic_obj());
|
24
|
-
}
|
25
|
-
if (value instanceof scrivito.FutureBinary) {
|
26
|
-
return value.into(that.basic_obj());
|
27
|
-
}
|
28
|
-
return scrivito.Promise.resolve(value);
|
29
|
-
});
|
30
|
-
_.extend(that, {
|
31
|
-
preprocess(value) {
|
32
|
-
return bufferedWriter.write(value).catch((error) => {
|
33
|
-
scrivito.handleAjaxError(error);
|
34
|
-
throw error;
|
35
|
-
});
|
36
|
-
},
|
37
|
-
});
|
38
|
-
*/
|
39
|
-
|
40
|
-
_.extend(that, {
|
41
|
-
preprocess: function preprocess(value) {
|
42
|
-
return scrivito.Promise.resolve(value);
|
43
|
-
}
|
44
|
-
});
|
45
|
-
// -- PATCH ENDS HERE --
|
46
|
-
|
47
|
-
return that;
|
48
|
-
}
|
49
|
-
}
|
50
|
-
};
|
51
|
-
|
52
|
-
scrivito.cms_element.definitions.push(scrivito.binaryFieldElement);
|
53
|
-
})();
|
@@ -1,91 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
(function () {
|
4
|
-
scrivito.ObjSerializer = {
|
5
|
-
serialize: function serialize(objId, attrs) {
|
6
|
-
var promise = serializeWidgetPool(objId, attrs._widget_pool).then(function (widgetPool) {
|
7
|
-
return serializeAttrs(objId, attrs).then(function (serializedAttrs) {
|
8
|
-
if (widgetPool) {
|
9
|
-
serializedAttrs._widget_pool = widgetPool;
|
10
|
-
}
|
11
|
-
return serializedAttrs;
|
12
|
-
});
|
13
|
-
});
|
14
|
-
|
15
|
-
return scrivito.promise.wrapInJqueryDeferred(promise);
|
16
|
-
},
|
17
|
-
|
18
|
-
serializeValue: function serializeValue(value) {
|
19
|
-
if (_.isDate(value)) {
|
20
|
-
return moment.utc(value).toISOString();
|
21
|
-
}
|
22
|
-
|
23
|
-
return value;
|
24
|
-
}
|
25
|
-
};
|
26
|
-
|
27
|
-
function serializeWidgetPool(objId, widgetPool) {
|
28
|
-
if (widgetPool) {
|
29
|
-
var promises = _.map(widgetPool, function (attrs, widgetId) {
|
30
|
-
return serializeAttrs(objId, attrs).then(function (serializedAttrs) {
|
31
|
-
return [widgetId, serializedAttrs];
|
32
|
-
});
|
33
|
-
});
|
34
|
-
|
35
|
-
return scrivito.Promise.all(promises).then(function (serializedWidgetPool) {
|
36
|
-
return _.object(serializedWidgetPool);
|
37
|
-
});
|
38
|
-
}
|
39
|
-
|
40
|
-
return scrivito.Promise.resolve(widgetPool);
|
41
|
-
}
|
42
|
-
|
43
|
-
function serializeAttrs(objId, attrs) {
|
44
|
-
var promises = _.map(attrs, function (attrValue, attrName) {
|
45
|
-
return serializeAttr(objId, attrName, attrValue);
|
46
|
-
});
|
47
|
-
|
48
|
-
return scrivito.Promise.all(promises).then(function (serializedAttrs) {
|
49
|
-
return _.object(serializedAttrs);
|
50
|
-
});
|
51
|
-
}
|
52
|
-
|
53
|
-
function serializeAttr(objId, attrName, attrValue) {
|
54
|
-
if (scrivito.BinaryUtils.isFile(attrValue) || scrivito.BinaryUtils.isBlob(attrValue)) {
|
55
|
-
return serializeFile(objId, attrName, attrValue);
|
56
|
-
}
|
57
|
-
|
58
|
-
if (attrValue instanceof scrivito.UploadedBlob) {
|
59
|
-
return serializeUploadedBlob(objId, attrName, attrValue);
|
60
|
-
}
|
61
|
-
|
62
|
-
if (attrValue instanceof scrivito.FutureBinary) {
|
63
|
-
return serializeFutureBinary(objId, attrName, attrValue);
|
64
|
-
}
|
65
|
-
|
66
|
-
return scrivito.Promise.resolve([attrName, scrivito.ObjSerializer.serializeValue(attrValue)]);
|
67
|
-
}
|
68
|
-
|
69
|
-
function serializeFile(objId, attrName, file) {
|
70
|
-
return scrivito.Promise.resolve([attrName, file]); // <-- PATCH HERE
|
71
|
-
}
|
72
|
-
|
73
|
-
function serializeUploadedBlob(objId, attrName, uploadedBlob) {
|
74
|
-
return serializeFutureBinary(objId, attrName, uploadedBlob.copy());
|
75
|
-
}
|
76
|
-
|
77
|
-
function serializeFutureBinary(objId, attrName, futureBinary) {
|
78
|
-
if (futureBinary.idToCopy) {
|
79
|
-
// blob copy/rename
|
80
|
-
var blob = {
|
81
|
-
id_to_copy: futureBinary.idToCopy
|
82
|
-
};
|
83
|
-
if (futureBinary.filename) blob.filename = futureBinary.filename;
|
84
|
-
if (futureBinary.contentType) blob.content_type = futureBinary.contentType;
|
85
|
-
return scrivito.Promise.resolve([attrName, blob]);
|
86
|
-
} else if (futureBinary.source) {
|
87
|
-
// normal upload
|
88
|
-
return scrivito.Promise.resolve([attrName, { blob_to_upload: futureBinary.source, filename: futureBinary.filename }]);
|
89
|
-
}
|
90
|
-
}
|
91
|
-
})();
|