releaf-core 1.0.7 → 1.0.8

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: caa51462640dfd02c79db2739e243a186e5eda21
4
- data.tar.gz: c56c3e6b6c9e7c241e546f7f0621fa88f34c0b25
3
+ metadata.gz: 538481e57c3f24123c105f587d1d8c479eca0bd8
4
+ data.tar.gz: 793115a36832068d18e15d31cfdc98b7a7995878
5
5
  SHA512:
6
- metadata.gz: 8f2c5a09276dbe3bf41a9092ad7062a0762e6842dba91faf90e6702a3a34d758b453c9602c0bae4e75b092cb1255ab1962bdd486e7f27285d06cb2cf2a082d6d
7
- data.tar.gz: f5e0b67f4c3acf71cb0a160e41186d278f2f52705d8ac7817d93ef1c88d06a33ad733bc167f436d8444fab8d0cd60b5b1df9eb49ccc2d7284e7de84248509cb4
6
+ metadata.gz: 7beed131ea67faca2aa6e570c69b5a46fcbc08480510bfcdf5916768172f31a326a2ed558ee7bd18f20600c7e2906f4db0e7b7cd38d7eaccbf29c03cbcaaa976
7
+ data.tar.gz: d8e5e6979edb82acd8271230bf82fe213e0bb353bed76d6bd28f91627cdff0c1f1f50ce6b3144407494226f12a2153886872d92f983fb35346c29d31f6bcb20e
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012, CubeSystems <info@cubesystems.lv>
1
+ Copyright (c) 2017, CubeSystems <info@cubesystems.lv>
2
2
 
3
3
  MIT License
4
4
 
@@ -57,20 +57,6 @@ var RemoteValidator = function( form )
57
57
 
58
58
  switch (xhr.status)
59
59
  {
60
- case 303:
61
- // validation + saving ok
62
- try {
63
- json_response = jQuery.parseJSON(xhr.responseText);
64
- }
65
- catch(error)
66
- {
67
- v.form.trigger( 'validation:fail', [ v, event_params ] );
68
- break;
69
- }
70
- event_params.response = json_response;
71
- v.form.trigger( 'validation:ok', [ v, event_params ] );
72
- break;
73
-
74
60
  case 200:
75
61
  // validation ok
76
62
  event_params.response = xhr;
@@ -147,19 +133,17 @@ var RemoteValidator = function( form )
147
133
  return;
148
134
  }
149
135
 
150
- if ('url' in event_params.response)
151
- {
152
- // json redirect url received
153
- event.preventDefault(); // prevent validator's built in submit_form on ok
154
- document.location.href = event_params.response.url;
155
- }
156
- else if ('getResponseHeader' in event_params.response)
136
+ event.preventDefault(); // prevent validator's built in submit_form on ok
137
+
138
+ // use new url
139
+ if(document.location.href !== event_params.response.responseURL)
157
140
  {
158
- event.preventDefault(); // prevent validator's built in submit_form on ok
159
- body.trigger('contentreplace', [ event_params.response, "> header" ]);
160
- body.trigger('contentreplace', [ event_params.response, "> aside" ]);
161
- body.trigger('contentreplace', [ event_params.response, "> main" ]);
141
+ history.pushState(null, null, event_params.response.responseURL);
162
142
  }
143
+
144
+ body.trigger('contentreplace', [ event_params.response, "> header" ]);
145
+ body.trigger('contentreplace', [ event_params.response, "> aside" ]);
146
+ body.trigger('contentreplace', [ event_params.response, "> main" ]);
163
147
  });
164
148
 
165
149
  v.form.on( 'validation:error', function( event, v, event_params )
@@ -9,8 +9,6 @@ module Releaf::Responders
9
9
  def to_json
10
10
  if has_errors?
11
11
  display_errors
12
- elsif options[:redirect]
13
- render json: {url: resource_location}, status: 303
14
12
  else
15
13
  redirect_to resource_location, status: 303, turbolinks: false
16
14
  end
@@ -77,27 +77,12 @@ describe Releaf::Responders::AfterSaveResponder, type: :controller do
77
77
  end
78
78
 
79
79
  context "when resource has no errors" do
80
- before do
80
+ it "redirects to resource location with status code `303`" do
81
81
  allow(subject).to receive(:resource_location).and_return("some_url")
82
82
  allow(subject).to receive(:has_errors?).and_return(false)
83
- end
84
-
85
- context "when options has :redirect key" do
86
- it "returns json with resource location url and status code `303`" do
87
- allow(subject).to receive(:options).and_return(redirect: true)
88
- expect(subject).to receive(:render).with(json: {url: "some_url"}, status: 303)
89
- subject.to_json
90
- end
91
- end
92
-
93
- context "when options has no :redirect key" do
94
- it "redirects to resource location with status code `303`" do
95
- allow(subject).to receive(:options).and_return({})
96
- expect(subject).to receive(:redirect_to).with("some_url", status: 303, turbolinks: false)
97
- subject.to_json
98
- end
83
+ expect(subject).to receive(:redirect_to).with("some_url", status: 303, turbolinks: false)
84
+ subject.to_json
99
85
  end
100
86
  end
101
87
  end
102
88
  end
103
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: releaf-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - CubeSystems
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-28 00:00:00.000000000 Z
11
+ date: 2017-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -630,7 +630,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
630
630
  version: '0'
631
631
  requirements: []
632
632
  rubyforge_project:
633
- rubygems_version: 2.6.7
633
+ rubygems_version: 2.5.1
634
634
  signing_key:
635
635
  specification_version: 4
636
636
  summary: core gem for releaf