tramway-admin 1.33.1.2 → 2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -1
- data/app/controllers/tramway/admin/records_controller.rb +10 -4
- data/app/models/tramway/user/user.rb +1 -0
- data/app/views/tramway/admin/records/_list.html.haml +3 -3
- data/app/views/tramway/admin/shared/show/_attribute_tr.html.haml +1 -1
- data/lib/tramway/admin/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5390a8ac2ff22518ce7381eda5eec47f0ede410e0cdcbcbf2ad4577a2e6d7869
|
4
|
+
data.tar.gz: 1599e0b6a50ef1f67df55a47d22ce29dc7438bf35d19f127d373d3594de9248a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 296ebeca8c4c69f989c4240e3348f2ec47c77f29d8a2066eb9ce233479e78241f29da09619de0d228332d3cef79f299bc9229008bfa841ca7629d0d782b43cc7
|
7
|
+
data.tar.gz: 8fe4ca13d159e6953157ed082caf92a5b5aede82aca7ac609cc00a24be067d3e580c9b1c3625b5736414504bb3a53bd4667cd7704a880c11750155e501366306
|
data/README.md
CHANGED
@@ -52,16 +52,22 @@ class Tramway::Admin::RecordsController < ::Tramway::Admin::ApplicationControlle
|
|
52
52
|
|
53
53
|
def update
|
54
54
|
@record_form = admin_form_class.new model_class.active.find params[:id]
|
55
|
-
if
|
56
|
-
|
55
|
+
if params[:record][:aasm_event].present?
|
56
|
+
if @record_form.model.send("may_#{params[:record][:aasm_event]}?")
|
57
|
+
@record_form.model.send("#{params[:record][:aasm_event]}!")
|
58
|
+
end
|
57
59
|
else
|
58
|
-
|
60
|
+
if @record_form.submit params[:record]
|
61
|
+
redirect_to params[:redirect].present? ? params[:redirect] : record_path(@record_form.model)
|
62
|
+
else
|
63
|
+
render :edit
|
64
|
+
end
|
59
65
|
end
|
60
66
|
end
|
61
67
|
|
62
68
|
def destroy
|
63
69
|
record = model_class.active.find params[:id]
|
64
|
-
record.remove
|
70
|
+
record.remove!
|
65
71
|
redirect_to params[:redirect].present? ? params[:redirect] : records_path
|
66
72
|
end
|
67
73
|
end
|
@@ -28,7 +28,7 @@
|
|
28
28
|
%br
|
29
29
|
%br
|
30
30
|
.btn-group{ data: { toggle: :buttons } }
|
31
|
-
- record.model.class.
|
32
|
-
- unless
|
33
|
-
= state_events_buttons record, state_method:
|
31
|
+
- record.model.class.state_machines_names.each do |state_machine_name|
|
32
|
+
- unless state_machine_name == 'default'
|
33
|
+
= state_events_buttons record, state_method: state_machine_name, model_param_name: :record, controller: 'tramway/admin/records', action: :update, parameters: { redirect: current_model_records_path(page: params[:page], scope: params[:scope], filter: params[:filter], focus: focus_selector(index)), model: record.class.model_name }, button_options: { class: :smart_button }
|
34
34
|
= paginate @records, theme: 'twitter-bootstrap-4'
|
@@ -5,5 +5,5 @@
|
|
5
5
|
= value
|
6
6
|
%td
|
7
7
|
- if tramway_model?(model_class)
|
8
|
-
- if attribute_name.to_s != 'state' && object.model.class.
|
8
|
+
- if attribute_name.to_s != 'state' && object.model.class.aasm.states.map(&:name).include?(attribute_name.to_sym)
|
9
9
|
= state_events_buttons object, state_method: attribute_name, model_param_name: :record, controller: 'tramway/admin/records', action: :update, parameters: { model: object.class.model_name }, button_options: { class: :smart_button }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tramway-admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: '2.0'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-02-
|
11
|
+
date: 2021-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tramway-core
|
@@ -196,6 +196,20 @@ dependencies:
|
|
196
196
|
- - '='
|
197
197
|
- !ruby/object:Gem::Version
|
198
198
|
version: '3.0'
|
199
|
+
- !ruby/object:Gem::Dependency
|
200
|
+
name: aasm
|
201
|
+
requirement: !ruby/object:Gem::Requirement
|
202
|
+
requirements:
|
203
|
+
- - ">="
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
version: '0'
|
206
|
+
type: :runtime
|
207
|
+
prerelease: false
|
208
|
+
version_requirements: !ruby/object:Gem::Requirement
|
209
|
+
requirements:
|
210
|
+
- - ">="
|
211
|
+
- !ruby/object:Gem::Version
|
212
|
+
version: '0'
|
199
213
|
- !ruby/object:Gem::Dependency
|
200
214
|
name: pg
|
201
215
|
requirement: !ruby/object:Gem::Requirement
|