infopark_fiona7 1.2.0.2.3 → 1.5.2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +33 -0
  3. data/app/assets/javascripts/fiona7_ui.js +82 -23
  4. data/app/assets/javascripts/scrivito_patches/ajax.js +222 -0
  5. data/app/assets/javascripts/scrivito_patches/ajax_error_handling.js +24 -0
  6. data/app/assets/javascripts/scrivito_patches/attribute_serializer.js +259 -0
  7. data/app/assets/javascripts/scrivito_patches/base_obj_path.js +17 -0
  8. data/app/assets/javascripts/scrivito_patches/binary_utils.js +33 -0
  9. data/app/assets/javascripts/scrivito_patches/cms_rest_api.js +490 -0
  10. data/app/assets/javascripts/scrivito_patches/models/api/basic_obj.js +650 -0
  11. data/app/assets/javascripts/scrivito_patches/models/binary_field_element.js +53 -0
  12. data/app/assets/javascripts/scrivito_patches/models/obj.js +74 -239
  13. data/app/assets/javascripts/scrivito_patches/obj_serializer.js +91 -0
  14. data/app/assets/stylesheets/fiona7.css.scss +12 -0
  15. data/app/assets/stylesheets/fiona7_ui.css.scss +18 -0
  16. data/app/controllers/fiona7/api_controller.rb +20 -0
  17. data/app/controllers/fiona7/sessions_controller.rb +2 -10
  18. data/app/controllers/fiona7_login_page_controller.rb +0 -3
  19. data/app/controllers/scrivito/obj_class_controller.rb +58 -0
  20. data/app/controllers/scrivito/objs_controller.rb +2 -38
  21. data/app/helpers/fiona7_override_helper.rb +25 -0
  22. data/app/views/fiona7/release/preview.html.erb +1 -1
  23. data/app/views/fiona7_login_page/index.html.erb +0 -6
  24. data/app/views/scrivito/ui/index.html.erb +2 -1
  25. data/app/views/scrivito/webservice/_workspace.json.jbuilder +8 -0
  26. data/config/locales/errors.yml +18 -0
  27. data/config/locales/workflow.yml +24 -0
  28. data/config/precedence_routes.rb +7 -14
  29. data/infopark_fiona7.gemspec +6 -4
  30. data/lib/fiona7/assert.rb +2 -2
  31. data/lib/fiona7/attribute_readers/factory.rb +4 -0
  32. data/lib/fiona7/attribute_type_mapper.rb +4 -1
  33. data/lib/fiona7/attribute_writers/binary_as_binary.rb +2 -2
  34. data/lib/fiona7/attribute_writers/binary_as_linklist.rb +2 -2
  35. data/lib/fiona7/attribute_writers/factory.rb +4 -0
  36. data/lib/fiona7/builder/indirect_blob_builder.rb +2 -2
  37. data/lib/fiona7/builder/lazy_blob_copier.rb +1 -1
  38. data/lib/fiona7/builder/obj_builder.rb +45 -12
  39. data/lib/fiona7/controllers/rest_api/error_handler.rb +49 -0
  40. data/lib/fiona7/controllers/rest_api/obj_controller.rb +34 -20
  41. data/lib/fiona7/controllers/rest_api/session_controller.rb +13 -0
  42. data/lib/fiona7/engine.rb +7 -10
  43. data/lib/fiona7/facet_builder.rb +5 -1
  44. data/lib/fiona7/naive_search_engine.rb +9 -0
  45. data/lib/fiona7/routers/rest_api.rb +17 -0
  46. data/lib/fiona7/scrivito_patches/attribute_content.rb +28 -0
  47. data/lib/fiona7/scrivito_patches/cms_routing.rb +14 -31
  48. data/lib/fiona7/scrivito_patches/page_config.rb +1 -0
  49. data/lib/fiona7/scrivito_user.rb +3 -2
  50. data/lib/fiona7/type_register.rb +4 -0
  51. data/lib/fiona7/verity_search_engine.rb +6 -17
  52. data/lib/fiona7/version.rb +1 -1
  53. data/lib/fiona7/workspace.rb +2 -0
  54. metadata +28 -14
  55. data/app/assets/javascripts/scrivito_patches/models/ajax.js +0 -99
  56. data/app/assets/javascripts/scrivito_patches/models/blob.js +0 -50
@@ -1,99 +0,0 @@
1
- (function() {
2
- var handle_task = function(task) {
3
- switch (task.status) {
4
- case 'success':
5
- return $.Deferred().resolve(task.result);
6
- case 'error':
7
- return $.Deferred().reject({
8
- message: task.message,
9
- code: task.code
10
- });
11
- case 'open':
12
- return scrivito.wait(2).then(function() {
13
- return single_ajax('GET', 'tasks/' + task.id).then(function(data) {
14
- return handle_task(data);
15
- });
16
- });
17
- default:
18
- throw { message: "Invalid task (unknown status)", task: task };
19
- }
20
- };
21
-
22
- var single_ajax = function(type, path, options) {
23
- var base_url = window.location.protocol + '//' + window.location.host + '/__scrivito/';
24
- if (options && options.data) {
25
- options.data = JSON.stringify(options.data);
26
- }
27
- return $.ajax(base_url + path, _.extend({
28
- type: type,
29
- dataType: 'json',
30
- contentType: 'application/json; charset=utf-8',
31
- cache: false // Don't cache GET requests.
32
- }, options || {})).then(
33
- function(result, text_status, xhr) {
34
- return $.Deferred().resolve(result);
35
- }, function(xhr, text_status, xhr_error) {
36
- try {
37
- return $.Deferred().reject(JSON.parse(xhr.responseText));
38
- } catch (SyntaxError) {
39
- return $.Deferred().reject(xhr_error);
40
- }
41
- }
42
- );
43
- };
44
-
45
- _.extend(scrivito, {
46
- silent_ajax: function(type, path, options) {
47
- var is_write_request = type === 'PUT' || type === 'POST' || type === 'DELETE';
48
- if (is_write_request) {
49
- options = options || {};
50
- // HIGHER TIMEOUT HERE!
51
- options.timeout = 60000; // miliseconds
52
- scrivito.write_monitor.start_write();
53
- }
54
-
55
- var ajax_promise = single_ajax(type, path, options).then(function(result) {
56
- if (result && result.task && _.size(result) === 1) {
57
- return handle_task(result.task);
58
- } else {
59
- return $.Deferred().resolve(result);
60
- }
61
- });
62
-
63
- if (is_write_request) {
64
- ajax_promise.always(function() {
65
- scrivito.write_monitor.end_write();
66
- });
67
- }
68
-
69
- return ajax_promise;
70
- },
71
-
72
- ajax: function(type, path, options) {
73
- return scrivito.silent_ajax(type, path, options).fail(function(error) {
74
- scrivito.display_ajax_error(error);
75
- });
76
- },
77
-
78
- display_ajax_error: function(error) {
79
- var message, message_for_editor;
80
-
81
- if (_.isObject(error)) {
82
- message = scrivito.t('ajax.error', error.message);
83
- message_for_editor = error.message_for_editor;
84
- } else if (_.contains(['abort', 'parsererror', 'timeout'], error)) {
85
- message = scrivito.t('ajax.error.communication');
86
- } else {
87
- message = scrivito.t('ajax.error', error);
88
- }
89
-
90
- if (scrivito.is_development_mode) {
91
- scrivito.alert_dialog(message);
92
- } else {
93
- scrivito.log_error(message);
94
- scrivito.error_dialog(message_for_editor || scrivito.t('ajax.error.message_for_editor'),
95
- [error.timestamp, message]);
96
- }
97
- }
98
- });
99
- }());
@@ -1,50 +0,0 @@
1
- (function() {
2
- _.extend(scrivito, {
3
- blob: {
4
- create: function(obj_id, binary) {
5
- var uploaded_binary = binary.is_uploaded_binary ? binary : scrivito.blob.upload_binary(binary);
6
- return $.Deferred().resolve(uploaded_binary);
7
- },
8
-
9
- // For testing purpose only.
10
- get_form_data: function() {
11
- return new FormData();
12
- },
13
-
14
- upload_binary: function(params) {
15
- var blob = params.blob || params.file;
16
- if (!blob) { $.error('need blob or file'); }
17
- if (!params.content_type) { params.content_type = blob.type; }
18
- if (!params.filename) {
19
- if (params.blob) { $.error('blob needs a filename'); }
20
- params.filename = blob.name;
21
- }
22
- params.filename = params.filename.replace(/[^\w\-_\.$]/g, '-');
23
-
24
- return $.extend(params, {is_uploaded_binary: true});
25
- },
26
-
27
- copy_binary: function(id, obj_id, attr_name, params) {
28
- assert_valid_params(params);
29
-
30
- return _.extend({
31
- is_copied_binary: true,
32
- id_to_copy: id,
33
- obj_id: obj_id,
34
- attr_name: attr_name
35
- }, params);
36
- }
37
- }
38
- });
39
-
40
-
41
- var assert_valid_params = function(params) {
42
- if (_.has(params, 'filename') && !params.filename) {
43
- $.error('filename cannot be blank');
44
- }
45
-
46
- if (_.has(params, 'content_type') && !params.content_type) {
47
- $.error('content_type cannot be blank');
48
- }
49
- };
50
- }());