infopark_fiona7 1.1.0.0.1 → 1.1.0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f2c3e364d5e39d0844287d7eefd244b83d81260
4
- data.tar.gz: 9c5331a3c8b87c467ad2b6226ac68f482bffbf64
3
+ metadata.gz: 2aa4f95c72dbb1df2df30eb2aecf812eeadfbe0e
4
+ data.tar.gz: b2b9ba8c7221323adb1aaa6b9cf2dcf4001e8959
5
5
  SHA512:
6
- metadata.gz: 59c6e931fc61fb8921902ab9c82bdc626762db927346169aa5d9a6de8cee4cd71e8d49387159d2ea795c914f855063ebeb6a81c174ef05f9a3c319695502bfd0
7
- data.tar.gz: 6a092b319da7f9a35f4662b8da1935fbb999d4a6300b6c289e3debf79f0c7b4af3e8142da3135449b061ccbc6792e1565dfac65c0db9210f411fe08fa6447c34
6
+ metadata.gz: aca73230bef220c3bf97df405f9e6d83c4df11860856ac91db5dde5a40dfe4fd269e15253339e8fd68232b06ccb63e66681497c9392d88a05fb15caf5e23e128
7
+ data.tar.gz: 566f30c2e5dd1a29086b8e36639c9045b7e8886e6b996ef9661f980fcc18c4d1f1725661a4523e5f57bea637474174f86d0a6fbef3f2ff32413f4890e4a175a7
@@ -32,23 +32,12 @@
32
32
  }, options || {})).then(
33
33
  function(result, text_status, xhr) {
34
34
  return $.Deferred().resolve(result);
35
- }, function(xhr, text_status, error) {
36
- var error_message;
37
- var error_code;
35
+ }, function(xhr, text_status, xhr_error) {
38
36
  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;
37
+ return $.Deferred().reject(JSON.parse(xhr.responseText));
38
+ } catch (SyntaxError) {
39
+ return $.Deferred().reject(xhr_error);
46
40
  }
47
- return $.Deferred().reject({
48
- status: xhr.status,
49
- message: error_message,
50
- code: error_code
51
- });
52
41
  }
53
42
  );
54
43
  };
@@ -59,7 +48,7 @@
59
48
  if (is_write_request) {
60
49
  options = options || {};
61
50
  // HIGHER TIMEOUT HERE!
62
- options.timeout = 45000; // miliseconds
51
+ options.timeout = 60000; // miliseconds
63
52
  scrivito.write_monitor.start_write();
64
53
  }
65
54
 
@@ -87,23 +76,23 @@
87
76
  },
88
77
 
89
78
  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);
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');
98
86
  } else {
99
- error_message = scrivito.t('ajax.error.unknown');
87
+ message = scrivito.t('ajax.error', error);
100
88
  }
101
89
 
102
90
  if (scrivito.is_development_mode) {
103
- scrivito.alert_dialog(error_message);
91
+ scrivito.alert_dialog(message);
104
92
  } else {
105
- scrivito.log_error(error_message);
106
- scrivito.info_dialog(scrivito.t('ajax.error.production'));
93
+ scrivito.log_error(message);
94
+ scrivito.error_dialog(message_for_editor || scrivito.t('ajax.error.message_for_editor'),
95
+ [error.timestamp, message]);
107
96
  }
108
97
  }
109
98
  });
@@ -15,6 +15,7 @@ module Fiona7
15
15
  end
16
16
  end
17
17
 
18
+ ensure
18
19
  render json: {}
19
20
  end
20
21
 
data/lib/fiona7/engine.rb CHANGED
@@ -32,6 +32,7 @@ require "fiona7/scrivito_patches/layout_tags"
32
32
  require "fiona7/scrivito_patches/log_subscriber"
33
33
  require "fiona7/scrivito_patches/link_parser"
34
34
  require "fiona7/scrivito_patches/migrator"
35
+ require "fiona7/scrivito_patches/obj_params_parser"
35
36
  require "fiona7/scrivito_patches/page_config"
36
37
  require "fiona7/scrivito_patches/preset_routes"
37
38
  require "fiona7/scrivito_patches/routing_extensions"
@@ -86,6 +86,22 @@ module Scrivito
86
86
 
87
87
  def inherited(subclass,*args)
88
88
  super
89
+ # Under certain condition a circular dependency may arise in rails when
90
+ # loading classes, especially when eager_load = true
91
+ # Thusfar it has only been observed in standalone-mode thus far:
92
+ # Loading Obj < Scrivito::BasicObj triggers this hook
93
+ # which tries to set RailsConnector::Obj to a reasonable value,
94
+ # RailsConnector::AbstractObj provided by reactor.
95
+ # RailsConnector::AbstractObj tries set itself to couple of
96
+ # values, one of which is ::Obj
97
+ # If this occurs with eager_load = true Rails may get confused
98
+ # and trigger circular dependency error.
99
+ # We work around this problem by hijacking intelligent initialization
100
+ # of RailsConnector::AbstractObj in reactor and set it to a
101
+ # desired value ourselves.
102
+ if subclass.name == 'Obj' && !::RailsConnector.const_defined?('AbstractObj', false)
103
+ ::RailsConnector.const_set('AbstractObj', ::RailsConnector::BasicObj)
104
+ end
89
105
  if subclass.name == 'Obj' && !::RailsConnector.const_defined?('Obj', false)
90
106
  ::RailsConnector.const_set('Obj', ::RailsConnector::AbstractObj)
91
107
  end
@@ -46,9 +46,13 @@ module Scrivito
46
46
  # use fiona connector routes when possible
47
47
  if Fiona7.mode == :legacy
48
48
  if binary = obj.binary
49
- obj_id = obj.id
49
+ params = {
50
+ id: obj.id,
51
+ slug: obj.slug,
52
+ format: obj.file_extension
53
+ }
50
54
 
51
- context.public_send("cms_id_#{path_or_url}", {id: obj_id, slug: binary.filename})
55
+ context.public_send("cms_id_#{path_or_url}", params)
52
56
  else
53
57
  LINK_TO_EMPTY_BLOB
54
58
  end
@@ -0,0 +1,20 @@
1
+ require "scrivito/obj_params_parser"
2
+
3
+
4
+ module Scrivito
5
+ class ObjParamsParser
6
+ private
7
+ def parse_binary_params(params)
8
+ return unless params
9
+
10
+ if params.kind_of?(Hash) && params[:copy]
11
+ parse_copy_binary_params(params[:copy])
12
+ else
13
+ # Uploaded binary may contain anything at this point
14
+ # an ID (string) or a File or even UploadedFile
15
+ # but the backed will sort this out
16
+ UploadedBinary.new(params)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -1,3 +1,3 @@
1
1
  module Fiona7
2
- VERSION = "1.1.0.0.1"
2
+ VERSION = "1.1.0.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infopark_fiona7
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0.0.1
4
+ version: 1.1.0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomasz Przedmojski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-22 00:00:00.000000000 Z
11
+ date: 2016-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -234,6 +234,7 @@ files:
234
234
  - lib/fiona7/scrivito_patches/link_parser.rb
235
235
  - lib/fiona7/scrivito_patches/log_subscriber.rb
236
236
  - lib/fiona7/scrivito_patches/migrator.rb
237
+ - lib/fiona7/scrivito_patches/obj_params_parser.rb
237
238
  - lib/fiona7/scrivito_patches/page_config.rb
238
239
  - lib/fiona7/scrivito_patches/preset_routes.rb
239
240
  - lib/fiona7/scrivito_patches/routing_extensions.rb