cm-admin 4.2.1 → 4.4.0
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/release-cm-gem.yml +38 -38
- data/Gemfile.lock +82 -83
- data/app/assets/javascripts/cm_admin/application.js +1 -1
- data/app/assets/javascripts/cm_admin/custom_action.js +2 -0
- data/app/assets/javascripts/cm_admin/initialize_components.js +31 -0
- data/app/assets/javascripts/cm_admin/shared_scaffolds.js +5 -27
- data/app/controllers/cm_admin/resource_controller.rb +31 -15
- data/app/models/concerns/exportable.rb +1 -1
- data/app/views/cm_admin/main/_kanban.html.slim +2 -2
- data/app/views/cm_admin/main/_show_content.html.slim +2 -1
- data/app/views/cm_admin/main/_table.html.slim +2 -0
- data/app/views/cm_admin/main/index.html.slim +11 -5
- data/app/views/cm_admin/main/show.html.slim +1 -1
- data/app/views/layouts/_drawer_show.html.slim +9 -0
- data/app/views/layouts/cm_admin.html.slim +1 -2
- data/docs/RoleManagement.md +1 -1
- data/lib/cm_admin/model.rb +5 -1
- data/lib/cm_admin/version.rb +1 -1
- data/lib/cm_admin/view_helpers/page_info_helper.rb +1 -1
- data/lib/cm_admin.rb +16 -2
- data/upload.sh +12 -0
- metadata +6 -5
- data/.gem/credentials +0 -5
- data/config/initializers/active_record_extension.rb +0 -9
- /data/app/views/layouts/{_drawer.html.slim → _drawer_form.html.slim} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f2cbd6a0eb88a1b484b7dd22581707ba8ace583b855e7d8fddc70a7f707c982
|
4
|
+
data.tar.gz: 3e16b540f328160794ee09d1f2851bd9b017265a033806c56f76902eb8060cb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f75af6089fa15c0d7e3e9d914a3aa2c2c2248b9ae45bc833238677de6c82761717beca49515f0ade78890e9495f1c714e80e9de4c9abb116b6c62f576fba8cc8
|
7
|
+
data.tar.gz: d22b094320cd0a841675b222c20529dc6ab6eb0e136afd73a31ac0bd877714c01cd135a2ac0dd68ee47dbbb0a997877a2f3eb5a9db18e6ff7d7984ac25c4a768
|
@@ -16,56 +16,56 @@ permissions:
|
|
16
16
|
contents: read
|
17
17
|
|
18
18
|
jobs:
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
build:
|
20
|
+
name: Build gem
|
21
|
+
runs-on: ubuntu-latest
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
permissions:
|
24
|
+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
|
25
|
+
contents: write # IMPORTANT: this permission is required for `rake release` to push the release tag
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
steps:
|
28
|
+
# Set up
|
29
|
+
- uses: actions/checkout@v4
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
31
|
+
- name: set git config
|
32
|
+
env:
|
33
|
+
GH_TOKEN: ${{ github.token }}
|
34
|
+
run: |
|
35
|
+
git config --global user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com"
|
36
|
+
git config --global user.name "$(gh api /users/${GITHUB_ACTOR} | jq .name -r)"
|
37
|
+
git config -l
|
38
|
+
- name: Set up Ruby
|
39
|
+
uses: ruby/setup-ruby@v1
|
40
|
+
with:
|
41
|
+
bundler-cache: true
|
42
|
+
ruby-version: ruby
|
43
43
|
|
44
|
-
|
45
|
-
|
44
|
+
- name: Install the gem-release
|
45
|
+
run: gem install gem-release
|
46
46
|
|
47
|
-
|
48
|
-
|
47
|
+
- name: Bump the gem
|
48
|
+
run: gem bump --version ${{ github.event.inputs.bump_type }} -p
|
49
49
|
|
50
|
-
|
51
|
-
|
50
|
+
- name: Remove lock on bundle
|
51
|
+
run: bundle config set frozen false
|
52
52
|
|
53
|
-
|
54
|
-
|
53
|
+
- name: Bundle Install
|
54
|
+
run: bundle install
|
55
55
|
|
56
|
-
|
57
|
-
|
56
|
+
- name: Git Add files
|
57
|
+
run: git add Gemfile.lock
|
58
58
|
|
59
|
-
|
60
|
-
|
59
|
+
- name: Git Commit
|
60
|
+
run: git commit -m "Add bundle files"
|
61
61
|
|
62
|
-
|
63
|
-
|
62
|
+
- name: Push the new version
|
63
|
+
run: git push origin ${{ github.ref_name }}
|
64
64
|
|
65
65
|
release:
|
66
66
|
name: Release gem
|
67
67
|
runs-on: ubuntu-latest
|
68
|
-
|
68
|
+
needs: build
|
69
69
|
permissions:
|
70
70
|
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
|
71
71
|
contents: write # IMPORTANT: this permission is required for `rake release` to push the release tag
|
@@ -99,7 +99,7 @@ jobs:
|
|
99
99
|
|
100
100
|
- name: Push gem
|
101
101
|
env:
|
102
|
-
|
102
|
+
CM_GEMS_PASSWORD: ${{ vars.CM_GEMS_PASSWORD }}
|
103
103
|
CM_GEMS_HOST: ${{ vars.CM_GEMS_HOST }}
|
104
104
|
run: |
|
105
|
-
|
105
|
+
./upload.sh $CM_GEMS_PASSWORD $CM_GEMS_HOST
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cm-admin (4.
|
4
|
+
cm-admin (4.4.0)
|
5
5
|
caxlsx_rails
|
6
6
|
cocoon (~> 1.2.15)
|
7
7
|
csv (>= 3.3.0)
|
@@ -16,86 +16,84 @@ PATH
|
|
16
16
|
GEM
|
17
17
|
remote: https://rubygems.org/
|
18
18
|
specs:
|
19
|
-
actioncable (
|
20
|
-
actionpack (=
|
21
|
-
activesupport (=
|
19
|
+
actioncable (8.0.0)
|
20
|
+
actionpack (= 8.0.0)
|
21
|
+
activesupport (= 8.0.0)
|
22
22
|
nio4r (~> 2.0)
|
23
23
|
websocket-driver (>= 0.6.1)
|
24
24
|
zeitwerk (~> 2.6)
|
25
|
-
actionmailbox (
|
26
|
-
actionpack (=
|
27
|
-
activejob (=
|
28
|
-
activerecord (=
|
29
|
-
activestorage (=
|
30
|
-
activesupport (=
|
31
|
-
mail (>= 2.
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
activejob (= 7.1.4.1)
|
39
|
-
activesupport (= 7.1.4.1)
|
40
|
-
mail (~> 2.5, >= 2.5.4)
|
41
|
-
net-imap
|
42
|
-
net-pop
|
43
|
-
net-smtp
|
25
|
+
actionmailbox (8.0.0)
|
26
|
+
actionpack (= 8.0.0)
|
27
|
+
activejob (= 8.0.0)
|
28
|
+
activerecord (= 8.0.0)
|
29
|
+
activestorage (= 8.0.0)
|
30
|
+
activesupport (= 8.0.0)
|
31
|
+
mail (>= 2.8.0)
|
32
|
+
actionmailer (8.0.0)
|
33
|
+
actionpack (= 8.0.0)
|
34
|
+
actionview (= 8.0.0)
|
35
|
+
activejob (= 8.0.0)
|
36
|
+
activesupport (= 8.0.0)
|
37
|
+
mail (>= 2.8.0)
|
44
38
|
rails-dom-testing (~> 2.2)
|
45
|
-
actionpack (
|
46
|
-
actionview (=
|
47
|
-
activesupport (=
|
39
|
+
actionpack (8.0.0)
|
40
|
+
actionview (= 8.0.0)
|
41
|
+
activesupport (= 8.0.0)
|
48
42
|
nokogiri (>= 1.8.5)
|
49
|
-
racc
|
50
43
|
rack (>= 2.2.4)
|
51
44
|
rack-session (>= 1.0.1)
|
52
45
|
rack-test (>= 0.6.3)
|
53
46
|
rails-dom-testing (~> 2.2)
|
54
47
|
rails-html-sanitizer (~> 1.6)
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
48
|
+
useragent (~> 0.16)
|
49
|
+
actiontext (8.0.0)
|
50
|
+
actionpack (= 8.0.0)
|
51
|
+
activerecord (= 8.0.0)
|
52
|
+
activestorage (= 8.0.0)
|
53
|
+
activesupport (= 8.0.0)
|
60
54
|
globalid (>= 0.6.0)
|
61
55
|
nokogiri (>= 1.8.5)
|
62
|
-
actionview (
|
63
|
-
activesupport (=
|
56
|
+
actionview (8.0.0)
|
57
|
+
activesupport (= 8.0.0)
|
64
58
|
builder (~> 3.1)
|
65
59
|
erubi (~> 1.11)
|
66
60
|
rails-dom-testing (~> 2.2)
|
67
61
|
rails-html-sanitizer (~> 1.6)
|
68
|
-
activejob (
|
69
|
-
activesupport (=
|
62
|
+
activejob (8.0.0)
|
63
|
+
activesupport (= 8.0.0)
|
70
64
|
globalid (>= 0.3.6)
|
71
|
-
activemodel (
|
72
|
-
activesupport (=
|
73
|
-
activerecord (
|
74
|
-
activemodel (=
|
75
|
-
activesupport (=
|
65
|
+
activemodel (8.0.0)
|
66
|
+
activesupport (= 8.0.0)
|
67
|
+
activerecord (8.0.0)
|
68
|
+
activemodel (= 8.0.0)
|
69
|
+
activesupport (= 8.0.0)
|
76
70
|
timeout (>= 0.4.0)
|
77
|
-
activestorage (
|
78
|
-
actionpack (=
|
79
|
-
activejob (=
|
80
|
-
activerecord (=
|
81
|
-
activesupport (=
|
71
|
+
activestorage (8.0.0)
|
72
|
+
actionpack (= 8.0.0)
|
73
|
+
activejob (= 8.0.0)
|
74
|
+
activerecord (= 8.0.0)
|
75
|
+
activesupport (= 8.0.0)
|
82
76
|
marcel (~> 1.0)
|
83
|
-
activesupport (
|
77
|
+
activesupport (8.0.0)
|
84
78
|
base64
|
79
|
+
benchmark (>= 0.3)
|
85
80
|
bigdecimal
|
86
|
-
concurrent-ruby (~> 1.0, >= 1.
|
81
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
87
82
|
connection_pool (>= 2.2.5)
|
88
83
|
drb
|
89
84
|
i18n (>= 1.6, < 2)
|
85
|
+
logger (>= 1.4.2)
|
90
86
|
minitest (>= 5.1)
|
91
|
-
|
92
|
-
tzinfo (~> 2.0)
|
87
|
+
securerandom (>= 0.3)
|
88
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
89
|
+
uri (>= 0.13.1)
|
93
90
|
ast (2.4.2)
|
94
91
|
axiom-types (0.1.1)
|
95
92
|
descendants_tracker (~> 0.0.4)
|
96
93
|
ice_nine (~> 0.11.0)
|
97
94
|
thread_safe (~> 0.3, >= 0.3.1)
|
98
95
|
base64 (0.2.0)
|
96
|
+
benchmark (0.4.0)
|
99
97
|
bigdecimal (3.1.8)
|
100
98
|
builder (3.3.0)
|
101
99
|
caxlsx (4.1.0)
|
@@ -115,7 +113,7 @@ GEM
|
|
115
113
|
csv (3.3.0)
|
116
114
|
csv-importer (0.8.2)
|
117
115
|
virtus
|
118
|
-
date (3.
|
116
|
+
date (3.4.0)
|
119
117
|
descendants_tracker (0.0.4)
|
120
118
|
thread_safe (~> 0.3, >= 0.3.1)
|
121
119
|
diff-lcs (1.5.1)
|
@@ -138,7 +136,8 @@ GEM
|
|
138
136
|
json (2.7.2)
|
139
137
|
language_server-protocol (3.17.0.3)
|
140
138
|
local_time (3.0.2)
|
141
|
-
|
139
|
+
logger (1.6.1)
|
140
|
+
loofah (2.23.1)
|
142
141
|
crass (~> 1.0.2)
|
143
142
|
nokogiri (>= 1.12.0)
|
144
143
|
mail (2.8.1)
|
@@ -148,10 +147,9 @@ GEM
|
|
148
147
|
net-smtp
|
149
148
|
marcel (1.0.4)
|
150
149
|
mini_mime (1.1.5)
|
151
|
-
mini_portile2 (2.8.
|
150
|
+
mini_portile2 (2.8.8)
|
152
151
|
minitest (5.25.1)
|
153
|
-
|
154
|
-
net-imap (0.4.17)
|
152
|
+
net-imap (0.5.1)
|
155
153
|
date
|
156
154
|
net-protocol
|
157
155
|
net-pop (0.1.2)
|
@@ -160,7 +158,7 @@ GEM
|
|
160
158
|
timeout
|
161
159
|
net-smtp (0.5.0)
|
162
160
|
net-protocol
|
163
|
-
nio4r (2.7.
|
161
|
+
nio4r (2.7.4)
|
164
162
|
nokogiri (1.16.7)
|
165
163
|
mini_portile2 (~> 2.8.2)
|
166
164
|
racc (~> 1.4)
|
@@ -173,7 +171,7 @@ GEM
|
|
173
171
|
parser (3.3.5.0)
|
174
172
|
ast (~> 2.4.1)
|
175
173
|
racc
|
176
|
-
psych (5.
|
174
|
+
psych (5.2.0)
|
177
175
|
stringio
|
178
176
|
pundit (2.2.0)
|
179
177
|
activesupport (>= 3.0.0)
|
@@ -183,23 +181,22 @@ GEM
|
|
183
181
|
rack (>= 3.0.0)
|
184
182
|
rack-test (2.1.0)
|
185
183
|
rack (>= 1.3)
|
186
|
-
rackup (2.1
|
184
|
+
rackup (2.2.1)
|
187
185
|
rack (>= 3)
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
activesupport (= 7.1.4.1)
|
186
|
+
rails (8.0.0)
|
187
|
+
actioncable (= 8.0.0)
|
188
|
+
actionmailbox (= 8.0.0)
|
189
|
+
actionmailer (= 8.0.0)
|
190
|
+
actionpack (= 8.0.0)
|
191
|
+
actiontext (= 8.0.0)
|
192
|
+
actionview (= 8.0.0)
|
193
|
+
activejob (= 8.0.0)
|
194
|
+
activemodel (= 8.0.0)
|
195
|
+
activerecord (= 8.0.0)
|
196
|
+
activestorage (= 8.0.0)
|
197
|
+
activesupport (= 8.0.0)
|
201
198
|
bundler (>= 1.15.0)
|
202
|
-
railties (=
|
199
|
+
railties (= 8.0.0)
|
203
200
|
rails-dom-testing (2.2.0)
|
204
201
|
activesupport (>= 5.0.0)
|
205
202
|
minitest
|
@@ -207,20 +204,20 @@ GEM
|
|
207
204
|
rails-html-sanitizer (1.6.0)
|
208
205
|
loofah (~> 2.21)
|
209
206
|
nokogiri (~> 1.14)
|
210
|
-
railties (
|
211
|
-
actionpack (=
|
212
|
-
activesupport (=
|
213
|
-
irb
|
207
|
+
railties (8.0.0)
|
208
|
+
actionpack (= 8.0.0)
|
209
|
+
activesupport (= 8.0.0)
|
210
|
+
irb (~> 1.13)
|
214
211
|
rackup (>= 1.0.0)
|
215
212
|
rake (>= 12.2)
|
216
213
|
thor (~> 1.0, >= 1.2.2)
|
217
214
|
zeitwerk (~> 2.6)
|
218
215
|
rainbow (3.1.1)
|
219
216
|
rake (12.3.3)
|
220
|
-
rdoc (6.
|
217
|
+
rdoc (6.8.1)
|
221
218
|
psych (>= 4.0.0)
|
222
219
|
regexp_parser (2.9.2)
|
223
|
-
reline (0.5.
|
220
|
+
reline (0.5.11)
|
224
221
|
io-console (~> 0.5)
|
225
222
|
rspec (3.13.0)
|
226
223
|
rspec-core (~> 3.13.0)
|
@@ -257,27 +254,29 @@ GEM
|
|
257
254
|
rubocop-ast (>= 1.31.1, < 2.0)
|
258
255
|
ruby-progressbar (1.13.0)
|
259
256
|
rubyzip (2.3.2)
|
257
|
+
securerandom (0.3.2)
|
260
258
|
slim (4.1.0)
|
261
259
|
temple (>= 0.7.6, < 0.9)
|
262
260
|
tilt (>= 2.0.6, < 2.1)
|
263
|
-
stringio (3.1.
|
261
|
+
stringio (3.1.2)
|
264
262
|
temple (0.8.2)
|
265
263
|
thor (1.3.2)
|
266
264
|
thread_safe (0.3.6)
|
267
265
|
tilt (2.0.11)
|
268
|
-
timeout (0.4.
|
266
|
+
timeout (0.4.2)
|
269
267
|
tzinfo (2.0.6)
|
270
268
|
concurrent-ruby (~> 1.0)
|
271
269
|
unicode-display_width (2.6.0)
|
270
|
+
uri (1.0.2)
|
271
|
+
useragent (0.16.10)
|
272
272
|
virtus (2.0.0)
|
273
273
|
axiom-types (~> 0.1)
|
274
274
|
coercible (~> 1.0)
|
275
275
|
descendants_tracker (~> 0.0, >= 0.0.3)
|
276
|
-
webrick (1.8.2)
|
277
276
|
websocket-driver (0.7.6)
|
278
277
|
websocket-extensions (>= 0.1.0)
|
279
278
|
websocket-extensions (0.1.5)
|
280
|
-
zeitwerk (2.
|
279
|
+
zeitwerk (2.7.1)
|
281
280
|
|
282
281
|
PLATFORMS
|
283
282
|
arm64-darwin-20
|
@@ -299,4 +298,4 @@ DEPENDENCIES
|
|
299
298
|
slim
|
300
299
|
|
301
300
|
BUNDLED WITH
|
302
|
-
2.5.
|
301
|
+
2.5.9
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import * as bootstrap from "bootstrap";
|
2
|
+
import { initializeComponents } from "./initialize_components";
|
2
3
|
window.bootstrap = bootstrap;
|
3
4
|
|
4
5
|
export function handleFetchModalClick() {
|
@@ -21,6 +22,7 @@ export function handleFetchModalClick() {
|
|
21
22
|
modalContainer.children().first()
|
22
23
|
);
|
23
24
|
actionModal.show();
|
25
|
+
initializeComponents();
|
24
26
|
},
|
25
27
|
error: function (error) {
|
26
28
|
console.error("Error:", error);
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import LocalTime from "./local-time"
|
2
|
+
import * as bootstrap from "bootstrap";
|
3
|
+
window.bootstrap = bootstrap;
|
4
|
+
|
5
|
+
|
6
|
+
export function initializeComponents() {
|
7
|
+
$(".select-2").select2({
|
8
|
+
theme: "bootstrap-5",
|
9
|
+
});
|
10
|
+
flatpickr("[data-behaviour='date-only']", {
|
11
|
+
dateFormat: "d-m-Y",
|
12
|
+
});
|
13
|
+
flatpickr("[data-behaviour='date-time']", {
|
14
|
+
enableTime: true,
|
15
|
+
});
|
16
|
+
flatpickr("[data-behaviour='filter'][data-filter-type='date']", {
|
17
|
+
mode: "range",
|
18
|
+
});
|
19
|
+
var el = document.getElementsByClassName("columns-list");
|
20
|
+
if (el[0]) {
|
21
|
+
Sortable.create(el[0], {
|
22
|
+
handle: ".dragger",
|
23
|
+
animation: 150,
|
24
|
+
});
|
25
|
+
}
|
26
|
+
|
27
|
+
var headerElemHeight = $(".page-top-bar").height() + 64;
|
28
|
+
var calculatedHeight = "calc(100vh - " + headerElemHeight + "px" + ")";
|
29
|
+
$(".table-wrapper").css("maxHeight", calculatedHeight);
|
30
|
+
LocalTime.start();
|
31
|
+
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
// This file is shared between rails 6 and 7 version
|
2
|
-
import
|
2
|
+
import { initializeComponents } from "./initialize_components";
|
3
|
+
|
3
4
|
|
4
5
|
$(document).on(
|
5
6
|
"keypress keyup blur",
|
@@ -41,11 +42,13 @@ $(document).on("mouseleave", ".row-action-cell", function () {
|
|
41
42
|
});
|
42
43
|
|
43
44
|
$(document).on("click", '[data-behaviour="offcanvas"]', function (e) {
|
45
|
+
e.preventDefault();
|
44
46
|
const drawerFetchUrl = $(this).attr("data-drawer-fetch-url");
|
45
47
|
const drawerContainer = $("[data-behaviour='cm-drawer-container']");
|
46
48
|
|
47
49
|
if (!drawerFetchUrl || !drawerContainer) return;
|
48
50
|
|
51
|
+
|
49
52
|
$.ajax({
|
50
53
|
url: drawerFetchUrl,
|
51
54
|
method: "GET",
|
@@ -64,7 +67,7 @@ $(document).on("click", '[data-behaviour="offcanvas"]', function (e) {
|
|
64
67
|
handleDrawerFormSubmission(drawerForm);
|
65
68
|
},
|
66
69
|
error: function (error) {
|
67
|
-
console.
|
70
|
+
console.log("Error:", error);
|
68
71
|
},
|
69
72
|
});
|
70
73
|
});
|
@@ -227,29 +230,4 @@ var replaceAccordionTitle = function (element) {
|
|
227
230
|
initializeComponents();
|
228
231
|
};
|
229
232
|
|
230
|
-
export function initializeComponents() {
|
231
|
-
$(".select-2").select2({
|
232
|
-
theme: "bootstrap-5",
|
233
|
-
});
|
234
|
-
flatpickr("[data-behaviour='date-only']", {
|
235
|
-
dateFormat: "d-m-Y",
|
236
|
-
});
|
237
|
-
flatpickr("[data-behaviour='date-time']", {
|
238
|
-
enableTime: true,
|
239
|
-
});
|
240
|
-
flatpickr("[data-behaviour='filter'][data-filter-type='date']", {
|
241
|
-
mode: "range",
|
242
|
-
});
|
243
|
-
var el = document.getElementsByClassName("columns-list");
|
244
|
-
if (el[0]) {
|
245
|
-
Sortable.create(el[0], {
|
246
|
-
handle: ".dragger",
|
247
|
-
animation: 150,
|
248
|
-
});
|
249
|
-
}
|
250
233
|
|
251
|
-
var headerElemHeight = $(".page-top-bar").height() + 64;
|
252
|
-
var calculatedHeight = "calc(100vh - " + headerElemHeight + "px" + ")";
|
253
|
-
$(".table-wrapper").css("maxHeight", calculatedHeight);
|
254
|
-
LocalTime.start();
|
255
|
-
}
|
@@ -12,19 +12,27 @@ module CmAdmin
|
|
12
12
|
@current_action = CmAdmin::Models::Action.find_by(@model, name: 'index')
|
13
13
|
# Based on the params the filter and pagination object to be set
|
14
14
|
authorize @ar_object, policy_class: "CmAdmin::#{controller_name.classify}Policy".constantize if defined? "CmAdmin::#{controller_name.classify}Policy".constantize
|
15
|
-
records = "CmAdmin::#{@model.name}
|
15
|
+
records = "CmAdmin::#{@model.name}PolicyIndexScope".constantize.new(Current.user, @model.name.constantize).resolve
|
16
16
|
records = records.includes(@current_action.eager_load_associations) if @current_action.eager_load_associations.present?
|
17
17
|
records = apply_scopes(records)
|
18
|
-
@ar_object = if
|
19
|
-
filter_by(params, records, filter_params: @model.filter_params(params))
|
20
|
-
elsif (request.xhr? && params[:view_type] == 'kanban') || @current_action.view_type == :kanban
|
18
|
+
@ar_object = if params[:view_type] == 'kanban' || @current_action.view_type == :kanban
|
21
19
|
kanban_filter_by(params, records, @model.filter_params(params))
|
22
20
|
else
|
23
21
|
filter_by(params, records, filter_params: @model.filter_params(params))
|
24
22
|
end
|
25
23
|
respond_to do |format|
|
26
|
-
if
|
27
|
-
|
24
|
+
if params[:view_type] == 'kanban' || @current_action.view_type == :kanban
|
25
|
+
if request.xhr?
|
26
|
+
format.json { render json: @ar_object }
|
27
|
+
else
|
28
|
+
format.html { render '/cm_admin/main/' + action_name }
|
29
|
+
end
|
30
|
+
elsif params[:view_type] == 'card' || @current_action.view_type == :card
|
31
|
+
if request.xhr?
|
32
|
+
format.html { render partial: "/cm_admin/#{@model.name.underscore}/card" }
|
33
|
+
else
|
34
|
+
format.html { render '/cm_admin/main/' + action_name }
|
35
|
+
end
|
28
36
|
elsif request.xhr?
|
29
37
|
format.html { render partial: '/cm_admin/main/table' }
|
30
38
|
else
|
@@ -35,7 +43,7 @@ module CmAdmin
|
|
35
43
|
|
36
44
|
def cm_show(params)
|
37
45
|
@current_action = CmAdmin::Models::Action.find_by(@model, name: 'show')
|
38
|
-
scoped_model = "CmAdmin::#{@model.name}
|
46
|
+
scoped_model = "CmAdmin::#{@model.name}PolicyShowScope".constantize.new(Current.user, @model.name.constantize).resolve
|
39
47
|
@ar_object = fetch_ar_object(scoped_model, params[:id])
|
40
48
|
@alerts = @model.alerts
|
41
49
|
resource_identifier
|
@@ -161,7 +169,7 @@ module CmAdmin
|
|
161
169
|
end
|
162
170
|
|
163
171
|
def cm_custom_method(params)
|
164
|
-
records = "CmAdmin::#{@model.name}Policy
|
172
|
+
records = "CmAdmin::#{@model.name}Policy#{@action.name.classify}Scope".constantize.new(Current.user, @model.name.constantize).resolve
|
165
173
|
@current_action = @action
|
166
174
|
if @action.parent == 'index'
|
167
175
|
records = apply_scopes(records)
|
@@ -204,7 +212,7 @@ module CmAdmin
|
|
204
212
|
end
|
205
213
|
|
206
214
|
def cm_custom_action_modal(params)
|
207
|
-
scoped_model = "CmAdmin::#{@model.name}Policy
|
215
|
+
scoped_model = "CmAdmin::#{@model.name}Policy#{params[:action_name].classify}Scope".constantize.new(Current.user, @model.name.constantize).resolve
|
208
216
|
@ar_object = fetch_ar_object(scoped_model, params[:id])
|
209
217
|
if params[:action_name] == 'destroy'
|
210
218
|
render partial: '/layouts/destroy_action_modal', locals: { ar_object: @ar_object, from_action: 'custom_action_modal' }
|
@@ -224,10 +232,18 @@ module CmAdmin
|
|
224
232
|
@model = Model.find_by({ name: controller_name.classify })
|
225
233
|
return if @model.blank?
|
226
234
|
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
235
|
+
if params[:action_name] == 'show'
|
236
|
+
@action = CmAdmin::Models::Action.find_by(@model, name: 'show')
|
237
|
+
scoped_model = "CmAdmin::#{@model.name}Policy::ShowScope".constantize.new(Current.user, @model.name.constantize).resolve
|
238
|
+
@ar_object = fetch_ar_object(scoped_model, params[:ar_object_id])
|
239
|
+
@alerts = @model.alerts
|
240
|
+
render partial: 'layouts/drawer_show'
|
241
|
+
else
|
242
|
+
action_page_title = CmAdmin::Models::Action.find_by(@model, name: 'new').page_title
|
243
|
+
drawer_title = action_page_title.presence || "New #{@model&.formatted_name}"
|
244
|
+
@ar_object = @model.ar_model.new
|
245
|
+
render partial: 'layouts/drawer_form', locals: { drawer_title:, from_field_id: params[:from_field_id] }
|
246
|
+
end
|
231
247
|
end
|
232
248
|
|
233
249
|
def get_nested_table_fields(fields)
|
@@ -302,7 +318,7 @@ module CmAdmin
|
|
302
318
|
@current_action = CmAdmin::Models::Action.find_by(@model, name: action_name.to_s)
|
303
319
|
return unless @current_action
|
304
320
|
|
305
|
-
scoped_model = "CmAdmin::#{@model.name}Policy
|
321
|
+
scoped_model = "CmAdmin::#{@model.name}Policy#{action_name.classify}Scope".constantize.new(Current.user, @model.ar_model.name.classify.constantize).resolve
|
306
322
|
@ar_object = fetch_ar_object(scoped_model, params[:id])
|
307
323
|
return @ar_object unless @current_action.child_records
|
308
324
|
|
@@ -341,7 +357,7 @@ module CmAdmin
|
|
341
357
|
cm_model.default_sort_column
|
342
358
|
end
|
343
359
|
sort_direction = params[:sort_direction] || cm_model.default_sort_direction
|
344
|
-
records = "CmAdmin::#{@model.name}Policy
|
360
|
+
records = "CmAdmin::#{@model.name}Policy#{@current_action.name.classify}Scope".constantize.new(Current.user, @model.name.constantize).resolve if records.nil?
|
345
361
|
records = records.order("#{sort_column} #{sort_direction}") if sort_column.present?
|
346
362
|
final_data = CmAdmin::Models::Filter.filtered_data(filter_params, records, cm_model.filters)
|
347
363
|
pagy, records = pagy(final_data)
|
@@ -21,7 +21,7 @@ module Exportable
|
|
21
21
|
current_action = CmAdmin::Models::Action.find_by(model, name: action_name)
|
22
22
|
|
23
23
|
if associated_klass_name.present? && params[:parent_id].present?
|
24
|
-
scoped_model = "CmAdmin::#{model.name}Policy
|
24
|
+
scoped_model = "CmAdmin::#{model.name}Policy#{action_name.classify}Scope".constantize.new(Current.user, klass).resolve
|
25
25
|
parent_model = model
|
26
26
|
model = CmAdmin::Model.find_by({ name: associated_klass_name })
|
27
27
|
parent_record = fetch_ar_object(scoped_model, params[:parent_id])
|
@@ -1,5 +1,5 @@
|
|
1
1
|
.kanban-container
|
2
|
-
- column_names = @
|
2
|
+
- column_names = @model.ar_model.send(params[:kanban_column_name]&.pluralize || @current_action.kanban_attr[:column_name].pluralize).keys
|
3
3
|
= hidden_field_tag :kanban_column_names, column_names
|
4
4
|
- column_names.each do |column_name|
|
5
5
|
.kanban-list class="#{column_name}"
|
@@ -11,7 +11,7 @@
|
|
11
11
|
|
12
12
|
.pagination-bar.kanban-pagination
|
13
13
|
.btn.btn-primary.kanban-show-more data-page=1 Show more
|
14
|
-
= render partial: 'cm_admin/main/show_as_drawer'
|
14
|
+
/ = render partial: 'cm_admin/main/show_as_drawer'
|
15
15
|
|
16
16
|
= export_modal(@model)
|
17
17
|
= manage_column_pop_up(@model)
|
@@ -1,5 +1,6 @@
|
|
1
1
|
.show-page__header.page-top-bar
|
2
|
-
==
|
2
|
+
- if defined?(via_xhr) && via_xhr == false
|
3
|
+
== render 'cm_admin/main/top_navbar'
|
3
4
|
== render 'cm_admin/main/tabs', via_xhr: defined?(via_xhr) ? via_xhr : false
|
4
5
|
.show-page__inner
|
5
6
|
- unless @alerts.empty?
|
@@ -43,6 +43,8 @@
|
|
43
43
|
td.text-ellipsis data-field-type="#{column.field_type || 'string'}"
|
44
44
|
- if index == 0 && is_show_action_available(@model, ar_object) && !([:link, :custom, :attachment, :drawer, :image].include?(column.field_type))
|
45
45
|
= link_to ar_object.send(column.field_name), cm_admin.send("cm_show_#{ar_object.model_name.singular}_path", ar_object)
|
46
|
+
/ - drawer_fetch_url = "#{CmAdmin::Engine.mount_path}/#{@model.name.tableize}/fetch_drawer?ar_object_id=#{ar_object.id}&action_name=show"
|
47
|
+
/ = link_to ar_object.send(column.field_name), '', data: { behaviour: "offcanvas", drawer_fetch_url: drawer_fetch_url, id: ar_object.id, action_name: 'show' }
|
46
48
|
- else
|
47
49
|
= show_field_value(ar_object, column)
|
48
50
|
- if column.field_type == :drawer
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
|
2
|
+
= hidden_field_tag :view_type, (params[:view_type] || @current_action.view_type)
|
3
|
+
.drawer-container data-behaviour="cm-drawer-container"
|
2
4
|
.cm-index-page.cm-page-container
|
3
5
|
.sticky-container.page-top-bar
|
4
6
|
== render 'cm_admin/main/top_navbar'
|
@@ -13,9 +15,13 @@
|
|
13
15
|
.cm-index-page__table-container
|
14
16
|
- if @action.partial
|
15
17
|
== render @action.partial
|
16
|
-
- elsif params[:view_type] == 'table' || @current_action.view_type == :table
|
17
|
-
== render 'cm_admin/main/table'
|
18
|
-
- elsif params[:view_type] == 'card' || @current_action.view_type == :card
|
19
|
-
== render "cm_admin/#{@model.name.underscore}/card"
|
20
18
|
- elsif params[:view_type] == 'kanban' || @current_action.view_type == :kanban
|
21
19
|
== render 'cm_admin/main/kanban'
|
20
|
+
- elsif params[:view_type] == 'card' || @current_action.view_type == :card
|
21
|
+
== render "cm_admin/#{@model.name.underscore}/card"
|
22
|
+
- elsif params[:view_type] == 'table' || @current_action.view_type == :table
|
23
|
+
== render 'cm_admin/main/table'
|
24
|
+
|
25
|
+
= column_pop_up(@model)
|
26
|
+
= manage_column_pop_up(@model)
|
27
|
+
|
@@ -1,2 +1,2 @@
|
|
1
1
|
.show-page
|
2
|
-
= render partial: 'cm_admin/main/show_content', via_xhr: false
|
2
|
+
= render partial: 'cm_admin/main/show_content', locals: { via_xhr: false }
|
@@ -0,0 +1,9 @@
|
|
1
|
+
.offcanvas.cm-drawer tabindex="-1" id="cm-drawer" aria-labelledby="offcanvasExampleLabel" data-behavior="cm-drawer" data-from-field-id="#{params[:from_field_id]}"
|
2
|
+
.drawer-btn-group
|
3
|
+
button.drawer-nav-btn type="button" data-bs-dismiss="offcanvas" aria-label="Close"
|
4
|
+
i.fa-solid.fa-x
|
5
|
+
.offcanvas-header
|
6
|
+
h4 = @action.page_title.present? ? @ar_object.send(@action.page_title) : ''
|
7
|
+
.offcanvas-body
|
8
|
+
.show-page
|
9
|
+
= render partial: 'cm_admin/main/show_content', via_xhr: true
|
@@ -69,5 +69,4 @@ html
|
|
69
69
|
div data-behaviour="flash-container"
|
70
70
|
= render 'layouts/cm_flash_message'
|
71
71
|
div data-behaviour="export-modal-container"
|
72
|
-
|
73
|
-
= render 'layouts/custom_action_modals'
|
72
|
+
= render 'layouts/custom_action_modals'
|
data/docs/RoleManagement.md
CHANGED
@@ -116,7 +116,7 @@ tab :details, '' do
|
|
116
116
|
row do
|
117
117
|
cm_show_section 'Details' do
|
118
118
|
field :status, field_type: :tag, tag_class: Item::STATUS_TAG_COLOR, display_if: -> (record) {
|
119
|
-
scoped_model = CmAdmin::
|
119
|
+
scoped_model = CmAdmin::ItemPolicyArchiveScope.new(Current.user, ::Item).resolve
|
120
120
|
return scoped_model.find_by(id: record.id).present?
|
121
121
|
}
|
122
122
|
end
|
data/lib/cm_admin/model.rb
CHANGED
@@ -64,6 +64,10 @@ module CmAdmin
|
|
64
64
|
def find_by(search_hash)
|
65
65
|
CmAdmin.config.cm_admin_models.find { |x| x.name == search_hash[:name] }
|
66
66
|
end
|
67
|
+
|
68
|
+
def delete_entity(entity_name)
|
69
|
+
CmAdmin.config.cm_admin_models.delete_if { |x| x.name == entity_name }
|
70
|
+
end
|
67
71
|
end
|
68
72
|
|
69
73
|
def custom_controller_action(action_name, params)
|
@@ -225,7 +229,7 @@ module CmAdmin
|
|
225
229
|
|
226
230
|
attr_reader :user, :scope
|
227
231
|
end
|
228
|
-
|
232
|
+
CmAdmin.const_set "#{ar_model.name}Policy#{action.name.classify}Scope", klass
|
229
233
|
policy.const_set "#{action.name.classify}Scope", klass
|
230
234
|
end
|
231
235
|
end
|
data/lib/cm_admin/version.rb
CHANGED
@@ -41,7 +41,7 @@ module CmAdmin
|
|
41
41
|
action_name = "#{custom_action.name}?".to_sym
|
42
42
|
return unless custom_action.name.present? && policy([:cm_admin, @model.name.classify.constantize]).respond_to?(action_name) && policy([:cm_admin, @model.name.classify.constantize]).send(action_name)
|
43
43
|
|
44
|
-
scoped_model = "CmAdmin::#{@model.name}Policy
|
44
|
+
scoped_model = "CmAdmin::#{@model.name}Policy#{custom_action.name.classify}Scope".constantize.new(Current.user, @model.name.constantize).resolve
|
45
45
|
has_scoped_record = if current_action_name == 'index'
|
46
46
|
scoped_model.present?
|
47
47
|
else
|
data/lib/cm_admin.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'zeitwerk'
|
1
2
|
require 'slim'
|
2
3
|
require 'cm_admin/version'
|
3
4
|
require 'cm_admin/engine'
|
@@ -6,7 +7,20 @@ require 'cm_admin/view_helpers'
|
|
6
7
|
require 'cm_admin/utils'
|
7
8
|
require 'cm_admin/configuration'
|
8
9
|
|
10
|
+
ActiveSupport.on_load(:active_record) do
|
11
|
+
module ActiveRecord
|
12
|
+
class Base
|
13
|
+
def self.cm_admin(&block)
|
14
|
+
CmAdmin.initialize_model(self, &block)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
9
20
|
module CmAdmin
|
21
|
+
# autoload :Model, 'cm_admin/model'
|
22
|
+
# autoload :ViewHelpers, 'cm_admin/view_helpers'
|
23
|
+
|
10
24
|
class Error < StandardError; end
|
11
25
|
|
12
26
|
mattr_accessor :layout, :authorized_roles
|
@@ -30,9 +44,9 @@ module CmAdmin
|
|
30
44
|
|
31
45
|
def initialize_model(entity, &block)
|
32
46
|
return unless entity.is_a?(Class)
|
33
|
-
|
47
|
+
CmAdmin::Model.delete_entity(entity.name) if CmAdmin::Model.find_by({ name: entity.name })
|
34
48
|
|
35
49
|
config.cm_admin_models << CmAdmin::Model.new(entity, &block)
|
36
50
|
end
|
37
51
|
end
|
38
|
-
end
|
52
|
+
end
|
data/upload.sh
ADDED
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
|
+
version: 4.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: exe
|
16
16
|
cert_chain: []
|
17
|
-
date: 2024-12-
|
17
|
+
date: 2024-12-24 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: caxlsx_rails
|
@@ -172,7 +172,6 @@ executables: []
|
|
172
172
|
extensions: []
|
173
173
|
extra_rdoc_files: []
|
174
174
|
files:
|
175
|
-
- ".gem/credentials"
|
176
175
|
- ".github/CODEOWNERS"
|
177
176
|
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
178
177
|
- ".github/ISSUE_TEMPLATE/config.yml"
|
@@ -214,6 +213,7 @@ files:
|
|
214
213
|
- app/assets/javascripts/cm_admin/exports.js
|
215
214
|
- app/assets/javascripts/cm_admin/filters.js
|
216
215
|
- app/assets/javascripts/cm_admin/form_validation.js
|
216
|
+
- app/assets/javascripts/cm_admin/initialize_components.js
|
217
217
|
- app/assets/javascripts/cm_admin/kanban.js
|
218
218
|
- app/assets/javascripts/cm_admin/local-time.js
|
219
219
|
- app/assets/javascripts/cm_admin/quick_search.js
|
@@ -411,7 +411,8 @@ files:
|
|
411
411
|
- app/views/layouts/_custom_action_modal.html.slim
|
412
412
|
- app/views/layouts/_custom_action_modals.html.slim
|
413
413
|
- app/views/layouts/_destroy_action_modal.html.slim
|
414
|
-
- app/views/layouts/
|
414
|
+
- app/views/layouts/_drawer_form.html.slim
|
415
|
+
- app/views/layouts/_drawer_show.html.slim
|
415
416
|
- app/views/layouts/_left_sidebar_nav.html.slim
|
416
417
|
- app/views/layouts/_quick_links.html.slim
|
417
418
|
- app/views/layouts/cm_admin.html.slim
|
@@ -422,7 +423,6 @@ files:
|
|
422
423
|
- bin/setup
|
423
424
|
- cm_admin.gemspec
|
424
425
|
- config/importmap.rb
|
425
|
-
- config/initializers/active_record_extension.rb
|
426
426
|
- config/routes.rb
|
427
427
|
- docs/AddingAlert.md
|
428
428
|
- docs/CustomFilterMethod.md
|
@@ -499,6 +499,7 @@ files:
|
|
499
499
|
- package-lock.json
|
500
500
|
- package.json
|
501
501
|
- postcss.config.js
|
502
|
+
- upload.sh
|
502
503
|
- yarn.lock
|
503
504
|
homepage: https://github.com/commutatus/cm-admin
|
504
505
|
licenses:
|
data/.gem/credentials
DELETED
File without changes
|