cm-admin 0.5.3 → 0.5.4
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/stylesheets/cm_admin/base/table.scss +3 -4
- data/app/views/cm_admin/main/_associated_table.html.slim +20 -18
- data/app/views/cm_admin/main/_top_navbar.html.slim +7 -2
- data/app/views/layouts/_custom_action_modals.html.slim +3 -3
- data/lib/cm_admin/model.rb +6 -1
- data/lib/cm_admin/version.rb +1 -1
- data/lib/cm_admin/view_helpers/navigation_helper.rb +19 -17
- data/tmp/cache/webpacker/last-compilation-digest-development +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: 590c14bc3ee438f00943ac40316aaf1e0850639a5eda8da1d4c73dec80b11963
|
4
|
+
data.tar.gz: df5b1269f85267cc86e123c15b950e50292396771cb83cc10dc27bb3337d7416
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b530f87e1a584d25e43684491ddee0156d7544bcb31f13c8b4d53aedff611ff0ffae7fc4ea9898d5186f4a3453463d7d77b7ecf4f39bee8020fcb4c753f6e76
|
7
|
+
data.tar.gz: ec22d42e7c47f2755642a902821db15616378361b661b0a609d22fe5b678527ae6ddddf62d902ba0aa55fc647eb215bb4704df046f5b7bbf5625c1b7ffceaa2f
|
@@ -74,7 +74,6 @@
|
|
74
74
|
position: relative;
|
75
75
|
min-width: fit-content;
|
76
76
|
border-collapse: collapse;
|
77
|
-
white-space: nowrap;
|
78
77
|
border: 1px solid $grey-lighter-clr;
|
79
78
|
border-radius: $radius-8;
|
80
79
|
&__header {
|
@@ -222,7 +221,7 @@
|
|
222
221
|
box-shadow: inset 0px 1px 0px rgba(148, 151, 155, 0.15);
|
223
222
|
}
|
224
223
|
}
|
225
|
-
}
|
224
|
+
}
|
226
225
|
|
227
226
|
.columns-list {
|
228
227
|
.column-item {
|
@@ -266,7 +265,7 @@
|
|
266
265
|
}
|
267
266
|
}
|
268
267
|
}
|
269
|
-
}
|
268
|
+
}
|
270
269
|
}
|
271
270
|
|
272
271
|
.cm-pagination {
|
@@ -317,4 +316,4 @@
|
|
317
316
|
}
|
318
317
|
}
|
319
318
|
}
|
320
|
-
}
|
319
|
+
}
|
@@ -37,24 +37,26 @@
|
|
37
37
|
.popup-option
|
38
38
|
a href="#{page_url('edit', ar_object)}"
|
39
39
|
| Edit
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
/ span.page-num-btn 2
|
49
|
-
/ span.page-num-btn 3
|
50
|
-
/ span.page-num-btn 4
|
51
|
-
/ span.page-num-btn 5
|
52
|
-
/ span.page-move-btn
|
53
|
-
/ i.fa.fa-chevron-right.bolder
|
54
|
-
/ span.page-move-btn
|
55
|
-
/ i.fa.fa-angle-double-right.bolder.f14
|
56
|
-
|
40
|
+
- @associated_model && @associated_model.available_actions.select{|act| act if act.route_type == 'member'}.each do |custom_action|
|
41
|
+
- if custom_action.display_if.call(ar_object)
|
42
|
+
.popup-option
|
43
|
+
- if custom_action.display_type == :button
|
44
|
+
= link_to custom_action.name.titleize, custom_action.path.gsub(':id', ar_object.id.to_s), method: custom_action.verb
|
45
|
+
- elsif custom_action.display_type == :modal
|
46
|
+
= link_to custom_action.name.titleize, '', data: { bs_toggle: "modal", bs_target: "##{custom_action.name.classify}Modal-#{ar_object.id.to_s}" }
|
47
|
+
|
57
48
|
.cm-pagination
|
58
49
|
.cm-pagination__lhs Showing #{@associated_ar_object.pagy.from} to #{@associated_ar_object.pagy.to} out of #{@associated_ar_object.pagy.count}
|
59
50
|
.cm-pagination__rhs
|
60
|
-
== render partial: 'cm_admin/main/cm_pagy_nav', locals: { pagy: @associated_ar_object.pagy }
|
51
|
+
== render partial: 'cm_admin/main/cm_pagy_nav', locals: { pagy: @associated_ar_object.pagy }
|
52
|
+
|
53
|
+
- @associated_ar_object.data.each do |ar_object|
|
54
|
+
- @associated_model && @associated_model.available_actions.select{|act| act if act.route_type == 'member'}.each do |custom_action|
|
55
|
+
.modal.fade id="#{custom_action.name.classify}Modal-#{ar_object.id.to_s}" aria-hidden="true" aria-labelledby="#{custom_action.name.classify}ModalLabel" tabindex="1"
|
56
|
+
.modal-dialog
|
57
|
+
.modal-content
|
58
|
+
.modal-header
|
59
|
+
h5.modal-title id="#{custom_action.name.classify}ModalLabel" = custom_action.name.classify
|
60
|
+
button.btn-close aria-label="Close" data-bs-dismiss="modal" type="button"
|
61
|
+
.modal-body
|
62
|
+
= render partial: custom_action.partial, locals: { ar_object: ar_object }
|
@@ -28,9 +28,14 @@
|
|
28
28
|
= link_to custom_action.name.titleize, @model.ar_model.table_name + '/' + custom_action.path, class: 'primary-btn ml-2', method: custom_action.verb
|
29
29
|
- elsif custom_action.display_type == :modal
|
30
30
|
= link_to custom_action.name.titleize, '', class: 'primary-btn ml-2', data: { bs_toggle: "modal", bs_target: "##{custom_action.name.classify}Modal" }
|
31
|
-
- elsif @model.current_action.name == 'show'
|
31
|
+
- elsif @model.current_action.name == 'show'
|
32
32
|
- @model.available_actions.select{|act| act if act.route_type == 'member'}.each do |custom_action|
|
33
33
|
- if custom_action.display_type == :button && custom_action.display_if.call(@ar_object)
|
34
34
|
= link_to custom_action.name.titleize, custom_action.path.gsub(':id', params[:id]), class: 'primary-btn ml-2', method: custom_action.verb
|
35
35
|
- elsif custom_action.display_type == :modal && custom_action.display_if.call(@ar_object)
|
36
|
-
= link_to custom_action.name.titleize, '', class: 'primary-btn ml-2', data: { bs_toggle: "modal", bs_target: "##{custom_action.name.classify}Modal" }
|
36
|
+
= link_to custom_action.name.titleize, '', class: 'primary-btn ml-2', data: { bs_toggle: "modal", bs_target: "##{custom_action.name.classify}Modal" }
|
37
|
+
|
38
|
+
- edit_action = @model.available_actions.select{|act| act if act.action_type.eql?(:default) && act.name.eql?('edit')}
|
39
|
+
- if edit_action.any?
|
40
|
+
a.primary-btn.ml-2 href="#{page_url('edit', @ar_object)}"
|
41
|
+
= "Edit #{@model.name}"
|
@@ -1,9 +1,9 @@
|
|
1
|
-
- @model.available_actions.select{|act| act if act.
|
2
|
-
.modal.fade id="#{custom_action.name.classify}Modal" aria-hidden="true" aria-labelledby="
|
1
|
+
- @model.available_actions.select{|act| act if act.display_type == :modal}.each do |custom_action|
|
2
|
+
.modal.fade id="#{custom_action.name.classify}Modal" aria-hidden="true" aria-labelledby="#{custom_action.name.classify}ModalLabel" tabindex="1"
|
3
3
|
.modal-dialog
|
4
4
|
.modal-content
|
5
5
|
.modal-header
|
6
|
-
h5
|
6
|
+
h5.modal-title id="#{custom_action.name.classify}ModalLabel" = custom_action.name.classify
|
7
7
|
button.btn-close aria-label="Close" data-bs-dismiss="modal" type="button"
|
8
8
|
.modal-body
|
9
9
|
= render partial: custom_action.partial
|
data/lib/cm_admin/model.rb
CHANGED
@@ -22,7 +22,7 @@ module CmAdmin
|
|
22
22
|
include Models::DslMethod
|
23
23
|
include Models::ControllerMethod
|
24
24
|
attr_accessor :available_actions, :actions_set, :available_fields, :permitted_fields, :current_action, :params, :filters, :available_tabs
|
25
|
-
attr_reader :name, :ar_model
|
25
|
+
attr_reader :name, :ar_model, :is_visible_on_sidebar
|
26
26
|
|
27
27
|
# Class variable for storing all actions
|
28
28
|
# CmAdmin::Model.all_actions
|
@@ -31,6 +31,7 @@ module CmAdmin
|
|
31
31
|
def initialize(entity, &block)
|
32
32
|
@name = entity.name
|
33
33
|
@ar_model = entity
|
34
|
+
@is_visible_on_sidebar = true
|
34
35
|
@available_actions ||= []
|
35
36
|
@current_action = nil
|
36
37
|
@available_tabs ||= []
|
@@ -85,6 +86,10 @@ module CmAdmin
|
|
85
86
|
@actions_set = true
|
86
87
|
end
|
87
88
|
|
89
|
+
def visible_on_sidebar(visible_option)
|
90
|
+
@is_visible_on_sidebar = visible_option
|
91
|
+
end
|
92
|
+
|
88
93
|
|
89
94
|
private
|
90
95
|
|
data/lib/cm_admin/version.rb
CHANGED
@@ -5,26 +5,28 @@ module CmAdmin
|
|
5
5
|
include Pagy::Frontend
|
6
6
|
def navigation_links(navigation_type)
|
7
7
|
CmAdmin.cm_admin_models.map { |model|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
content_tag(:
|
12
|
-
content_tag(:
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end
|
17
|
-
end
|
18
|
-
elsif navigation_type == "quick_links"
|
19
|
-
content_tag(:a, href: path, class: 'visible') do
|
20
|
-
content_tag(:div, class: 'result-item') do
|
21
|
-
content_tag(:span) do
|
22
|
-
concat tag.i class: 'fa fa-th-large'
|
23
|
-
end +
|
24
|
-
content_tag(:span) do
|
8
|
+
if model.is_visible_on_sidebar
|
9
|
+
path = CmAdmin::Engine.mount_path + '/' + model.name.underscore.pluralize
|
10
|
+
if navigation_type == "sidebar"
|
11
|
+
content_tag(:a, href: path) do
|
12
|
+
content_tag(:div, class: 'menu-item') do
|
13
|
+
content_tag(:span, class: 'menu-icon') do
|
14
|
+
concat tag.i class: 'fa fa-th-large'
|
15
|
+
end +
|
25
16
|
model.name
|
26
17
|
end
|
27
18
|
end
|
19
|
+
elsif navigation_type == "quick_links"
|
20
|
+
content_tag(:a, href: path, class: 'visible') do
|
21
|
+
content_tag(:div, class: 'result-item') do
|
22
|
+
content_tag(:span) do
|
23
|
+
concat tag.i class: 'fa fa-th-large'
|
24
|
+
end +
|
25
|
+
content_tag(:span) do
|
26
|
+
model.name
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
28
30
|
end
|
29
31
|
end
|
30
32
|
}.join.html_safe
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
33d3c35c58c8db0310c4cb3ec7ff742813910e07
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cm-admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sajinmp
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-02-
|
13
|
+
date: 2022-02-15 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: pagy
|