avo 2.13.0 → 2.13.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of avo might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/app/controllers/avo/base_controller.rb +83 -26
- data/app/controllers/avo/search_controller.rb +1 -1
- data/lib/avo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b921afbe3cb5f55ee67ac20bb21d65dffa91b2b3608dddf1c21b6f9fa5a686e
|
4
|
+
data.tar.gz: 5a7d24f4c324b1109717321b3200c41f6b61470fabc915fe41c662fb3858a108
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e740c3c1eb71a50fe32bf7856b993e8921c6891e16a09341d636fbcaa32faf8564fd417efc8c914573d959364d573851faaf1b943a5314f7aab78f8c752758f
|
7
|
+
data.tar.gz: 7d66c540afb965ac2a07e0a2d88fe811cd6c035cee7a0ce88e8cc926c53f2dd186cabf69fb69946becec707711edb49033cf2c4d6952cdfc13894302554fc1ac
|
data/Gemfile.lock
CHANGED
@@ -146,16 +146,14 @@ module Avo
|
|
146
146
|
end
|
147
147
|
end
|
148
148
|
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
format.html { render :new, status: :unprocessable_entity }
|
158
|
-
end
|
149
|
+
add_breadcrumb @resource.plural_name.humanize, resources_path(resource: @resource)
|
150
|
+
add_breadcrumb t("avo.new").humanize
|
151
|
+
set_actions
|
152
|
+
|
153
|
+
if saved
|
154
|
+
create_success_action
|
155
|
+
else
|
156
|
+
create_fail_action
|
159
157
|
end
|
160
158
|
end
|
161
159
|
|
@@ -167,27 +165,20 @@ module Avo
|
|
167
165
|
# model gets instantiated and filled in the fill_model method
|
168
166
|
saved = save_model
|
169
167
|
@resource = @resource.hydrate(model: @model, view: :edit, user: _current_user)
|
168
|
+
set_actions
|
170
169
|
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
set_actions
|
176
|
-
flash.now[:error] = t "avo.you_missed_something_check_form"
|
177
|
-
format.html { render :edit, status: :unprocessable_entity }
|
178
|
-
end
|
170
|
+
if saved
|
171
|
+
update_success_action
|
172
|
+
else
|
173
|
+
update_fail_action
|
179
174
|
end
|
180
175
|
end
|
181
176
|
|
182
177
|
def destroy
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
error_message = @errors.present? ? @errors.first : t("avo.failed")
|
188
|
-
|
189
|
-
format.html { redirect_back fallback_location: params[:referrer] || resources_path(resource: @resource, turbo_frame: params[:turbo_frame], view_type: params[:view_type]), error: error_message }
|
190
|
-
end
|
178
|
+
if destroy_model
|
179
|
+
destroy_success_action
|
180
|
+
else
|
181
|
+
destroy_fail_action
|
191
182
|
end
|
192
183
|
end
|
193
184
|
|
@@ -398,6 +389,27 @@ module Avo
|
|
398
389
|
add_breadcrumb t("avo.edit").humanize
|
399
390
|
end
|
400
391
|
|
392
|
+
def create_success_action
|
393
|
+
respond_to do |format|
|
394
|
+
format.html { redirect_to after_create_path, notice: create_success_message}
|
395
|
+
end
|
396
|
+
end
|
397
|
+
|
398
|
+
def create_fail_action
|
399
|
+
respond_to do |format|
|
400
|
+
flash.now[:error] = create_fail_message
|
401
|
+
format.html { render :new, status: :unprocessable_entity }
|
402
|
+
end
|
403
|
+
end
|
404
|
+
|
405
|
+
def create_success_message
|
406
|
+
"#{@resource.name} #{t("avo.was_successfully_created")}."
|
407
|
+
end
|
408
|
+
|
409
|
+
def create_fail_message
|
410
|
+
t "avo.you_missed_something_check_form"
|
411
|
+
end
|
412
|
+
|
401
413
|
def after_create_path
|
402
414
|
# If this is an associated record return to the association show page
|
403
415
|
if params[:via_relation_class].present? && params[:via_resource_id].present?
|
@@ -409,12 +421,57 @@ module Avo
|
|
409
421
|
redirect_path_from_resource_option(:after_create_path) || resource_path(model: @model, resource: @resource)
|
410
422
|
end
|
411
423
|
|
424
|
+
def update_success_action
|
425
|
+
respond_to do |format|
|
426
|
+
format.html { redirect_to after_update_path, notice: update_success_message }
|
427
|
+
end
|
428
|
+
end
|
429
|
+
|
430
|
+
def update_fail_action
|
431
|
+
respond_to do |format|
|
432
|
+
flash.now[:error] = update_fail_message
|
433
|
+
format.html { render :edit, status: :unprocessable_entity }
|
434
|
+
end
|
435
|
+
end
|
436
|
+
|
437
|
+
def update_success_message
|
438
|
+
"#{@resource.name} #{t("avo.was_successfully_updated")}."
|
439
|
+
end
|
440
|
+
|
441
|
+
def update_fail_message
|
442
|
+
t "avo.you_missed_something_check_form"
|
443
|
+
end
|
444
|
+
|
412
445
|
def after_update_path
|
413
446
|
return params[:referrer] if params[:referrer].present?
|
414
447
|
|
415
448
|
redirect_path_from_resource_option(:after_update_path) || resource_path(model: @model, resource: @resource)
|
416
449
|
end
|
417
450
|
|
451
|
+
def destroy_success_action
|
452
|
+
respond_to do |format|
|
453
|
+
format.html { redirect_to after_destroy_path, notice: destroy_success_message }
|
454
|
+
end
|
455
|
+
end
|
456
|
+
|
457
|
+
def destroy_fail_action
|
458
|
+
respond_to do |format|
|
459
|
+
format.html { redirect_back fallback_location: params[:referrer] || resources_path(resource: @resource, turbo_frame: params[:turbo_frame], view_type: params[:view_type]), error: destroy_fail_message }
|
460
|
+
end
|
461
|
+
end
|
462
|
+
|
463
|
+
def destroy_success_message
|
464
|
+
t("avo.resource_destroyed", attachment_class: @attachment_class)
|
465
|
+
end
|
466
|
+
|
467
|
+
def destroy_fail_message
|
468
|
+
@errors.present? ? @errors.first : t("avo.failed")
|
469
|
+
end
|
470
|
+
|
471
|
+
def after_destroy_path
|
472
|
+
params[:referrer] || resources_path(resource: @resource, turbo_frame: params[:turbo_frame], view_type: params[:view_type])
|
473
|
+
end
|
474
|
+
|
418
475
|
def redirect_path_from_resource_option(action = :after_update_path)
|
419
476
|
return nil if @resource.class.send(action).blank?
|
420
477
|
|
data/lib/avo/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.13.
|
4
|
+
version: 2.13.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Marin
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-08-
|
12
|
+
date: 2022-08-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|