effective_resources 0.8.3 → 0.8.4
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4fe2a46aac6809ee12c839f38125664f50ac64e
|
4
|
+
data.tar.gz: 4e022c5747750828080cc786ae1a1e5ce8474668
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c7cb536f94b69024d8af6e206f71a61c3eec482d53af71c713899e64d0f0ca079a85120f2c106ac9e68b956169f652ecfb35c15e57201195643f6ca01f9e1f6
|
7
|
+
data.tar.gz: 2fe867ec72221295e0570877c177f67b7f5e33d45d5919eca94578fe3e0c5fd604accec60c7a9a527ca2e023b9121a3b086cb11823310f2754b4085566a469b6
|
@@ -4,7 +4,6 @@ module Effective
|
|
4
4
|
|
5
5
|
included do
|
6
6
|
class << self
|
7
|
-
|
8
7
|
def effective_resource
|
9
8
|
@_effective_resource ||= Effective::Resource.new(controller_path)
|
10
9
|
end
|
@@ -200,12 +199,18 @@ module Effective
|
|
200
199
|
resource.assign_attributes(send(resource_params_method_name))
|
201
200
|
resource.created_by ||= current_user if resource.respond_to?(:created_by=)
|
202
201
|
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
202
|
+
respond_to do |format|
|
203
|
+
if save_resource(resource, action)
|
204
|
+
flash[:success] ||= flash_success(resource, action)
|
205
|
+
|
206
|
+
format.html { redirect_to(resource_redirect_path) }
|
207
|
+
format.js { } # create.js.erb
|
208
|
+
else
|
209
|
+
flash.now[:danger] ||= flash_danger(resource, action)
|
210
|
+
|
211
|
+
format.html { render :new }
|
212
|
+
format.js {} # create.js.erb
|
213
|
+
end
|
209
214
|
end
|
210
215
|
end
|
211
216
|
|
@@ -238,12 +243,18 @@ module Effective
|
|
238
243
|
|
239
244
|
resource.assign_attributes(send(resource_params_method_name))
|
240
245
|
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
246
|
+
respond_to do |format|
|
247
|
+
if save_resource(resource, action)
|
248
|
+
flash[:success] ||= flash_success(resource, action)
|
249
|
+
|
250
|
+
format.html { redirect_to(resource_redirect_path) }
|
251
|
+
format.js { } # update.js.erb
|
252
|
+
else
|
253
|
+
flash.now[:danger] ||= flash_danger(resource, action)
|
254
|
+
|
255
|
+
format.html { render :edit }
|
256
|
+
format.js {} # update.js.erb
|
257
|
+
end
|
247
258
|
end
|
248
259
|
end
|
249
260
|
|
@@ -0,0 +1,6 @@
|
|
1
|
+
- flash.each do |key, value|
|
2
|
+
%div{class: "alert alert-dismissible alert-#{key} fade show", role: 'alert'}
|
3
|
+
%button.close{type: 'button', 'aria-label': 'Close', 'data-dismiss': 'alert'}
|
4
|
+
%span{'aria-hidden': true} ×
|
5
|
+
%span.sr-only Close
|
6
|
+
= value.to_s.html_safe
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<% resource = (@_effective_resource || Effective::Resource.new(controller_path)) %>
|
2
|
+
<% @resource = instance_variable_get('@' + resource.name) if resource.name %>
|
3
|
+
|
4
|
+
EffectiveBootstrap.remote_form_payload = $("<%= j render_resource_form(resource) %>");
|
5
|
+
EffectiveBootstrap.remote_form_flash = <%= raw flash.to_json %>;
|
6
|
+
|
7
|
+
<% if flash[:success].blank? %>
|
8
|
+
EffectiveBootstrap.remote_form_flash_payload = $("<%= j render('flash') %>");
|
9
|
+
<% end %>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<% resource = (@_effective_resource || Effective::Resource.new(controller_path)) %>
|
2
|
+
<% @resource = instance_variable_get('@' + resource.name) if resource.name %>
|
3
|
+
|
4
|
+
EffectiveBootstrap.remote_form_payload = $("<%= j render_resource_form(resource) %>");
|
5
|
+
EffectiveBootstrap.remote_form_flash = <%= raw flash.to_json %>;
|
6
|
+
|
7
|
+
<% if flash[:success].blank? %>
|
8
|
+
EffectiveBootstrap.remote_form_flash_payload = $("<%= j render('flash') %>");
|
9
|
+
<% end %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_resources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -53,10 +53,13 @@ files:
|
|
53
53
|
- app/models/effective/resources/paths.rb
|
54
54
|
- app/models/effective/resources/relation.rb
|
55
55
|
- app/models/effective/resources/sql.rb
|
56
|
+
- app/views/application/_flash.html.haml
|
57
|
+
- app/views/application/create.js.erb
|
56
58
|
- app/views/application/edit.html.haml
|
57
59
|
- app/views/application/index.html.haml
|
58
60
|
- app/views/application/new.html.haml
|
59
61
|
- app/views/application/show.html.haml
|
62
|
+
- app/views/application/update.js.erb
|
60
63
|
- config/effective_resources.rb
|
61
64
|
- lib/effective_resources.rb
|
62
65
|
- lib/effective_resources/engine.rb
|