cm-admin 4.4.1 → 4.4.8
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/.github/workflows/test.yml +16 -2
- data/Gemfile.lock +5 -5
- data/app/assets/javascripts/cm_admin/application.js +1 -1
- data/app/assets/javascripts/cm_admin/kanban.js +31 -29
- data/app/assets/javascripts/cm_admin/shared_scaffolds.js +5 -0
- data/app/assets/stylesheets/cm_admin/base/sidebar.scss +29 -10
- data/app/assets/stylesheets/cm_admin/components/_buttons.scss +1 -1
- data/app/assets/stylesheets/cm_admin/helpers/_mixins.scss +4 -0
- data/app/controllers/cm_admin/resource_controller.rb +2 -2
- data/app/helpers/cm_admin/application_helper.rb +24 -0
- data/app/models/concerns/exportable.rb +3 -1
- data/app/views/cm_admin/main/_kanban.html.slim +2 -2
- data/lib/cm_admin/configuration.rb +2 -1
- data/lib/cm_admin/version.rb +1 -1
- data/lib/cm_admin/view_helpers/field_display_helper.rb +2 -2
- data/lib/cm_admin/view_helpers/navigation_helper.rb +109 -4
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f200f0b81773d02d7dd472b90c0dcdc124cd3797e7a09b06cef05b42b597132
|
4
|
+
data.tar.gz: 31ebaa25c7016f262697e52f76bc695db07595286d8ac088175390d09eea1ffe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a655ebbf63906cd67dd83f3e2a68eaff22c1d215a4e6b0eb1ea7e05b471ccb24907a65552236ca893161fa64979cb03c825d4b922637de73124fb601174df8d3
|
7
|
+
data.tar.gz: 9ebfab98bc9321b20141765412dbb229e6c994195a3f82de0c1420c423bea0fe6790aaaaf57147a92a9c850713e051f471e49f35e9d64f5e1d31a470fab6268a
|
data/.github/workflows/test.yml
CHANGED
@@ -7,6 +7,10 @@ jobs:
|
|
7
7
|
if: "!contains(github.event.head_commit.message, '[skip-tests]')"
|
8
8
|
runs-on: ubuntu-latest
|
9
9
|
|
10
|
+
strategy:
|
11
|
+
matrix:
|
12
|
+
rails-version: ["7.1", "7.2", "8.0"]
|
13
|
+
|
10
14
|
services:
|
11
15
|
postgres:
|
12
16
|
image: postgres:17
|
@@ -28,10 +32,16 @@ jobs:
|
|
28
32
|
|
29
33
|
- name: Install dependencies
|
30
34
|
working-directory: feature-app
|
31
|
-
|
35
|
+
env:
|
36
|
+
RAILS_TEST_VERSION: ${{ matrix.rails-version }}
|
37
|
+
run: |
|
38
|
+
bundle install
|
39
|
+
bundle exec appraisal install
|
32
40
|
|
33
41
|
- name: Set up database
|
34
42
|
working-directory: feature-app
|
43
|
+
env:
|
44
|
+
RAILS_TEST_VERSION: ${{ matrix.rails-version }}
|
35
45
|
run: |
|
36
46
|
cp config/database.yml.ci config/database.yml
|
37
47
|
RAILS_ENV=test bundle exec rails db:create
|
@@ -39,8 +49,12 @@ jobs:
|
|
39
49
|
|
40
50
|
- name: Precompile assets
|
41
51
|
working-directory: feature-app
|
52
|
+
env:
|
53
|
+
RAILS_TEST_VERSION: ${{ matrix.rails-version }}
|
42
54
|
run: RAILS_ENV=test bundle exec rails assets:precompile
|
43
55
|
|
44
56
|
- name: Run RSpec tests
|
45
57
|
working-directory: feature-app
|
46
|
-
|
58
|
+
env:
|
59
|
+
RAILS_TEST_VERSION: ${{ matrix.rails-version }}
|
60
|
+
run: bundle exec appraisal rails-${{ matrix.rails-version }} rspec
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cm-admin (4.4.
|
4
|
+
cm-admin (4.4.8)
|
5
5
|
caxlsx_rails
|
6
6
|
cocoon (~> 1.2.15)
|
7
7
|
csv (>= 3.3.0)
|
@@ -158,13 +158,13 @@ GEM
|
|
158
158
|
timeout
|
159
159
|
net-smtp (0.5.0)
|
160
160
|
net-protocol
|
161
|
-
nio4r (2.7.
|
162
|
-
nokogiri (1.
|
161
|
+
nio4r (2.7.3)
|
162
|
+
nokogiri (1.18.1)
|
163
163
|
mini_portile2 (~> 2.8.2)
|
164
164
|
racc (~> 1.4)
|
165
|
-
nokogiri (1.
|
165
|
+
nokogiri (1.18.1-arm64-darwin)
|
166
166
|
racc (~> 1.4)
|
167
|
-
nokogiri (1.
|
167
|
+
nokogiri (1.18.1-x86_64-linux-gnu)
|
168
168
|
racc (~> 1.4)
|
169
169
|
pagy (4.11.0)
|
170
170
|
parallel (1.26.3)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import "./scaffolds.js";
|
2
2
|
import "./shared_scaffolds.js";
|
3
3
|
|
4
|
+
import "./kanban.js";
|
4
5
|
import "./bulk_actions.js";
|
5
6
|
import "./cocoon.js";
|
6
7
|
import "./exports.js";
|
@@ -8,5 +9,4 @@ import "./filters.js";
|
|
8
9
|
import "./form_validation.js";
|
9
10
|
import "./quick_search.js";
|
10
11
|
import "./custom.js";
|
11
|
-
import "./kanban.js";
|
12
12
|
import "./custom_action";
|
@@ -1,30 +1,32 @@
|
|
1
|
-
$(document).on(
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
})
|
1
|
+
$(document).on("turbo:load", function() {
|
2
|
+
$(document).on('click', "[data-action='kanban-show-more']", function(e) {
|
3
|
+
e.preventDefault();
|
4
|
+
var page = $(this).data('page') + 1
|
5
|
+
var query_string = window.location.search
|
6
|
+
$.ajax('/admin/batch_order_items' + query_string, {
|
7
|
+
type: "GET",
|
8
|
+
data: {
|
9
|
+
page: page,
|
10
|
+
per_page: $(this).data('per-page'),
|
11
|
+
view_type: 'kanban'
|
12
|
+
},
|
13
|
+
success: function (data) {
|
14
|
+
apply_response_to_board(data.table.data);
|
15
|
+
$("[data-action='kanban-show-more']").data('page', page)
|
16
|
+
if (data.table.paging.next_page == false) {
|
17
|
+
$("[data-action='kanban-show-more']").addClass('disabled')
|
18
|
+
}
|
19
|
+
$("[data-action='kanban-show-more']").data('page', page)
|
20
|
+
},
|
21
|
+
error: function (jqxhr, textStatus, errorThrown) {
|
22
|
+
alert("Something went wrong. Please try again later.\n" + errorThrown);
|
23
|
+
},
|
24
|
+
});
|
25
|
+
})
|
25
26
|
|
26
|
-
function apply_response_to_board(json_data) {
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
}
|
27
|
+
function apply_response_to_board(json_data) {
|
28
|
+
$.each(json_data, function(key, value) {
|
29
|
+
$('.' + key + " [data-section='kanban-cards']").append(value)
|
30
|
+
});
|
31
|
+
}
|
32
|
+
});
|
@@ -72,6 +72,11 @@ $(document).on("click", '[data-behaviour="offcanvas"]', function (e) {
|
|
72
72
|
});
|
73
73
|
});
|
74
74
|
|
75
|
+
// Select2 focus on open
|
76
|
+
$(document).on("select2:open", () => {
|
77
|
+
document.querySelector(".select2-search__field").focus();
|
78
|
+
});
|
79
|
+
|
75
80
|
$(document).on("click", '[data-bs-dismiss="offcanvas"]', function (e) {
|
76
81
|
$(document).off("submit", "[data-is-drawer-form='true']");
|
77
82
|
});
|
@@ -68,26 +68,45 @@
|
|
68
68
|
margin-left: 8px;
|
69
69
|
vertical-align: text-bottom;
|
70
70
|
}
|
71
|
+
|
71
72
|
&:hover {
|
72
73
|
color: $white;
|
73
|
-
|
74
|
+
@include white-rgba($opacity: 0.3);
|
74
75
|
}
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
76
|
+
|
77
|
+
.menu-sub-list {
|
78
|
+
.menu-sub-item {
|
79
|
+
@include font($size: $t4-text, $color: $ink-lightest-clr);
|
80
|
+
padding: 8px 8px 8px 45px;
|
81
|
+
transition: all 0.2s linear;
|
82
|
+
&:hover {
|
83
|
+
color: $white;
|
84
|
+
@include white-rgba($opacity: 0.1);
|
85
|
+
}
|
84
86
|
}
|
85
87
|
}
|
86
88
|
}
|
89
|
+
|
90
|
+
.submenu-item{
|
91
|
+
padding: 8px 24px 8px 46px;
|
92
|
+
}
|
93
|
+
|
87
94
|
.menu-link {
|
88
95
|
color: inherit;
|
89
96
|
text-decoration: none;
|
90
97
|
}
|
98
|
+
|
99
|
+
.selected-item {
|
100
|
+
@include white-rgba($opacity: 0.1);
|
101
|
+
font-weight: bold;
|
102
|
+
}
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
.sidebar-dropdown-svg {
|
107
|
+
padding-left: 8px;
|
108
|
+
height: 12px;
|
109
|
+
}
|
91
110
|
}
|
92
111
|
|
93
112
|
&__tabs-wrapper {
|
@@ -386,7 +386,7 @@ module CmAdmin
|
|
386
386
|
group_record_count = final_data.group(params[:kanban_column_name] || @current_action.kanban_attr[:column_name]).count
|
387
387
|
per_page = params[:per_page] || 20
|
388
388
|
page = params[:page] || 1
|
389
|
-
max_page = (group_record_count.values.max.to_i / per_page.to_f).ceil
|
389
|
+
max_page = (group_record_count.reject { |k, _v| k.nil? }.values.max.to_i / per_page.to_f).ceil
|
390
390
|
filtered_result.paging['next_page'] = (page.to_i < max_page)
|
391
391
|
filtered_result.column_count = group_record_count.reject { |key, _value| key.blank? }
|
392
392
|
|
@@ -402,7 +402,7 @@ module CmAdmin
|
|
402
402
|
next if page.to_i > (total_count.to_i / per_page.to_f).ceil
|
403
403
|
|
404
404
|
_, records = pagy(final_data.send(column), items: per_page.to_i)
|
405
|
-
filtered_result.data[column] = render_to_string partial: 'cm_admin/main/kanban_card', locals: { ar_collection: records }
|
405
|
+
filtered_result.data[column] = render_to_string partial: 'cm_admin/main/kanban_card', locals: { ar_collection: records, column_name: column }
|
406
406
|
end
|
407
407
|
filtered_result
|
408
408
|
end
|
@@ -20,6 +20,30 @@ module CmAdmin
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
def cm_recognize_path(path_helper)
|
24
|
+
http_methods = [:get, :post, :patch, :delete, :put, :options]
|
25
|
+
cm_admin_path = cm_admin.send(path_helper)
|
26
|
+
recognized_path = nil
|
27
|
+
http_methods.each do |method|
|
28
|
+
begin
|
29
|
+
recognized_path = Rails.application.routes.recognize_path(cm_admin_path, method: method)
|
30
|
+
return recognized_path if recognized_path.present?
|
31
|
+
rescue ActionController::RoutingError
|
32
|
+
next
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def validate_cm_path_policy(path_helper)
|
38
|
+
recognized_path= cm_recognize_path(path_helper)
|
39
|
+
|
40
|
+
model_name = recognized_path[:controller].split('/').last.singularize.classify
|
41
|
+
action_name = action(recognized_path[:action])
|
42
|
+
@policy_model = CmAdmin::Model.find_by(name: model_name)
|
43
|
+
policy([:cm_admin, @policy_model&.name&.constantize]).send("#{action_name}?")
|
44
|
+
end
|
45
|
+
|
46
|
+
|
23
47
|
def action(action_name)
|
24
48
|
case action_name.to_sym
|
25
49
|
when :update
|
@@ -68,7 +68,9 @@ module Exportable
|
|
68
68
|
column = CmAdmin::Models::Column.find_by(model, :index, { name: column_name.to_sym })
|
69
69
|
record_hash[column.field_name] = if column.field_type == :custom
|
70
70
|
send(column.helper_method, record, column.field_name).to_s
|
71
|
-
|
71
|
+
elsif column.field_type == :enum
|
72
|
+
record.send(column.field_name).to_s.titleize
|
73
|
+
else
|
72
74
|
record.send(column.field_name).to_s
|
73
75
|
end
|
74
76
|
end
|
@@ -6,11 +6,11 @@
|
|
6
6
|
.kanban-list__header
|
7
7
|
p = column_name.to_s.titleize
|
8
8
|
p.counter = @ar_object.column_count[column_name].to_i
|
9
|
-
.cards
|
9
|
+
.cards data-section='kanban-cards'
|
10
10
|
= @ar_object.data[column_name]
|
11
11
|
|
12
12
|
.pagination-bar.kanban-pagination
|
13
|
-
.btn.btn-primary.kanban-show-more data-page=1 Show more
|
13
|
+
.btn.btn-primary.kanban-show-more data-action='kanban-show-more' data-page=1 Show more
|
14
14
|
/ = render partial: 'cm_admin/main/show_as_drawer'
|
15
15
|
|
16
16
|
= export_modal(@model)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module CmAdmin
|
2
2
|
class Configuration
|
3
|
-
attr_accessor :layout, :included_models, :cm_admin_models, :enable_tracking, :project_name
|
3
|
+
attr_accessor :layout, :included_models, :cm_admin_models, :enable_tracking, :project_name, :sidebar
|
4
4
|
|
5
5
|
def initialize
|
6
6
|
@layout = 'admin'
|
@@ -8,6 +8,7 @@ module CmAdmin
|
|
8
8
|
@cm_admin_models = []
|
9
9
|
@enable_tracking = false
|
10
10
|
@project_name = ''
|
11
|
+
@sidebar = []
|
11
12
|
end
|
12
13
|
end
|
13
14
|
end
|
data/lib/cm_admin/version.rb
CHANGED
@@ -162,13 +162,13 @@ module CmAdmin
|
|
162
162
|
def show_attachment_value(ar_object, field)
|
163
163
|
if ar_object.send(field.field_name).attached?
|
164
164
|
if has_one_image_attached?(ar_object, field)
|
165
|
-
content_tag :a, href: ar_object.send(field.field_name).url do
|
165
|
+
content_tag :a, href: ar_object.send(field.field_name).url, target: '_blank' do
|
166
166
|
ar_object.send(field.field_name).filename.to_s
|
167
167
|
end
|
168
168
|
elsif has_many_image_attached?(ar_object, field)
|
169
169
|
ar_object.send(field.field_name).map do |asset|
|
170
170
|
content_tag(:div) do
|
171
|
-
content_tag :a, href: asset.url do
|
171
|
+
content_tag :a, href: asset.url, target: '_blank' do
|
172
172
|
asset.filename.to_s
|
173
173
|
end
|
174
174
|
end
|
@@ -1,13 +1,26 @@
|
|
1
1
|
require 'pagy'
|
2
|
+
|
2
3
|
module CmAdmin
|
3
4
|
module ViewHelpers
|
4
|
-
module NavigationHelper
|
5
|
+
module NavigationHelper # rubocop:disable Metrics/ModuleLength
|
5
6
|
include Pagy::Frontend
|
7
|
+
|
6
8
|
def navigation_links(navigation_type)
|
7
|
-
CmAdmin.config.
|
9
|
+
if CmAdmin.config.sidebar.present?
|
10
|
+
custom_navigation_links(navigation_type, CmAdmin.config.sidebar)
|
11
|
+
else
|
12
|
+
default_navigation_links(navigation_type)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def default_navigation_links(navigation_type)
|
19
|
+
CmAdmin.config.cm_admin_models.map do |model| # rubocop:disable Metrics/BlockLength
|
8
20
|
next unless model.is_visible_on_sidebar
|
9
21
|
|
10
|
-
path = CmAdmin::Engine.mount_path
|
22
|
+
path = "#{CmAdmin::Engine.mount_path}/#{model.name.underscore.pluralize}"
|
23
|
+
|
11
24
|
if policy([:cm_admin, model.name.classify.constantize]).index?
|
12
25
|
if navigation_type == 'sidebar'
|
13
26
|
content_tag(:a, href: path) do
|
@@ -15,7 +28,7 @@ module CmAdmin
|
|
15
28
|
content_tag(:span, class: 'menu-icon') do
|
16
29
|
concat tag.i class: model.icon_name.to_s
|
17
30
|
end +
|
18
|
-
|
31
|
+
model.model_name.titleize.pluralize
|
19
32
|
end
|
20
33
|
end
|
21
34
|
elsif navigation_type == 'quick_links'
|
@@ -35,6 +48,98 @@ module CmAdmin
|
|
35
48
|
end
|
36
49
|
end.join.html_safe
|
37
50
|
end
|
51
|
+
|
52
|
+
# Custom Navbar Code
|
53
|
+
def custom_navigation_links(navigation_type, sidebar = []) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
54
|
+
sidebar.filter_map do |main_item|
|
55
|
+
@policy_model = nil
|
56
|
+
next unless should_display_item?(main_item)
|
57
|
+
|
58
|
+
path = main_item[:children].present? ? collapse_path(main_item) : { href: get_route(main_item[:path]) }
|
59
|
+
recognized_path = main_item[:path].present? && main_item[:path].start_with?('cm_') ? cm_recognize_path(main_item[:path]) : {}
|
60
|
+
current_path = get_route(main_item[:path]).present? && request.params.dig(:tab_id) == (recognized_path[:controller].to_s + '#' + recognized_path[:action].to_s).gsub("/", "_").gsub("#", "_") ? 'selected-item' : ''
|
61
|
+
|
62
|
+
if navigation_type == 'sidebar'
|
63
|
+
content_tag(:a, path) do
|
64
|
+
content_tag(:div, class: "menu-item #{current_path}") do
|
65
|
+
content_tag(:span, class: 'menu-icon') { tag.i(class: main_item[:icon_name] || @policy_model&.icon_name || 'fa fa-th-large') } +
|
66
|
+
content_tag(:span, main_item[:display_name] || @policy_model&.formatted_name.pluralize) + content_tag(:span) +
|
67
|
+
(main_item[:children].present? ? tag.i(class: 'sidebar-dropdown-svg fa fa-chevron-down') : ''.html_safe)
|
68
|
+
end +
|
69
|
+
generate_sub_menu(main_item)
|
70
|
+
end
|
71
|
+
elsif navigation_type == 'quick_links'
|
72
|
+
(main_item[:children] || [main_item]).filter_map do |item|
|
73
|
+
next unless should_display_item?(item)
|
74
|
+
|
75
|
+
content_tag(:a, href: get_route(item[:path]), class: 'visible') do
|
76
|
+
content_tag(:div, class: 'result-item') do
|
77
|
+
content_tag(:span) { tag.i(class: item[:icon_name] || @policy_model&.icon_name || 'fa fa-th-large') } +
|
78
|
+
content_tag(:span, item[:display_name] || @policy_model&.formatted_name.pluralize)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end.join.html_safe
|
84
|
+
end
|
85
|
+
|
86
|
+
# Helper Methods
|
87
|
+
def should_display_item?(sidebar_item)
|
88
|
+
return true if sidebar_item[:children]&.any? { |sub_item| should_display_item?(sub_item) }
|
89
|
+
return validate_cm_path_policy(sidebar_item[:path]) if sidebar_item[:path]&.start_with?('cm_') && (sidebar_item[:display_if].nil? || sidebar_item[:display_if]&.call(current_user))
|
90
|
+
return true if sidebar_item[:display_if]&.call(current_user) || sidebar_item[:display_if].nil? && sidebar_item[:children].nil?
|
91
|
+
|
92
|
+
false
|
93
|
+
end
|
94
|
+
|
95
|
+
def collapse_path(main_item)
|
96
|
+
{
|
97
|
+
'data-bs-toggle' => 'collapse',
|
98
|
+
'href' => "##{(main_item[:display_name] || @policy_model&.display_name).parameterize}Collapse",
|
99
|
+
'role' => 'button',
|
100
|
+
'aria-expanded' => 'true',
|
101
|
+
'aria-controls' => "#{(main_item[:display_name] || @policy_model&.display_name).parameterize}Collapse",
|
102
|
+
'data-cm-nav-id' => "##{(main_item[:display_name] || @policy_model&.display_name).parameterize}Collapse"
|
103
|
+
}
|
104
|
+
end
|
105
|
+
|
106
|
+
def generate_sub_menu(sidebar_item)
|
107
|
+
return ''.html_safe unless sidebar_item[:children].present?
|
108
|
+
|
109
|
+
sub_menu = sidebar_item[:children].filter_map { |sub_item| sub_menu_link(sub_item) }.join.html_safe
|
110
|
+
sub_menu_state_class = sidebar_item[:children].any? { |sub_item|
|
111
|
+
recognized_path = sub_item[:path].present? && sub_item[:path].start_with?('cm_') ? cm_recognize_path(sub_item[:path]) : {}
|
112
|
+
get_route(sub_item[:path]).present? && request.params.dig(:tab_id) == ((recognized_path[:controller].to_s + '#' + recognized_path[:action].to_s).gsub("/", "_").gsub("#", "_")) } ? 'show' : 'collapse'
|
113
|
+
content_tag(:div, id: "#{(sidebar_item[:display_name] || @policy_model&.formatted_name.pluralize).parameterize}Collapse", "data-cm-nav-id": "#{(sidebar_item[:display_name] || @policy_model&.formatted_name.pluralize).parameterize}Collapse", class: sub_menu_state_class) do
|
114
|
+
sub_menu
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
def sub_menu_link(sub_item)
|
119
|
+
return unless should_display_item?(sub_item)
|
120
|
+
|
121
|
+
recognized_path = sub_item[:path].present? && sub_item[:path].start_with?('cm_') ? cm_recognize_path(sub_item[:path]) : {}
|
122
|
+
current_path = get_route(sub_item[:path]).present? && request.params.dig(:tab_id) == ((recognized_path[:controller].to_s + '#' + recognized_path[:action].to_s).gsub("/", "_").gsub("#", "_")) ? 'selected-item' : ''
|
123
|
+
|
124
|
+
content_tag(:a, href: get_route(sub_item[:path])) do
|
125
|
+
content_tag(:div, class: "menu-item submenu-item #{current_path}") do
|
126
|
+
content_tag(:span, class: 'menu-icon') { tag.i(class: sub_item[:icon_name] || @policy_model&.icon_name || 'fa fa-th-large') } +
|
127
|
+
content_tag(:span, sub_item[:display_name] || @policy_model&.formatted_name.pluralize)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
def get_route(path)
|
133
|
+
return '' unless path.present?
|
134
|
+
|
135
|
+
recognized_path = path.start_with?('cm_') ? cm_recognize_path(path) : {}
|
136
|
+
|
137
|
+
|
138
|
+
return cm_admin.send(path.to_sym) + "?tab_id=#{(recognized_path[:controller].to_s + '#' + recognized_path[:action].to_s).gsub("/", "_").gsub("#", "_")}" if path.start_with?('cm_')
|
139
|
+
return send(path.to_sym) if Rails.application.routes.url_helpers.method_defined?(path.to_sym)
|
140
|
+
|
141
|
+
path
|
142
|
+
end
|
38
143
|
end
|
39
144
|
end
|
40
145
|
end
|
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: 4.4.
|
4
|
+
version: 4.4.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael
|
@@ -11,10 +11,9 @@ authors:
|
|
11
11
|
- Pranav
|
12
12
|
- Mahaveer
|
13
13
|
- Austin
|
14
|
-
autorequire:
|
15
14
|
bindir: exe
|
16
15
|
cert_chain: []
|
17
|
-
date:
|
16
|
+
date: 2025-01-17 00:00:00.000000000 Z
|
18
17
|
dependencies:
|
19
18
|
- !ruby/object:Gem::Dependency
|
20
19
|
name: caxlsx_rails
|
@@ -508,7 +507,6 @@ metadata:
|
|
508
507
|
homepage_uri: https://github.com/commutatus/cm-admin
|
509
508
|
source_code_uri: https://github.com/commutatus/cm-admin
|
510
509
|
github_repo: ssh://github.com/commutatus/cm-admin
|
511
|
-
post_install_message:
|
512
510
|
rdoc_options: []
|
513
511
|
require_paths:
|
514
512
|
- lib
|
@@ -523,8 +521,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
523
521
|
- !ruby/object:Gem::Version
|
524
522
|
version: '0'
|
525
523
|
requirements: []
|
526
|
-
rubygems_version: 3.
|
527
|
-
signing_key:
|
524
|
+
rubygems_version: 3.6.2
|
528
525
|
specification_version: 4
|
529
526
|
summary: CmAdmin is a robust gem designed to assist in creating admin panels for Rails
|
530
527
|
applications
|