cm-admin 1.0.2 → 1.0.3
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/linters.yml +6 -2
- data/.gitignore +1 -1
- data/.stylelintrc.json +3 -0
- data/Gemfile.lock +18 -17
- data/app/assets/javascripts/cm_admin/scaffolds.js +5 -1
- data/app/assets/stylesheets/cm_admin/base/auth.scss +113 -0
- data/app/assets/stylesheets/cm_admin/base/common.scss +2 -2
- data/app/assets/stylesheets/cm_admin/base/form.scss +4 -0
- data/app/assets/stylesheets/cm_admin/base/table.scss +2 -1
- data/app/assets/stylesheets/cm_admin/cm_admin.css.scss +1 -0
- data/app/assets/stylesheets/cm_admin/helpers/_mixins.scss +1 -1
- data/app/assets/stylesheets/cm_admin/pages/history_page.scss +49 -0
- data/app/controllers/cm_admin/resource_controller.rb +23 -5
- data/app/views/cm_admin/main/_nested_fields.html.slim +1 -1
- data/app/views/cm_admin/main/_nested_table_form.html.slim +2 -2
- data/app/views/cm_admin/main/_tabs.html.slim +5 -1
- data/app/views/cm_admin/main/associated_show.html.slim +1 -1
- data/app/views/cm_admin/main/history.html.slim +17 -0
- data/app/views/cm_admin/main/new.html.slim +2 -5
- data/app/views/cm_admin/main/show.html.slim +1 -1
- data/app/views/layouts/_left_sidebar_nav.html.slim +15 -19
- data/config/routes.rb +9 -1
- data/lib/cm_admin/constants.rb +4 -0
- data/lib/cm_admin/model.rb +2 -2
- data/lib/cm_admin/models/action.rb +2 -1
- data/lib/cm_admin/models/dsl_method.rb +11 -15
- data/lib/cm_admin/models/section.rb +38 -0
- data/lib/cm_admin/version.rb +1 -1
- data/lib/cm_admin/view_helpers/form_helper.rb +55 -30
- data/lib/cm_admin/view_helpers/page_info_helper.rb +6 -0
- data/lib/generators/cm_admin/templates/application_policy.rb +4 -0
- data/package-lock.json +61 -61
- data/package.json +1 -1
- data/yarn.lock +6589 -6425
- metadata +6 -5
- data/.github/workflows/.stylelintrc.json +0 -3
- data/lib/cm_admin/models/cm_show_section.rb +0 -19
- data/tmp/cache/webpacker/last-compilation-digest-development +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f00ed8703bf0c8f35c6b9d5f403bc8db0804888e02b2036c23c0d610413cfc2
|
4
|
+
data.tar.gz: 18ff830bd0ca02cd53b31ca03c9012f575e2b90b098d80df02a05f1193f97023
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f2704eaff88ff0d98cdbae358d9cab8274b155f4ae522a31816316bfafac14771d695eb0ca9f8ea4e8eccb474953533ccccc58ddb39c1acf872143da16861f5
|
7
|
+
data.tar.gz: f380015428b39a3b6ea4666f23de193f192b8b88932b08d90048f18387de44712c8c9188f12f8d2931c775bebd4f3fa5d4b1b5b57cb27afd693080646558c20f
|
@@ -23,8 +23,12 @@ jobs:
|
|
23
23
|
uses: reviewdog/action-reek@v1
|
24
24
|
with:
|
25
25
|
reek_version: 6.1.1
|
26
|
-
-
|
27
|
-
|
26
|
+
- uses: actions/checkout@v3
|
27
|
+
- name: stylelint
|
28
|
+
uses: reviewdog/action-stylelint@v1
|
29
|
+
with:
|
30
|
+
reporter: github-pr-review # Change reporter.
|
31
|
+
stylelint_input: '**/*.scss'
|
28
32
|
- name: coffeelint
|
29
33
|
uses: reviewdog/action-coffeelint@v1
|
30
34
|
with:
|
data/.gitignore
CHANGED
data/.stylelintrc.json
ADDED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cm-admin (1.0.
|
4
|
+
cm-admin (1.0.3)
|
5
5
|
caxlsx_rails
|
6
6
|
cocoon (~> 1.2.15)
|
7
7
|
csv-importer (~> 0.8.2)
|
@@ -106,8 +106,8 @@ GEM
|
|
106
106
|
descendants_tracker (0.0.4)
|
107
107
|
thread_safe (~> 0.3, >= 0.3.1)
|
108
108
|
diff-lcs (1.4.4)
|
109
|
-
erubi (1.
|
110
|
-
globalid (1.
|
109
|
+
erubi (1.12.0)
|
110
|
+
globalid (1.1.0)
|
111
111
|
activesupport (>= 5.0)
|
112
112
|
htmlentities (4.3.4)
|
113
113
|
i18n (1.11.0)
|
@@ -118,10 +118,10 @@ GEM
|
|
118
118
|
railties (>= 6.0.0)
|
119
119
|
json (2.6.2)
|
120
120
|
local_time (2.1.0)
|
121
|
-
loofah (2.
|
121
|
+
loofah (2.20.0)
|
122
122
|
crass (~> 1.0.2)
|
123
123
|
nokogiri (>= 1.5.9)
|
124
|
-
mail (2.8.
|
124
|
+
mail (2.8.1)
|
125
125
|
mini_mime (>= 0.1.1)
|
126
126
|
net-imap
|
127
127
|
net-pop
|
@@ -130,7 +130,7 @@ GEM
|
|
130
130
|
method_source (1.0.0)
|
131
131
|
mini_mime (1.1.2)
|
132
132
|
minitest (5.16.2)
|
133
|
-
net-imap (0.3.
|
133
|
+
net-imap (0.3.4)
|
134
134
|
date
|
135
135
|
net-protocol
|
136
136
|
net-pop (0.1.2)
|
@@ -139,8 +139,8 @@ GEM
|
|
139
139
|
timeout
|
140
140
|
net-smtp (0.3.3)
|
141
141
|
net-protocol
|
142
|
-
nio4r (2.5.
|
143
|
-
nokogiri (1.
|
142
|
+
nio4r (2.5.9)
|
143
|
+
nokogiri (1.14.3-arm64-darwin)
|
144
144
|
racc (~> 1.4)
|
145
145
|
pagy (4.11.0)
|
146
146
|
parallel (1.22.1)
|
@@ -148,11 +148,11 @@ GEM
|
|
148
148
|
ast (~> 2.4.1)
|
149
149
|
pundit (2.2.0)
|
150
150
|
activesupport (>= 3.0.0)
|
151
|
-
racc (1.6.
|
152
|
-
rack (2.2.4)
|
153
|
-
rack-proxy (0.7.
|
151
|
+
racc (1.6.2)
|
152
|
+
rack (2.2.6.4)
|
153
|
+
rack-proxy (0.7.6)
|
154
154
|
rack
|
155
|
-
rack-test (2.0
|
155
|
+
rack-test (2.1.0)
|
156
156
|
rack (>= 1.3)
|
157
157
|
rails (7.0.3.1)
|
158
158
|
actioncable (= 7.0.3.1)
|
@@ -171,7 +171,7 @@ GEM
|
|
171
171
|
rails-dom-testing (2.0.3)
|
172
172
|
activesupport (>= 4.2.0)
|
173
173
|
nokogiri (>= 1.6)
|
174
|
-
rails-html-sanitizer (1.
|
174
|
+
rails-html-sanitizer (1.5.0)
|
175
175
|
loofah (~> 2.19, >= 2.19.1)
|
176
176
|
railties (7.0.3.1)
|
177
177
|
actionpack (= 7.0.3.1)
|
@@ -226,7 +226,7 @@ GEM
|
|
226
226
|
thor (1.2.1)
|
227
227
|
thread_safe (0.3.6)
|
228
228
|
tilt (2.0.10)
|
229
|
-
timeout (0.3.
|
229
|
+
timeout (0.3.2)
|
230
230
|
tzinfo (2.0.4)
|
231
231
|
concurrent-ruby (~> 1.0)
|
232
232
|
unicode-display_width (2.3.0)
|
@@ -234,7 +234,7 @@ GEM
|
|
234
234
|
axiom-types (~> 0.1)
|
235
235
|
coercible (~> 1.0)
|
236
236
|
descendants_tracker (~> 0.0, >= 0.0.3)
|
237
|
-
webpacker (5.4.
|
237
|
+
webpacker (5.4.4)
|
238
238
|
activesupport (>= 5.2)
|
239
239
|
rack-proxy (>= 0.6.1)
|
240
240
|
railties (>= 5.2)
|
@@ -242,10 +242,11 @@ GEM
|
|
242
242
|
websocket-driver (0.7.5)
|
243
243
|
websocket-extensions (>= 0.1.0)
|
244
244
|
websocket-extensions (0.1.5)
|
245
|
-
zeitwerk (2.6.
|
245
|
+
zeitwerk (2.6.7)
|
246
246
|
|
247
247
|
PLATFORMS
|
248
|
-
|
248
|
+
arm64-darwin-20
|
249
|
+
x86_64-linux
|
249
250
|
|
250
251
|
DEPENDENCIES
|
251
252
|
cm-admin!
|
@@ -71,3 +71,116 @@
|
|
71
71
|
}
|
72
72
|
}
|
73
73
|
}
|
74
|
+
|
75
|
+
.sidebar__footer {
|
76
|
+
position: absolute;
|
77
|
+
bottom: 0;
|
78
|
+
z-index: 100;
|
79
|
+
width: 100%;
|
80
|
+
padding: 16px 0;
|
81
|
+
box-shadow: inset 0px 1px 0px rgba(255, 255, 255, 0.15);
|
82
|
+
.menu-item {
|
83
|
+
@include font($size: $t4-text, $color: $ink-lightest-clr);
|
84
|
+
padding: 8px 24px;
|
85
|
+
@include transition-linear();
|
86
|
+
cursor: pointer;
|
87
|
+
&:hover {
|
88
|
+
color: $white;
|
89
|
+
background: rgba(255, 255, 255, 0.1);
|
90
|
+
}
|
91
|
+
}
|
92
|
+
.profile-name {
|
93
|
+
@include flex($align: center);
|
94
|
+
position: relative;
|
95
|
+
line-height: 22px;
|
96
|
+
@include font($size: $t4-text, $color: $ink-lightest-clr);
|
97
|
+
cursor: pointer;
|
98
|
+
.profile-avatar {
|
99
|
+
@include flex($justify: center, $align: center);
|
100
|
+
width: 22px;
|
101
|
+
height: 22px;
|
102
|
+
margin-right: 8px;
|
103
|
+
@include font($size: 10px, $color: $white, $weight: 900);
|
104
|
+
background-color: $brand-color;
|
105
|
+
vertical-align: middle;
|
106
|
+
border-radius: 50%;
|
107
|
+
img {
|
108
|
+
width: 22px;
|
109
|
+
border-radius: $circle;
|
110
|
+
}
|
111
|
+
}
|
112
|
+
}
|
113
|
+
.profile-popup {
|
114
|
+
position: absolute;
|
115
|
+
left: 228px;
|
116
|
+
bottom: 10px;
|
117
|
+
width: 268px;
|
118
|
+
min-height: 100px;
|
119
|
+
overflow: hidden;
|
120
|
+
background-color: $white;
|
121
|
+
box-shadow: 0px 4px 16px rgba(0, 0, 0, 0.16);
|
122
|
+
border-radius: $radius-4;
|
123
|
+
animation: fadeIn 0.2s linear;
|
124
|
+
.profile-info {
|
125
|
+
display: grid;
|
126
|
+
grid-template-columns: 1fr 32px;
|
127
|
+
grid-gap: 9px;
|
128
|
+
padding: 8px 16px;
|
129
|
+
box-shadow: inset 0px -1px 0px rgba(148, 151, 155, 0.15);
|
130
|
+
&__left {
|
131
|
+
.name-text {
|
132
|
+
@include font($size: $t4-text);
|
133
|
+
line-height: 22px;
|
134
|
+
margin: 0;
|
135
|
+
}
|
136
|
+
.email-text {
|
137
|
+
@include font($size: $t4-text, $color: $ink-lightest-clr);
|
138
|
+
line-height: 22px;
|
139
|
+
margin: 0;
|
140
|
+
width: 200px;
|
141
|
+
}
|
142
|
+
}
|
143
|
+
&__right {
|
144
|
+
@include flex($justify: center, $align: center);
|
145
|
+
width: 32px;
|
146
|
+
height: 32px;
|
147
|
+
@include font($color: $white, $weight: 600);
|
148
|
+
background-color: $brand-color;
|
149
|
+
vertical-align: middle;
|
150
|
+
border-radius: 50%;
|
151
|
+
img {
|
152
|
+
width: 32px;
|
153
|
+
border-radius: $circle;
|
154
|
+
}
|
155
|
+
}
|
156
|
+
}
|
157
|
+
.page-options {
|
158
|
+
padding: 8px 0;
|
159
|
+
box-shadow: inset 0px -1px 0px rgba(148, 151, 155, 0.15);
|
160
|
+
.page-link {
|
161
|
+
display: block;
|
162
|
+
@include font($size: $t4-text);
|
163
|
+
line-height: 22px;
|
164
|
+
padding: 4px 16px;
|
165
|
+
border: none;
|
166
|
+
@include transition-linear();
|
167
|
+
&:hover {
|
168
|
+
background-color: $grey-lighter-clr;
|
169
|
+
}
|
170
|
+
}
|
171
|
+
}
|
172
|
+
.auth-option {
|
173
|
+
padding: 8px 0;
|
174
|
+
.auth-link {
|
175
|
+
display: block;
|
176
|
+
@include font($size: $t4-text);
|
177
|
+
line-height: 22px;
|
178
|
+
padding: 4px 16px;
|
179
|
+
@include transition-linear();
|
180
|
+
&:hover {
|
181
|
+
background-color: $grey-lighter-clr;
|
182
|
+
}
|
183
|
+
}
|
184
|
+
}
|
185
|
+
}
|
186
|
+
}
|
@@ -149,6 +149,7 @@
|
|
149
149
|
background: $gradient-one;
|
150
150
|
display: none;
|
151
151
|
transition: all 0.1s linear;
|
152
|
+
z-index: 3;
|
152
153
|
.row-action-tool {
|
153
154
|
display: flex;
|
154
155
|
align-items: center;
|
@@ -175,7 +176,7 @@
|
|
175
176
|
position: sticky;
|
176
177
|
top: 0;
|
177
178
|
background-color: $white;
|
178
|
-
z-index:
|
179
|
+
z-index: 4;
|
179
180
|
}
|
180
181
|
}
|
181
182
|
|
@@ -11,6 +11,7 @@
|
|
11
11
|
* It is generally better to create a new file per style scope.
|
12
12
|
*
|
13
13
|
*= require 'cm_admin/pages/import_page'
|
14
|
+
*= require 'cm_admin/pages/history_page'
|
14
15
|
*= require 'cm_admin/base/table'
|
15
16
|
*= require 'cm_admin/base/navbar'
|
16
17
|
*= require 'cm_admin/base/sidebar'
|
@@ -0,0 +1,49 @@
|
|
1
|
+
@import "../helpers/index.scss";
|
2
|
+
|
3
|
+
// History page styles
|
4
|
+
.history-box {
|
5
|
+
width: 752px;
|
6
|
+
padding: 24px;
|
7
|
+
background: #ffffff;
|
8
|
+
border: 1px solid $grey-light-clr;
|
9
|
+
border-radius: 4px;
|
10
|
+
.history-item {
|
11
|
+
display: grid;
|
12
|
+
grid-template-columns: 32px 1fr;
|
13
|
+
grid-gap: 8px;
|
14
|
+
align-items: center;
|
15
|
+
margin-bottom: 32px;
|
16
|
+
&:nth-last-child(1) {
|
17
|
+
margin-bottom: 0;
|
18
|
+
}
|
19
|
+
.profile-pic {
|
20
|
+
img {
|
21
|
+
width: 32px;
|
22
|
+
height: 32px;
|
23
|
+
object-fit: cover;
|
24
|
+
border-radius: 50%;
|
25
|
+
}
|
26
|
+
}
|
27
|
+
.history-info {
|
28
|
+
display: inline-flex;
|
29
|
+
font-family: 'Open Sans', sans-serif;
|
30
|
+
font-size: 14px;
|
31
|
+
line-height: 22px;
|
32
|
+
.bold-text {
|
33
|
+
font-weight: 600;
|
34
|
+
color: #1d21d9;
|
35
|
+
margin-right: 4px;
|
36
|
+
}
|
37
|
+
.normal-text {
|
38
|
+
font-weight: 400;
|
39
|
+
color: #1d21d9;
|
40
|
+
margin-right: 4px;
|
41
|
+
}
|
42
|
+
.light-text {
|
43
|
+
font-weight: 400;
|
44
|
+
color: $ink-lighter-clr;
|
45
|
+
margin-right: 4px;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
@@ -8,7 +8,9 @@ module CmAdmin
|
|
8
8
|
def cm_index(params)
|
9
9
|
@current_action = CmAdmin::Models::Action.find_by(@model, name: 'index')
|
10
10
|
# Based on the params the filter and pagination object to be set
|
11
|
-
|
11
|
+
records = "CmAdmin::#{@model.name}Policy::Scope".constantize.new(Current.user, @model.name.constantize).resolve
|
12
|
+
records = apply_scopes(records)
|
13
|
+
@ar_object = filter_by(params, records, @model.filter_params(params))
|
12
14
|
# resource_identifier
|
13
15
|
respond_to do |format|
|
14
16
|
if request.xhr?
|
@@ -91,6 +93,14 @@ module CmAdmin
|
|
91
93
|
end
|
92
94
|
end
|
93
95
|
|
96
|
+
def cm_history(params)
|
97
|
+
@current_action = CmAdmin::Models::Action.find_by(@model, name: 'history')
|
98
|
+
resource_identifier
|
99
|
+
respond_to do |format|
|
100
|
+
format.html { render '/cm_admin/main/history' }
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
94
104
|
def cm_custom_method(params)
|
95
105
|
scoped_model = "CmAdmin::#{@model.name}Policy::Scope".constantize.new(Current.user, @model.name.constantize).resolve
|
96
106
|
resource_identifier
|
@@ -126,8 +136,8 @@ module CmAdmin
|
|
126
136
|
authorize controller_name.classify.constantize, policy_class: "CmAdmin::#{controller_name.classify}Policy".constantize if defined? "CmAdmin::#{controller_name.classify}Policy".constantize
|
127
137
|
aar_model = request.url.split('/')[-2].classify.constantize if params[:aar_id]
|
128
138
|
@associated_ar_object = aar_model.find(params[:aar_id]) if params[:aar_id]
|
129
|
-
nested_tables = @model.available_fields[:new].
|
130
|
-
nested_tables += @model.available_fields[:edit].
|
139
|
+
nested_tables = @model.available_fields[:new].map(&:nested_table_fields).map(&:keys).flatten
|
140
|
+
nested_tables += @model.available_fields[:edit].map(&:nested_table_fields).map(&:keys).flatten
|
131
141
|
@reflections = @model.ar_model.reflect_on_all_associations
|
132
142
|
nested_tables.each do |table_name|
|
133
143
|
reflection = @reflections.select {|x| x if x.name == table_name}.first
|
@@ -162,6 +172,7 @@ module CmAdmin
|
|
162
172
|
return @ar_object unless @current_action.child_records
|
163
173
|
|
164
174
|
child_records = @ar_object.send(@current_action.child_records)
|
175
|
+
child_records = apply_scopes(child_records)
|
165
176
|
@reflection = @model.ar_model.reflect_on_association(@current_action.child_records)
|
166
177
|
@associated_model = if @reflection.klass.column_names.include?('type')
|
167
178
|
CmAdmin::Model.find_by(name: @reflection.plural_name.classify)
|
@@ -176,6 +187,13 @@ module CmAdmin
|
|
176
187
|
return @ar_object, @associated_model, @associated_ar_object
|
177
188
|
end
|
178
189
|
|
190
|
+
def apply_scopes(records)
|
191
|
+
@current_action.scopes.each do |scope|
|
192
|
+
records = records.send(scope)
|
193
|
+
end
|
194
|
+
records
|
195
|
+
end
|
196
|
+
|
179
197
|
def filter_by(params, records, filter_params={}, sort_params={})
|
180
198
|
filtered_result = OpenStruct.new
|
181
199
|
cm_model = @associated_model || @model
|
@@ -211,8 +229,8 @@ module CmAdmin
|
|
211
229
|
Hash[x.name.to_s.gsub('_attachment', ''), []]
|
212
230
|
end
|
213
231
|
}.compact
|
214
|
-
nested_tables = @model.available_fields[:new].
|
215
|
-
nested_tables += @model.available_fields[:edit].
|
232
|
+
nested_tables = @model.available_fields[:new].map(&:nested_table_fields).map(&:keys).flatten
|
233
|
+
nested_tables += @model.available_fields[:edit].map(&:nested_table_fields).map(&:keys).flatten
|
216
234
|
nested_fields = nested_tables.uniq.map {|table|
|
217
235
|
Hash[
|
218
236
|
table.to_s + '_attributes',
|
@@ -3,7 +3,7 @@
|
|
3
3
|
.accordion.nested-form-accordion
|
4
4
|
= f.fields_for table_name do |record|
|
5
5
|
- if record.object.persisted?
|
6
|
-
= render partial: '/cm_admin/main/nested_fields', locals: { f: record, assoc_name: table_name }
|
6
|
+
= render partial: '/cm_admin/main/nested_fields', locals: { f: record, assoc_name: table_name, section: section }
|
7
7
|
- if @reflections.select {|x| x if x.name == table_name}.first.macro == :has_many
|
8
8
|
.links
|
9
|
-
= link_to_add_association "+ Add #{table_name.to_s.titleize}", f, table_name, partial: '/cm_admin/main/nested_fields', render_options: {locals: { assoc_name: table_name }}, class: 'd-inline-block secondary-btn mt-2'
|
9
|
+
= link_to_add_association "+ Add #{table_name.to_s.titleize}", f, table_name, partial: '/cm_admin/main/nested_fields', render_options: {locals: { assoc_name: table_name, section: section }}, class: 'd-inline-block secondary-btn mt-2'
|
@@ -4,4 +4,8 @@ ul.nav.nav-pills
|
|
4
4
|
- if nav_item.custom_action.empty? || (nav_item.custom_action.present? && policy([:cm_admin, @model.name.classify.constantize]).send(:"#{nav_item.custom_action}?"))
|
5
5
|
li.nav-item
|
6
6
|
- nav_item_action_name = nav_item.custom_action.present? ? nav_item.custom_action : 'show'
|
7
|
-
= link_to tab_display_name(nav_item.nav_item_name), cm_admin.send("#{@ar_object.model_name.singular}_#{nav_item_action_name}_path", @ar_object.id), class: "nav-link #{ nav_item_action_name == action_name ? 'active' : ''}"
|
7
|
+
= link_to tab_display_name(nav_item.nav_item_name), cm_admin.send("#{@ar_object.model_name.singular}_#{nav_item_action_name}_path", @ar_object.id), class: "nav-link #{ nav_item_action_name == action_name ? 'active' : ''}"
|
8
|
+
// current_action_name is defined when action trail is added to that model
|
9
|
+
- if defined?(@ar_object.current_action_name)
|
10
|
+
li.nav-item
|
11
|
+
= link_to 'History', cm_admin.send("#{@ar_object.model_name.singular}_history_path", @ar_object.id), class: "nav-link #{ action_name == 'history' ? 'active' : ''}"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
.show-page.cm-page-container
|
2
|
+
.show-page__tabs.sticky-container.page-top-bar
|
3
|
+
.cm-tabs-bar
|
4
|
+
== render 'cm_admin/main/top_navbar'
|
5
|
+
== render 'cm_admin/main/tabs'
|
6
|
+
.show-page__inner.scrollable
|
7
|
+
.history-box
|
8
|
+
- @ar_object.action_trails.each do |at|
|
9
|
+
.history-item
|
10
|
+
.profile-pic
|
11
|
+
img alt=("profile") src="https://www.pngitem.com/pimgs/m/264-2647677_avatar-icon-human-user-avatar-svg-hd-png.png"
|
12
|
+
.history-info
|
13
|
+
span.bold-text = at.actor.first_name
|
14
|
+
span.normal-text = at.trail_type.titleize
|
15
|
+
span.normal-text the
|
16
|
+
span.bold-text = at.entity_type
|
17
|
+
span.light-text = at.created_at.strftime("%B")
|
@@ -15,8 +15,5 @@
|
|
15
15
|
ul
|
16
16
|
- @ar_object.errors.full_messages.each do |error_message|
|
17
17
|
li = error_message
|
18
|
-
|
19
|
-
|
20
|
-
| Section heading
|
21
|
-
.form-container__inner
|
22
|
-
= generate_form(@ar_object.class.name.constantize.new, @model)
|
18
|
+
|
19
|
+
= generate_form(@ar_object.class.name.constantize.new, @model)
|
@@ -12,23 +12,19 @@
|
|
12
12
|
|
13
13
|
.sidebar-menu__tabs-wrapper
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
.profile-
|
22
|
-
.profile-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
| Settings
|
31
|
-
.auth-option
|
32
|
-
= link_to '/sign-out', method: :delete, class: 'auth-link'
|
33
|
-
| Logout
|
15
|
+
- if defined?(user_full_name)
|
16
|
+
.sidebar__footer
|
17
|
+
.menu-item
|
18
|
+
.profile-name
|
19
|
+
span.profile-avatar J
|
20
|
+
| #{user_full_name}
|
21
|
+
.profile-popup.hidden
|
22
|
+
.profile-info
|
23
|
+
.profile-info__left
|
24
|
+
p.name-text = user_full_name
|
25
|
+
p.email-text = current_user.email
|
26
|
+
.profile-info__right
|
27
|
+
.auth-option
|
28
|
+
= link_to destroy_user_session_path, method: :delete, class: 'auth-link', data: { turbo_method: :delete }
|
29
|
+
| Logout
|
34
30
|
= render 'layouts/quick_links'
|
data/config/routes.rb
CHANGED
@@ -16,9 +16,17 @@ CmAdmin::Engine.routes.draw do
|
|
16
16
|
send(:post, 'import', to: "#{model.name.underscore}#import", as: "#{model.name.underscore}_import")
|
17
17
|
end
|
18
18
|
end
|
19
|
+
|
19
20
|
model.available_actions.sort_by {|act| act.name}.each do |act|
|
20
21
|
scope model.name.tableize do
|
21
|
-
|
22
|
+
# Define route only when action trail related field is present
|
23
|
+
if act.name == 'history'
|
24
|
+
if defined?(model.ar_model.new.current_action_name)
|
25
|
+
send(:get, ':id/history', to: "#{model.name.underscore}#history", as: "#{model.name.underscore}_history")
|
26
|
+
end
|
27
|
+
else
|
28
|
+
send(act.verb, act.path.present? ? act.path : act.name, to: "#{model.name.underscore}##{act.name}", as: "#{model.name.underscore}_#{act.name}")
|
29
|
+
end
|
22
30
|
end
|
23
31
|
end
|
24
32
|
end
|
data/lib/cm_admin/constants.rb
CHANGED
data/lib/cm_admin/model.rb
CHANGED
@@ -8,7 +8,7 @@ require_relative 'models/blocks'
|
|
8
8
|
require_relative 'models/column'
|
9
9
|
require_relative 'models/filter'
|
10
10
|
require_relative 'models/export'
|
11
|
-
require_relative 'models/
|
11
|
+
require_relative 'models/section'
|
12
12
|
require_relative 'models/tab'
|
13
13
|
require_relative 'models/dsl_method'
|
14
14
|
require 'pagy'
|
@@ -36,7 +36,7 @@ module CmAdmin
|
|
36
36
|
@additional_permitted_fields ||= []
|
37
37
|
@current_action = nil
|
38
38
|
@available_tabs ||= []
|
39
|
-
@available_fields ||= {index: [], show: [], edit:
|
39
|
+
@available_fields ||= {index: [], show: [], edit: [], new: []}
|
40
40
|
@params = nil
|
41
41
|
@filters ||= []
|
42
42
|
instance_eval(&block) if block_given?
|
@@ -6,7 +6,7 @@ module CmAdmin
|
|
6
6
|
include Actions::Blocks
|
7
7
|
attr_accessor :name, :display_name, :verb, :layout_type, :layout, :partial, :path, :page_title, :page_description,
|
8
8
|
:child_records, :is_nested_field, :nested_table_name, :parent, :display_if, :route_type, :code_block,
|
9
|
-
:display_type, :action_type, :redirection_url, :sort_direction, :sort_column, :icon_name
|
9
|
+
:display_type, :action_type, :redirection_url, :sort_direction, :sort_column, :icon_name, :scopes
|
10
10
|
|
11
11
|
VALID_SORT_DIRECTION = Set[:asc, :desc].freeze
|
12
12
|
|
@@ -34,6 +34,7 @@ module CmAdmin
|
|
34
34
|
self.action_type = :default
|
35
35
|
self.sort_column = :created_at
|
36
36
|
self.sort_direction = :desc
|
37
|
+
self.scopes ||= []
|
37
38
|
self.icon_name = 'fa fa-th-large'
|
38
39
|
end
|
39
40
|
|