tramway-admin 1.20.3 → 1.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/tramway/admin/records_controller.rb +1 -1
- data/app/helpers/tramway/admin/application_helper.rb +1 -1
- data/app/helpers/tramway/admin/records_helper.rb +4 -4
- data/app/views/tramway/admin/records/_form.html.haml +1 -0
- data/app/views/tramway/admin/shared/show/_associations.html.haml +5 -1
- data/lib/tramway/admin/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: cfb1c6cbf060937418232e7360bb5926e5a77e0dd7b44f629355f4d0a4e1bced
|
4
|
+
data.tar.gz: 8fa7106461c814ebbff02ffb4b84a7c4bbb2ef9d2760872503612e249600b6f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4509a00137c9980105509b0a449879c91ef5be45b64f8250dc8cc72a673d632cbdf63869eacc81f3e051ba7c80ba512c967e2fc0d527dea306401cd6fb46065a
|
7
|
+
data.tar.gz: b2b8f2100f1f446fe2047994ffddb3fcb98f989757418a2b8c26aca9a2d37e87052146156ad2c54fdcdc3755d850a1ee47e1e3ff51f25404bede2e40ad72e559
|
@@ -74,12 +74,12 @@ module Tramway::Admin
|
|
74
74
|
return :active if params[:search].nil? && params[:scope].to_s == tab.to_s
|
75
75
|
end
|
76
76
|
|
77
|
-
def new_associated_record_path(object:, association:)
|
77
|
+
def new_associated_record_path(object:, association:, as:)
|
78
78
|
unless association.options[:class_name].present?
|
79
79
|
raise "You should set `class_name` for #{association.name} association"
|
80
80
|
end
|
81
81
|
|
82
|
-
if association.options[:as].present?
|
82
|
+
if association.options[:as].present? # polymorphic? conditiion
|
83
83
|
new_record_path model: association.class_name,
|
84
84
|
redirect: current_model_record_path(object),
|
85
85
|
association.options[:class_name].underscore => {
|
@@ -88,9 +88,9 @@ module Tramway::Admin
|
|
88
88
|
}
|
89
89
|
else
|
90
90
|
new_record_path model: association.class_name,
|
91
|
-
redirect: current_model_record_path(object),
|
91
|
+
redirect: current_model_record_path(object.model),
|
92
92
|
association.options[:class_name].underscore => {
|
93
|
-
object.model.class.name.underscore => object.id
|
93
|
+
as || object.model.class.name.underscore => object.id
|
94
94
|
}
|
95
95
|
end
|
96
96
|
end
|
@@ -11,5 +11,6 @@
|
|
11
11
|
= simple_form_for @record_form, url: { controller: :records, action: action, model: @record_form.model.class }, method: method, input_html: { class: 'form-horizontal' } do |f|
|
12
12
|
- @record_form.properties.each do |property, type|
|
13
13
|
= render 'tramway/admin/shared/input', property: property, object: :record, type: type, form: f
|
14
|
+
= hidden_field_tag :redirect, params[:redirect]
|
14
15
|
= f.button :submit, t('helpers.links.save'), class: 'btn-success'
|
15
16
|
= link_to t('helpers.links.back'), current_model_records_path, class: 'btn btn-secondary'
|
@@ -2,7 +2,8 @@
|
|
2
2
|
%tr
|
3
3
|
%td
|
4
4
|
= model_class.human_attribute_name association.name
|
5
|
-
|
5
|
+
%hr
|
6
|
+
= link_to "#{I18n.t('helpers.actions.add')} #{model_class.human_attribute_name(association.name).singularize.downcase}", new_associated_record_path(association: association, object: object, as: object.send("#{association.name}_as")), class: 'btn btn-primary'
|
6
7
|
%td{ colspan: 2 }
|
7
8
|
%table.table.table-striped.table-bordered
|
8
9
|
- object.send(association.name)&.each do |association_object|
|
@@ -11,3 +12,6 @@
|
|
11
12
|
= association_object.id
|
12
13
|
%td
|
13
14
|
= link_to association_object.name, record_path(association_object.id, model: association.options[:class_name])
|
15
|
+
%td
|
16
|
+
= delete_button url: record_path(association_object.id, model: association.options[:class_name], redirect: current_model_record_path(object.id)), button_options: { class: 'btn btn-xs btn-danger' } do
|
17
|
+
= fa_icon 'trash-alt'
|
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: 1.
|
4
|
+
version: '1.21'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bootstrap-kaminari-views
|