itsf_backend 1.1.6 → 1.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/controller/rest_actions_concern_with_pundit.rb +15 -3
- data/app/controllers/itsf/backend/resource/base_controller.rb +14 -0
- data/app/forms/concerns/form/additional_submit_buttons.rb +21 -0
- data/app/views/itsf/backend/resource/base/edit.html.haml +2 -0
- data/app/views/itsf/backend/resource/base/new.html.haml +2 -0
- data/config/initializers/simple_form_extensions.rb +4 -1
- data/config/locales/de.yml +6 -1
- data/lib/itsf/backend/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0be05c7a7fd7f6d0fb8391a79bd47350b7d9ea00
|
4
|
+
data.tar.gz: 2ecc683d46c48fae5c150dd93a42d6a0c5d7a9b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb484cf8858f22721a11804340796539a09189bfb7d8acaf5595c14e7aa108b56087d9ccd08192215517c6abc0f4d9cc9305efe78156c7fc8bbfc63d58bb88d8
|
7
|
+
data.tar.gz: dd9deebdf4828fcb22be500b5caeaa027027d8cf35b3088076cf4194f31da6c8a6505a4c369a59f84ef3de6f85cc022d2f785af446bf8ca8417f57bb2bd03b81
|
@@ -28,7 +28,7 @@ module Controller
|
|
28
28
|
@resource = resource_class.new(permitted_params)
|
29
29
|
authorize_action
|
30
30
|
@resource.save
|
31
|
-
respond_with @resource, location:
|
31
|
+
respond_with @resource, location: after_create_location
|
32
32
|
end
|
33
33
|
|
34
34
|
def show
|
@@ -47,18 +47,30 @@ module Controller
|
|
47
47
|
@resource = load_resource
|
48
48
|
authorize_action
|
49
49
|
@resource.update_attributes(permitted_params)
|
50
|
-
respond_with @resource, location:
|
50
|
+
respond_with @resource, location: after_update_location
|
51
51
|
end
|
52
52
|
|
53
53
|
def destroy
|
54
54
|
@resource = load_resource
|
55
55
|
authorize_action
|
56
56
|
@resource.destroy
|
57
|
-
respond_with @resource, location:
|
57
|
+
respond_with @resource, location: after_destroy_location
|
58
58
|
end
|
59
59
|
|
60
60
|
private
|
61
61
|
|
62
|
+
def after_create_location
|
63
|
+
collection_path
|
64
|
+
end
|
65
|
+
|
66
|
+
def after_destroy_location
|
67
|
+
collection_path
|
68
|
+
end
|
69
|
+
|
70
|
+
def after_update_location
|
71
|
+
collection_path
|
72
|
+
end
|
73
|
+
|
62
74
|
def authorize_action
|
63
75
|
action = action_name.to_sym
|
64
76
|
case action
|
@@ -32,5 +32,19 @@ module Itsf::Backend
|
|
32
32
|
def resource_class
|
33
33
|
self.class.resource_class
|
34
34
|
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def after_create_location
|
39
|
+
return edit_resource_path(@resource) if params.has_key?(:commit_and_continue_with_edit)
|
40
|
+
return new_resource_path if params.has_key?(:commit_and_continue_with_new)
|
41
|
+
collection_path
|
42
|
+
end
|
43
|
+
|
44
|
+
def after_update_location
|
45
|
+
return edit_resource_path(@resource) if params.has_key?(:commit_and_continue_with_edit)
|
46
|
+
return new_resource_path if params.has_key?(:commit_and_continue_with_new)
|
47
|
+
collection_path
|
48
|
+
end
|
35
49
|
end
|
36
50
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Concerns
|
2
|
+
module Form
|
3
|
+
module AdditionalSubmitButtons
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
def submit_and_continue_with_edit *args
|
7
|
+
options = args.extract_options!
|
8
|
+
action = object.new_record? ? :create : :update
|
9
|
+
options.merge!(name: 'commit_and_continue_with_edit' ,value: I18n.t("helpers.submit.#{action}_and_continue_with_edit", resource_name: object.model_name.human))
|
10
|
+
submit(options)
|
11
|
+
end
|
12
|
+
|
13
|
+
def submit_and_continue_with_new *args
|
14
|
+
options = args.extract_options!
|
15
|
+
action = object.new_record? ? :create : :update
|
16
|
+
options.merge!(name: 'commit_and_continue_with_new' ,value: I18n.t("helpers.submit.#{action}_and_continue_with_new", resource_name: object.model_name.human))
|
17
|
+
submit(options)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -6,6 +6,8 @@
|
|
6
6
|
= render partial: 'form_errors', locals: { resource: f.object }
|
7
7
|
= render 'form', form: f
|
8
8
|
= f.button :submit, class: 'btn btn-success'
|
9
|
+
= f.button :submit_and_continue_with_edit, class: 'btn btn-success'
|
10
|
+
= f.button :submit_and_continue_with_new, class: 'btn btn-success'
|
9
11
|
|
10
12
|
.well.well-sm
|
11
13
|
= link_to resource_path(@resource), class: 'btn btn-primary btn-responsive' do
|
@@ -6,6 +6,8 @@
|
|
6
6
|
= render partial: 'form_errors', locals: { resource: f.object }
|
7
7
|
= render 'form', form: f
|
8
8
|
= f.button :submit, class: 'btn btn-success'
|
9
|
+
= f.button :submit_and_continue_with_edit, class: 'btn btn-success'
|
10
|
+
= f.button :submit_and_continue_with_new, class: 'btn btn-success'
|
9
11
|
%div.panel-footer
|
10
12
|
|
11
13
|
.well.well-sm
|
@@ -1,4 +1,7 @@
|
|
1
1
|
require 'simple_form/form_builder'
|
2
2
|
|
3
3
|
require 'concerns/form/ui_autocomplete'
|
4
|
-
SimpleForm::FormBuilder.send(:include, Concerns::Form::UiAutocomplete)
|
4
|
+
SimpleForm::FormBuilder.send(:include, Concerns::Form::UiAutocomplete)
|
5
|
+
|
6
|
+
require 'concerns/form/additional_submit_buttons'
|
7
|
+
SimpleForm::FormBuilder.send(:include, Concerns::Form::AdditionalSubmitButtons)
|
data/config/locales/de.yml
CHANGED
@@ -37,7 +37,12 @@ de:
|
|
37
37
|
notice: "%{resource_name} veröffentlicht."
|
38
38
|
unpublished:
|
39
39
|
notice: "%{resource_name} zurückgezogen."
|
40
|
-
|
40
|
+
helpers:
|
41
|
+
submit:
|
42
|
+
create_and_continue_with_edit: "%{resource_name} erstellen und weiter bearbeiten"
|
43
|
+
create_and_continue_with_new: "%{resource_name} erstellen und neu"
|
44
|
+
update_and_continue_with_edit: "%{resource_name} aktualisieren und weiter bearbeiten"
|
45
|
+
update_and_continue_with_new: "%{resource_name} aktualisieren und neu"
|
41
46
|
itsf_backend: "Backend"
|
42
47
|
itsf:
|
43
48
|
backend:
|
data/lib/itsf/backend/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: itsf_backend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Vasquez Angel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -520,6 +520,7 @@ files:
|
|
520
520
|
- app/extensions/concerns/resource_row/published_extensions.rb
|
521
521
|
- app/extensions/concerns/resource_row/timestamp_extensions.rb
|
522
522
|
- app/extensions/concerns/simple_form_form_builder_extensions.rb
|
523
|
+
- app/forms/concerns/form/additional_submit_buttons.rb
|
523
524
|
- app/forms/concerns/form/ui_autocomplete.rb
|
524
525
|
- app/helpers/itsf/backend/application_helper.rb
|
525
526
|
- app/inputs/fake_checkbox_input.rb
|