cm-admin 0.5.6 → 0.5.7
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/components/_drawer.scss +4 -0
- data/app/views/cm_admin/main/_table.html.slim +19 -15
- data/app/views/cm_admin/main/_top_navbar.html.slim +4 -5
- data/app/views/cm_admin/main/associated_index.html.slim +1 -1
- data/lib/cm_admin/model.rb +8 -2
- data/lib/cm_admin/version.rb +1 -1
- data/lib/cm_admin/view_helpers/field_display_helper.rb +1 -1
- data/lib/cm_admin/view_helpers/navigation_helper.rb +3 -3
- data/tmp/cache/webpacker/last-compilation-digest-development +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4005c7711af2f931298a2054cd527de1a67a92a42deaecd8fb71b37fbcdc5fb2
|
4
|
+
data.tar.gz: 8fa616289069247a2418896b7ac2cb4f6ca5ec1dfc121d5a06cececb9c3a5242
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82d898a13ff420a9c3e7b9df6f9daca9174df4bc3587c879cac1817cdbdcb5e812562f81a7e5ed8716729da466da5240037e3d7bca36900d5efb355859c4ca1a
|
7
|
+
data.tar.gz: 29a54f03bb2aaa0cec4aa0fecaef373376e94a4e6e47e67219245ae257f2f2774ad388e9a4b8b9510a23d45f130fc9a6703128403b512256525d2197dae292a0
|
@@ -31,21 +31,25 @@
|
|
31
31
|
= show_field_value(ar_object, column)
|
32
32
|
- if column.field_type == :drawer
|
33
33
|
= render partial: column.drawer_partial, locals: { ar_object: ar_object}
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
-
|
46
|
-
- if
|
47
|
-
|
48
|
-
|
34
|
+
|
35
|
+
- edit_action = @model.available_actions.select{|act| act if act.action_type.eql?(:default) && act.name.eql?('edit')}
|
36
|
+
- custom_actions = @model.available_actions.select{|act| act if act.route_type == 'member' && [:button, :modal].include?(act.display_type)}
|
37
|
+
- if custom_actions.any? || edit_action.any?
|
38
|
+
td.row-action-cell
|
39
|
+
.row-action-tool
|
40
|
+
button.secondary-btn.tool-btn type="button"
|
41
|
+
span
|
42
|
+
i.fa.fa-bars.bolder
|
43
|
+
span
|
44
|
+
i.fa.fa-angle-down
|
45
|
+
.popup-card.table-export-popup.hidden
|
46
|
+
- if edit_action.any?
|
47
|
+
= link_to "#{page_url('edit', ar_object)}" do
|
48
|
+
.popup-option Edit
|
49
|
+
- custom_actions.each do |custom_action|
|
50
|
+
- if custom_action.display_if.call(ar_object)
|
51
|
+
= link_to custom_action.path.gsub(':id', ar_object.id.to_s), method: custom_action.verb do
|
52
|
+
.popup-option = custom_action.name.titleize
|
49
53
|
|
50
54
|
.cm-pagination
|
51
55
|
.cm-pagination__lhs Showing #{@ar_object.pagy.from} to #{@ar_object.pagy.to} out of #{@ar_object.pagy.count}
|
@@ -20,9 +20,9 @@
|
|
20
20
|
li
|
21
21
|
.popup-option.pointer data-bs-toggle='modal' data-bs-target='#exportmodal'
|
22
22
|
span Export
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
- new_action = @model.available_actions.select{|act| act if act.action_type.eql?(:default) && act.name.eql?('new')}
|
24
|
+
- if new_action.any?
|
25
|
+
= link_to 'Add', "#{page_url('new')}", class: 'primary-btn ml-2'
|
26
26
|
- @model.available_actions.select{|act| act if act.route_type == 'collection'}.each do |custom_action|
|
27
27
|
- if custom_action.display_type == :button
|
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
|
@@ -37,5 +37,4 @@
|
|
37
37
|
|
38
38
|
- edit_action = @model.available_actions.select{|act| act if act.action_type.eql?(:default) && act.name.eql?('edit')}
|
39
39
|
- if edit_action.any?
|
40
|
-
|
41
|
-
= "Edit #{@model.name}"
|
40
|
+
= link_to "Edit #{@model.name}", "#{page_url('edit', @ar_object)}", class: 'primary-btn ml-2'
|
data/lib/cm_admin/model.rb
CHANGED
@@ -21,7 +21,8 @@ module CmAdmin
|
|
21
21
|
include Models::Blocks
|
22
22
|
include Models::DslMethod
|
23
23
|
include Models::ControllerMethod
|
24
|
-
attr_accessor :available_actions, :actions_set, :available_fields, :permitted_fields,
|
24
|
+
attr_accessor :available_actions, :actions_set, :available_fields, :permitted_fields,
|
25
|
+
:current_action, :params, :filters, :available_tabs, :icon_name
|
25
26
|
attr_reader :name, :ar_model, :is_visible_on_sidebar
|
26
27
|
|
27
28
|
# Class variable for storing all actions
|
@@ -32,6 +33,7 @@ module CmAdmin
|
|
32
33
|
@name = entity.name
|
33
34
|
@ar_model = entity
|
34
35
|
@is_visible_on_sidebar = true
|
36
|
+
@icon_name = 'fa fa-th-large'
|
35
37
|
@available_actions ||= []
|
36
38
|
@current_action = nil
|
37
39
|
@available_tabs ||= []
|
@@ -59,7 +61,7 @@ module CmAdmin
|
|
59
61
|
current_action = CmAdmin::Models::Action.find_by(self, name: action_name.to_s)
|
60
62
|
if current_action
|
61
63
|
@current_action = current_action
|
62
|
-
@ar_object = @ar_model.find(params[:id])
|
64
|
+
@ar_object = @ar_model.name.classify.constantize.find(params[:id])
|
63
65
|
if @current_action.child_records
|
64
66
|
child_records = @ar_object.send(@current_action.child_records)
|
65
67
|
@associated_model = CmAdmin::Model.find_by(name: @ar_model.reflect_on_association(@current_action.child_records).klass.name)
|
@@ -90,6 +92,10 @@ module CmAdmin
|
|
90
92
|
@is_visible_on_sidebar = visible_option
|
91
93
|
end
|
92
94
|
|
95
|
+
def set_icon(name)
|
96
|
+
@icon_name = name
|
97
|
+
end
|
98
|
+
|
93
99
|
|
94
100
|
private
|
95
101
|
|
data/lib/cm_admin/version.rb
CHANGED
@@ -43,7 +43,7 @@ module CmAdmin
|
|
43
43
|
ar_object.send(field.field_name).to_s.titleize
|
44
44
|
when :tag
|
45
45
|
content_tag :span, class: "status-tag default-#{ar_object.send(field.field_name.to_s + '_before_type_cast')}" do
|
46
|
-
ar_object.send(field.field_name).to_s.
|
46
|
+
ar_object.send(field.field_name).to_s.upcase
|
47
47
|
end
|
48
48
|
when :attachment
|
49
49
|
concat show_attachment_value(ar_object, field)
|
@@ -11,16 +11,16 @@ module CmAdmin
|
|
11
11
|
content_tag(:a, href: path) do
|
12
12
|
content_tag(:div, class: 'menu-item') do
|
13
13
|
content_tag(:span, class: 'menu-icon') do
|
14
|
-
concat tag.i class:
|
14
|
+
concat tag.i class: "#{model.icon_name}"
|
15
15
|
end +
|
16
|
-
model.name
|
16
|
+
model.name.pluralize
|
17
17
|
end
|
18
18
|
end
|
19
19
|
elsif navigation_type == "quick_links"
|
20
20
|
content_tag(:a, href: path, class: 'visible') do
|
21
21
|
content_tag(:div, class: 'result-item') do
|
22
22
|
content_tag(:span) do
|
23
|
-
concat tag.i class:
|
23
|
+
concat tag.i class: "#{model.icon_name}"
|
24
24
|
end +
|
25
25
|
content_tag(:span) do
|
26
26
|
model.name
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
07d558738c316293586496817b2bccbf6430b5bd
|
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.7
|
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-03-
|
13
|
+
date: 2022-03-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: pagy
|
@@ -230,7 +230,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
230
230
|
- !ruby/object:Gem::Version
|
231
231
|
version: '0'
|
232
232
|
requirements: []
|
233
|
-
rubygems_version: 3.
|
233
|
+
rubygems_version: 3.2.32
|
234
234
|
signing_key:
|
235
235
|
specification_version: 4
|
236
236
|
summary: This is an admin panel gem
|