tramway-admin 1.29.1.5 → 1.29.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/views/tramway/admin/shared/show/associations/_row.html.haml +10 -2
- data/app/views/tramway/admin/shared/show/associations/_table_row.html.haml +20 -0
- data/lib/tramway/admin/version.rb +1 -1
- metadata +2 -2
- data/app/views/tramway/admin/shared/show/associations/_list.html.haml +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb8572d620231b636f36ee41b63de90c82cf6bbda55bd49d43018e13a81e9bb4
|
4
|
+
data.tar.gz: 38aa095dc281d92baacf40504cd56790bac6ff071dcfd238d0d6a98e4b49cd7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9534f3052c14aa43b8dbf06dbbef7c61030e4fe5e8a901dfc07863caf349af8c2d8b3da153b766cc39d3a5bf98e53e5507208c224643af79f6bc48458649b53
|
7
|
+
data.tar.gz: 777695f2b36a4ee82e9848c25fefb79e40bfb35bbd214e97a0b3e6c0c676499ea24961f636883ed15a70fae36230d6a348cd2a854b07eb1cece6e3ba63dd9292
|
@@ -1,8 +1,16 @@
|
|
1
1
|
- if object.class.show_associations.map(&:to_s).include? association.name.to_s
|
2
|
+
- association_type = association.class.to_s.split('::').last.sub(/Reflection$/, '').underscore.to_sym
|
2
3
|
%tr
|
3
4
|
%td
|
4
5
|
= model_class.human_attribute_name association.name
|
5
6
|
%hr
|
6
|
-
|
7
|
+
- if association_type != :has_one || !object.send(association.name).present?
|
8
|
+
= 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'
|
7
9
|
%td{ colspan: 2 }
|
8
|
-
|
10
|
+
- if association_type.in? [ :has_one, :belongs_to ]
|
11
|
+
%table.table.table-striped.table-bordered
|
12
|
+
= render 'tramway/admin/shared/show/associations/table_row', object: object, association: association, association_object: object.send(association.name)
|
13
|
+
- else
|
14
|
+
%table.table.table-striped.table-bordered
|
15
|
+
- object.send(association.name)&.each do |association_object|
|
16
|
+
= render 'tramway/admin/shared/show/associations/table_row', object: object, association: association, association_object: association_object
|
@@ -0,0 +1,20 @@
|
|
1
|
+
- association_state_machines = object.send("#{association.name}_state_machines")
|
2
|
+
- if (!association_object.is_a?(Array) || !association_object.empty?) && association_object.present?
|
3
|
+
%tr{ id: "#{association.name}_#{association_object.id}" }
|
4
|
+
%td
|
5
|
+
= association_object.id
|
6
|
+
%td
|
7
|
+
= link_to association_object.name, record_path(association_object.id, model: association.options[:class_name])
|
8
|
+
%td
|
9
|
+
- association_state_machines.each do |state_method|
|
10
|
+
= state_events_buttons association_object, state_method: state_method, model_param_name: :record, controller: 'tramway/admin/records', action: :update, parameters: { redirect: current_model_record_path(object.id), model: association_object.class.model_name }, button_options: { class: :smart_button }
|
11
|
+
%td
|
12
|
+
- if update_is_available? association_object, object
|
13
|
+
= edit_button url: edit_record_path(association_object.id, model: association.options[:class_name], redirect: current_model_record_path(object.id)), button_options: { class: 'btn btn-xs btn-warning edit' } do
|
14
|
+
= fa_icon 'pencil-alt'
|
15
|
+
- if destroy_is_available? association_object, object
|
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 delete' } do
|
17
|
+
= fa_icon 'trash-alt'
|
18
|
+
- if habtm_destroy_is_available? association_object, object
|
19
|
+
= delete_button url: has_and_belongs_to_many_record_path(association_object.id, model_class: object.model.class, object_id: object.id, form: "Admin::#{object.model.class.to_s.pluralize}::Remove#{association_object.model.class.to_s}Form", redirect: current_model_record_path(object.id)), button_options: { class: 'btn btn-xs btn-danger delete' } do
|
20
|
+
= fa_icon 'trash-alt'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tramway-admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.29.
|
4
|
+
version: 1.29.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
@@ -211,8 +211,8 @@ files:
|
|
211
211
|
- app/views/tramway/admin/shared/errors/server_error.html.haml
|
212
212
|
- app/views/tramway/admin/shared/show/_attribute_tr.html.haml
|
213
213
|
- app/views/tramway/admin/shared/show/associations/_habtm_row.html.haml
|
214
|
-
- app/views/tramway/admin/shared/show/associations/_list.html.haml
|
215
214
|
- app/views/tramway/admin/shared/show/associations/_row.html.haml
|
215
|
+
- app/views/tramway/admin/shared/show/associations/_table_row.html.haml
|
216
216
|
- app/views/tramway/admin/singletons/_form.html.haml
|
217
217
|
- app/views/tramway/admin/singletons/edit.html.haml
|
218
218
|
- app/views/tramway/admin/singletons/new.html.haml
|
@@ -1,21 +0,0 @@
|
|
1
|
-
- association_state_machines = object.send("#{association.name}_state_machines")
|
2
|
-
%table.table.table-striped.table-bordered
|
3
|
-
- object.send(association.name)&.each do |association_object|
|
4
|
-
%tr{ id: "#{association.name}_#{association_object.id}" }
|
5
|
-
%td
|
6
|
-
= association_object.id
|
7
|
-
%td
|
8
|
-
= link_to association_object.name, record_path(association_object.id, model: association.options[:class_name])
|
9
|
-
%td
|
10
|
-
- association_state_machines.each do |state_method|
|
11
|
-
= state_events_buttons association_object, state_method: state_method, model_param_name: :record, controller: 'tramway/admin/records', action: :update, parameters: { redirect: current_model_record_path(object.id), model: association_object.class.model_name }, button_options: { class: :smart_button }
|
12
|
-
%td
|
13
|
-
- if update_is_available? association_object, object
|
14
|
-
= edit_button url: edit_record_path(association_object.id, model: association.options[:class_name], redirect: current_model_record_path(object.id)), button_options: { class: 'btn btn-xs btn-warning edit' } do
|
15
|
-
= fa_icon 'pencil-alt'
|
16
|
-
- if destroy_is_available? association_object, object
|
17
|
-
= 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 delete' } do
|
18
|
-
= fa_icon 'trash-alt'
|
19
|
-
- if habtm_destroy_is_available? association_object, object
|
20
|
-
= delete_button url: has_and_belongs_to_many_record_path(association_object.id, model_class: object.model.class, object_id: object.id, form: "Admin::#{object.model.class.to_s.pluralize}::Remove#{association_object.model.class.to_s}Form", redirect: current_model_record_path(object.id)), button_options: { class: 'btn btn-xs btn-danger delete' } do
|
21
|
-
= fa_icon 'trash-alt'
|