infopark_fiona7 0.71.0.2 → 0.71.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c163e4ae3c26083dadf3475c69352f2780b734e5
4
- data.tar.gz: 7ca74e654c1cc5be22228ea3a5390c3cb4f905b0
3
+ metadata.gz: 4619dc5e8bf5eb3dd97371dff2649fc8f5ec0132
4
+ data.tar.gz: 5e991611b12dfd0495a3f61b710c49da1f21e9b9
5
5
  SHA512:
6
- metadata.gz: f8f4e8b445dbf0ec6c49d46982e9510c375824e87be92ca9899cc6f82221083ddc007af5debe1f546ae51bc16415262eb70b6070b9d19e9da655758bc2886abd
7
- data.tar.gz: 725e89fc43efd18b17a71fa5ee5049fe6fa6805ed0fc29369424489d33659425b1c830201ac26e045126668b2a57a2c9b218718ce39ab82384e172c82addaeb8
6
+ metadata.gz: c9a406c89e791f21722a8401317692b8a786d41d76cdc1790dc615842405349d60f21c455b18e8c2d0e34f4dd1cd6c91cd8ae3482c9757fc8d3b55fbdaaaed45
7
+ data.tar.gz: a3c4c6a56e68cb1b0c12fb0c98b74f8a498371c679c5e1a8897cc4160b105afe49321bf29c7bc83298bc4236714806df85314ba88374cb2532158a9157d33b0e
@@ -1,3 +1,4 @@
1
+ //= require scrivito_patches/models/ajax
1
2
  //= require scrivito_patches/models/blob
2
3
  //= require scrivito_patches/models/obj
3
4
  //= require_self
@@ -0,0 +1,110 @@
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, error) {
36
+ var error_message;
37
+ var error_code;
38
+ try {
39
+ var error_json = JSON.parse(xhr.responseText);
40
+ error_message = error_json.error;
41
+ error_code = error_json.code;
42
+ } catch (SyntaxError) {}
43
+
44
+ if (!error_message) {
45
+ error_message = error;
46
+ }
47
+ return $.Deferred().reject({
48
+ status: xhr.status,
49
+ message: error_message,
50
+ code: error_code
51
+ });
52
+ }
53
+ );
54
+ };
55
+
56
+ _.extend(scrivito, {
57
+ silent_ajax: function(type, path, options) {
58
+ var is_write_request = type === 'PUT' || type === 'POST' || type === 'DELETE';
59
+ if (is_write_request) {
60
+ options = options || {};
61
+ // HIGHER TIMEOUT HERE!
62
+ options.timeout = 45000; // miliseconds
63
+ scrivito.write_monitor.start_write();
64
+ }
65
+
66
+ var ajax_promise = single_ajax(type, path, options).then(function(result) {
67
+ if (result && result.task && _.size(result) === 1) {
68
+ return handle_task(result.task);
69
+ } else {
70
+ return $.Deferred().resolve(result);
71
+ }
72
+ });
73
+
74
+ if (is_write_request) {
75
+ ajax_promise.always(function() {
76
+ scrivito.write_monitor.end_write();
77
+ });
78
+ }
79
+
80
+ return ajax_promise;
81
+ },
82
+
83
+ ajax: function(type, path, options) {
84
+ return scrivito.silent_ajax(type, path, options).fail(function(error) {
85
+ scrivito.display_ajax_error(error);
86
+ });
87
+ },
88
+
89
+ display_ajax_error: function(error) {
90
+ var ajax_error = error.message;
91
+ var error_message;
92
+ if (_.contains(['abort', 'parsererror', 'timeout'], ajax_error)) {
93
+ error_message = scrivito.t('ajax.error.communication');
94
+ } else if (ajax_error === 'error') {
95
+ error_message = scrivito.t('ajax.error.unknown');
96
+ } else if (ajax_error) {
97
+ error_message = scrivito.t('ajax.error', ajax_error);
98
+ } else {
99
+ error_message = scrivito.t('ajax.error.unknown');
100
+ }
101
+
102
+ if (scrivito.is_development_mode) {
103
+ scrivito.alert_dialog(error_message);
104
+ } else {
105
+ scrivito.log_error(error_message);
106
+ scrivito.info_dialog(scrivito.t('ajax.error.production'));
107
+ }
108
+ }
109
+ });
110
+ }());
@@ -12,7 +12,12 @@ module Fiona7
12
12
  private
13
13
  def serialize_html
14
14
  # TODO: this an incomplete list of possible tags
15
- link_expressions = [/(href)\s*=\s*"([^"]*)"/, /(href)\s*=\s*'([^']*)'/]
15
+ if Fiona7.mode == :legacy
16
+ link_expressions = [/(src|href)\s*=\s*"([^"]*)"/, /(src|href)\s*=\s*'([^']*)'/]
17
+ else
18
+ # in standalone mode image links cannot be stored correctly
19
+ link_expressions = [/(href)\s*=\s*"([^"]*)"/, /(href)\s*=\s*'([^']*)'/]
20
+ end
16
21
  link_expressions.each do |expr|
17
22
  @value.gsub!(expr) do |string|
18
23
  target = $2
@@ -1,3 +1,3 @@
1
1
  module Fiona7
2
- VERSION = "0.71.0.2"
2
+ VERSION = "0.71.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infopark_fiona7
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.71.0.2
4
+ version: 0.71.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomasz Przedmojski
@@ -135,6 +135,7 @@ files:
135
135
  - app/assets/images/fiona7-marker.png
136
136
  - app/assets/javascripts/fiona7.js
137
137
  - app/assets/javascripts/fiona7_ui.js
138
+ - app/assets/javascripts/scrivito_patches/models/ajax.js
138
139
  - app/assets/javascripts/scrivito_patches/models/blob.js
139
140
  - app/assets/javascripts/scrivito_patches/models/obj.js
140
141
  - app/assets/stylesheets/fiona7-login.css.scss