tramway-admin 2.1.3 → 2.1.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5070e71c71aebabe975e9a8a0c426b5ce209f0b23720a10d1fc789a11c6b83db
4
- data.tar.gz: 7abb507822d7a1f4cb80593a40ef1a616a072fdc124142ef0e430391e3ec4477
3
+ metadata.gz: aeabc39d2bc0ce9ea3504bf578a0016a46e6278cbb27cdfbe8f393bf68f482fd
4
+ data.tar.gz: 6d65c6e3b06f0b6ef86a285a7dad3bbd713eaa7cecb72d0440be493f8381eb88
5
5
  SHA512:
6
- metadata.gz: 36324047630459336866d9fd4bde04421d23307ef60c391c7467e894d3a7ac2bc3c8ab99e73f3ce664b248e767ddd5394cd54d2bb7752245f03aaf317967cef6
7
- data.tar.gz: 46f856085c47f38907267eef00928b7473993de8cdf9b01cb75264be9e7e97b07223b6b75e9ae17e0e7c6d474a145f8be5e97fddb515332846cd9bd42c00eaba
6
+ metadata.gz: 900820722317c55bcc7cafb5a64632d75af778e91a6009b7edcc6dbf8a19ba6a6c5a21bbc18af6037f71e8a839d844fec7a244b4e0964758dea0b8f47cbdff98
7
+ data.tar.gz: 36830caf1c44bba27810e610cda58030470511dd2c8c854ff0e10ce7a9fc6d5b5aa47e4cc70686e6ced584743d934abda6cae0d3956e2d1f3f8f02226f858b6f
@@ -5,7 +5,10 @@
5
5
  %hr
6
6
  - association_form = object.send("add_#{association.name}_form")
7
7
  = simple_form_for association_form, url: { controller: :has_and_belongs_to_many_records, action: :create, form: association_form.class, model_class: model_class, object_id: object.id }, method: :post do |f|
8
- = f.association association_form.associations.first, label: false
9
- = f.button :submit, "#{I18n.t('helpers.actions.add')} #{model_class.human_attribute_name(association.name).singularize.downcase}", class: 'btn-success'
8
+ - association_form.associations.each do |association_name|
9
+ - associations = association_form.model.class.reflect_on_all_associations.map(&:name)
10
+ - if associations.include? association_name
11
+ = f.association association_name, label: false
12
+ = f.button :submit, "#{I18n.t('helpers.actions.add')} #{model_class.human_attribute_name(association.name).singularize.downcase}", class: 'btn-success'
10
13
  %td{ colspan: 2 }
11
14
  = render 'tramway/admin/shared/show/associations/list', object: object, association: association
@@ -0,0 +1,21 @@
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'
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Admin
5
- VERSION = '2.1.3'
5
+ VERSION = '2.1.3.1'
6
6
  end
7
7
  end
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: 2.1.3
4
+ version: 2.1.3.1
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-08-18 00:00:00.000000000 Z
11
+ date: 2021-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tramway-core
@@ -278,6 +278,7 @@ files:
278
278
  - app/views/tramway/admin/shared/errors/server_error.html.haml
279
279
  - app/views/tramway/admin/shared/show/_attribute_tr.html.haml
280
280
  - app/views/tramway/admin/shared/show/associations/_habtm_row.html.haml
281
+ - app/views/tramway/admin/shared/show/associations/_list.html.haml
281
282
  - app/views/tramway/admin/shared/show/associations/_row.html.haml
282
283
  - app/views/tramway/admin/shared/show/associations/_table_row.html.haml
283
284
  - app/views/tramway/admin/singletons/_form.html.haml
@@ -329,7 +330,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
329
330
  - !ruby/object:Gem::Version
330
331
  version: '0'
331
332
  requirements: []
332
- rubygems_version: 3.2.3
333
+ rubygems_version: 3.1.6
333
334
  signing_key:
334
335
  specification_version: 4
335
336
  summary: Engine for admin