tramway-admin 2.1.1.2 → 2.1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/tramway/admin/application.js +3 -1
- data/app/controllers/tramway/admin/application_controller.rb +1 -1
- data/app/controllers/tramway/admin/records_controller.rb +1 -1
- data/app/views/tramway/admin/shared/show/associations/_habtm_row.html.haml +5 -2
- data/app/views/tramway/admin/shared/show/associations/_list.html.haml +21 -0
- data/lib/tramway/admin/preview.rb +15 -0
- data/lib/tramway/admin/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80721c33dfdeba8fa169d9b695539daa6d60815a75108a1321c8942136e3a3ee
|
4
|
+
data.tar.gz: d4f17bcedd4cfe6113e6ef600d657a7f6761f38e6c9a766047c627aa6238f4ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f75e4b1819128e66cb47c93e103aabd9e829c1741004c79fdaf56db6f5bf0b959e63f7d93a665e854c82080047e40658dd5d2bc4474513f82d89eae2768b132e
|
7
|
+
data.tar.gz: 7a88d91517c5d3ee316b110ff4c14b82811cc68efaaaca61623f4008c51928bf96c7249048007c332b9a1ebd4764659ba821bc9e5e8fd7034e9cf5f1234a8b7c
|
@@ -1,7 +1,6 @@
|
|
1
1
|
//= require tramway/core/application
|
2
2
|
//= require jquery
|
3
3
|
//= require jquery_ujs
|
4
|
-
//= require popper
|
5
4
|
//= require bootstrap-sprockets
|
6
5
|
//= require ckeditor/init
|
7
6
|
//= require selectize
|
@@ -10,4 +9,7 @@
|
|
10
9
|
|
11
10
|
$(document).ready(function() {
|
12
11
|
let clipboard = new Clipboard('.clipboard-btn');
|
12
|
+
$(function () {
|
13
|
+
$('[data-toggle="popover"]').popover()
|
14
|
+
})
|
13
15
|
})
|
@@ -21,7 +21,7 @@ module Tramway
|
|
21
21
|
protected
|
22
22
|
|
23
23
|
def check_available!
|
24
|
-
raise 'Tramway::Admin - Model or Form is not available' if !model_given? && !form_given?
|
24
|
+
raise 'Tramway::Admin - Model or Form is not available. Looks like current user does not have access to change this model. Update your tramway initializer file' if !model_given? && !form_given?
|
25
25
|
end
|
26
26
|
|
27
27
|
def check_available_scope!
|
@@ -9,7 +9,7 @@ class Tramway::Admin::RecordsController < ::Tramway::Admin::ApplicationControlle
|
|
9
9
|
if params[:filter].is_a? String
|
10
10
|
params[:filter] = JSON.parse params[:filter]
|
11
11
|
end
|
12
|
-
records = records.ransack(params[:filter]).result
|
12
|
+
records = records.ransack(params[:filter]).result(distinct: true)
|
13
13
|
end
|
14
14
|
params[:list_filters]&.each do |filter, value|
|
15
15
|
case decorator_class.list_filters[filter.to_sym][:type]
|
@@ -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
|
-
|
9
|
-
|
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'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Tramway::Admin::Preview
|
2
|
+
def set_previewable_models(*models)
|
3
|
+
@previewable_models ||= []
|
4
|
+
@previewable_models += models.map(&:to_s)
|
5
|
+
end
|
6
|
+
|
7
|
+
def previewable_models
|
8
|
+
@previewable_models
|
9
|
+
end
|
10
|
+
|
11
|
+
def is_available_to_preview?(model_class)
|
12
|
+
@previewable_models ||= []
|
13
|
+
@previewable_models.include? model_class.to_s
|
14
|
+
end
|
15
|
+
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.
|
4
|
+
version: 2.1.3.2
|
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-
|
11
|
+
date: 2021-10-03 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
|
@@ -304,6 +305,7 @@ files:
|
|
304
305
|
- lib/tramway/admin/generators/templates/form.rb.erb
|
305
306
|
- lib/tramway/admin/navbar.rb
|
306
307
|
- lib/tramway/admin/notifications.rb
|
308
|
+
- lib/tramway/admin/preview.rb
|
307
309
|
- lib/tramway/admin/record_routes_helper.rb
|
308
310
|
- lib/tramway/admin/records_models.rb
|
309
311
|
- lib/tramway/admin/singleton_models.rb
|