cm-admin 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +12 -0
  3. data/.rspec +3 -0
  4. data/.travis.yml +6 -0
  5. data/Gemfile +6 -1
  6. data/Gemfile.lock +118 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +6 -40
  9. data/app/assets/images/logo.png +0 -0
  10. data/{lib/generators/cm_admin/templates/assets/stylesheets → app/assets/stylesheets/cm_admin}/base/auth.scss +16 -6
  11. data/app/assets/stylesheets/cm_admin/base/common.scss +237 -0
  12. data/app/assets/stylesheets/cm_admin/base/filters.scss +199 -0
  13. data/app/assets/stylesheets/cm_admin/base/form.scss +262 -0
  14. data/app/assets/stylesheets/cm_admin/base/main-nav.scss +47 -0
  15. data/app/assets/stylesheets/cm_admin/base/navbar.scss +67 -0
  16. data/app/assets/stylesheets/cm_admin/base/quicksearch.scss +69 -0
  17. data/app/assets/stylesheets/cm_admin/base/scaffold.scss +61 -0
  18. data/app/assets/stylesheets/cm_admin/base/show.scss +54 -0
  19. data/app/assets/stylesheets/cm_admin/base/sidebar.scss +225 -0
  20. data/app/assets/stylesheets/cm_admin/base/table.scss +303 -0
  21. data/app/assets/stylesheets/cm_admin/base/tabs.scss +26 -0
  22. data/app/assets/stylesheets/cm_admin/cm_admin.css.scss +26 -0
  23. data/app/assets/stylesheets/cm_admin/components/_alerts.scss +101 -0
  24. data/app/assets/stylesheets/cm_admin/components/_buttons.scss +135 -0
  25. data/app/assets/stylesheets/cm_admin/components/_dropdown-popup.scss +141 -0
  26. data/app/assets/stylesheets/cm_admin/components/_input.scss +274 -0
  27. data/app/assets/stylesheets/cm_admin/components/_modal.scss +34 -0
  28. data/app/assets/stylesheets/cm_admin/components/_range.scss +20 -0
  29. data/app/assets/stylesheets/cm_admin/components/_status-tag.scss +67 -0
  30. data/app/assets/stylesheets/cm_admin/components/index.scss +7 -0
  31. data/app/assets/stylesheets/cm_admin/dependency/bootstrap.min.css +7 -0
  32. data/app/assets/stylesheets/cm_admin/helpers/_mixins.scss +20 -0
  33. data/app/assets/stylesheets/cm_admin/helpers/_variable.scss +86 -0
  34. data/app/assets/stylesheets/cm_admin/helpers/index.scss +2 -0
  35. data/app/controllers/cm_admin/application_controller.rb +6 -0
  36. data/app/controllers/cm_admin/exports_controller.rb +16 -0
  37. data/app/controllers/cm_admin/main_controller.rb +8 -0
  38. data/app/helpers/cm_admin/application_helper.rb +11 -0
  39. data/app/javascript/packs/cm_admin/application.js +9 -0
  40. data/app/javascript/packs/cm_admin/filters.js +32 -0
  41. data/app/javascript/packs/cm_admin/scaffolds.js +14 -0
  42. data/app/views/cm_admin/main/_cm_pagy_nav.html.slim +23 -0
  43. data/app/views/cm_admin/main/_filters.html.slim +10 -0
  44. data/app/views/cm_admin/main/_table.html.slim +59 -0
  45. data/app/views/cm_admin/main/_top_navbar.html.slim +25 -0
  46. data/app/views/cm_admin/main/dashboard.html.slim +1 -0
  47. data/app/views/cm_admin/main/edit.html.slim +19 -0
  48. data/app/views/cm_admin/main/index.html.slim +9 -0
  49. data/app/views/cm_admin/main/new.html.slim +22 -0
  50. data/app/views/cm_admin/main/show.html.slim +13 -0
  51. data/app/views/layouts/_left_sidebar_nav.html.slim +30 -0
  52. data/app/views/layouts/cm_admin.html.slim +18 -0
  53. data/bin/console +1 -0
  54. data/bin/webpack +18 -0
  55. data/bin/webpack-dev-server +18 -0
  56. data/cm_admin.gemspec +20 -31
  57. data/{lib → config}/.DS_Store +0 -0
  58. data/config/initializers/active_record_extension.rb +9 -0
  59. data/config/routes.rb +18 -0
  60. data/config/webpack/development.js +5 -0
  61. data/config/webpack/environment.js +12 -0
  62. data/config/webpack/production.js +5 -0
  63. data/config/webpack/test.js +5 -0
  64. data/config/webpacker.yml +92 -0
  65. data/lib/c.png +0 -0
  66. data/lib/cm_admin.rb +31 -2
  67. data/lib/cm_admin/constants.rb +33 -0
  68. data/lib/cm_admin/engine.rb +38 -0
  69. data/lib/cm_admin/model.rb +262 -0
  70. data/lib/cm_admin/models/action.rb +22 -0
  71. data/lib/cm_admin/models/actions/blocks.rb +25 -0
  72. data/lib/cm_admin/models/blocks.rb +19 -0
  73. data/lib/cm_admin/models/column.rb +16 -0
  74. data/lib/cm_admin/models/export.rb +43 -0
  75. data/lib/cm_admin/models/field.rb +14 -0
  76. data/lib/cm_admin/models/filter.rb +30 -0
  77. data/lib/cm_admin/utils.rb +67 -0
  78. data/lib/cm_admin/version.rb +1 -1
  79. data/lib/cm_admin/view_helpers.rb +72 -0
  80. data/lib/cm_admin/view_helpers/field_column_helper.rb +23 -0
  81. data/lib/cm_admin/view_helpers/form_field_helper.rb +16 -0
  82. data/lib/cm_admin/view_helpers/form_helper.rb +55 -0
  83. data/lib/cm_admin/view_helpers/navigation_helper.rb +18 -0
  84. data/lib/cm_admin/view_helpers/page_info_helper.rb +21 -0
  85. data/lib/generators/cm_admin/install_generator.rb +10 -32
  86. data/lib/generators/cm_admin/templates/cm_admin_initializer.rb +4 -0
  87. data/lib/tasks/webpack_install.rake +63 -0
  88. data/package.json +18 -0
  89. data/postcss.config.js +12 -0
  90. data/yarn-error.log +44 -0
  91. data/yarn.lock +6903 -0
  92. metadata +123 -48
  93. data/CODE_OF_CONDUCT.md +0 -74
  94. data/lib/generators/cm_admin/USAGE +0 -8
  95. data/lib/generators/cm_admin/templates/assets/images/cm.png +0 -0
  96. data/lib/generators/cm_admin/templates/assets/stylesheets/application.css.scss +0 -33
  97. data/lib/generators/cm_admin/templates/assets/stylesheets/base/_variable.scss +0 -14
  98. data/lib/generators/cm_admin/templates/assets/stylesheets/base/form.scss +0 -125
  99. data/lib/generators/cm_admin/templates/assets/stylesheets/base/input-styles.scss +0 -72
  100. data/lib/generators/cm_admin/templates/assets/stylesheets/base/main-nav.scss +0 -79
  101. data/lib/generators/cm_admin/templates/assets/stylesheets/base/scaffold.scss +0 -95
  102. data/lib/generators/cm_admin/templates/assets/stylesheets/base/show.scss +0 -88
  103. data/lib/generators/cm_admin/templates/assets/stylesheets/base/sidebar.scss +0 -69
  104. data/lib/generators/cm_admin/templates/assets/stylesheets/base/table.scss +0 -246
  105. data/lib/generators/cm_admin/templates/layouts/_navbar.html.slim +0 -8
  106. data/lib/generators/cm_admin/templates/layouts/_side_navbar.html.slim +0 -12
  107. data/lib/generators/cm_admin/templates/layouts/application.html.slim +0 -20
  108. data/lib/generators/cm_admin/templates/layouts/initializer.rb +0 -2
  109. data/lib/generators/cm_admin/templates/views/_form.erb +0 -67
  110. data/lib/generators/cm_admin/templates/views/_table.erb +0 -22
  111. data/lib/generators/cm_admin/templates/views/edit.erb +0 -10
  112. data/lib/generators/cm_admin/templates/views/index.erb +0 -11
  113. data/lib/generators/cm_admin/templates/views/new.erb +0 -10
  114. data/lib/generators/cm_admin/templates/views/reset_password.erb +0 -12
  115. data/lib/generators/cm_admin/templates/views/show.erb +0 -18
  116. data/lib/generators/cm_admin/templates/views/sign_in.erb +0 -18
  117. data/lib/generators/cm_admin/view_generator.rb +0 -78
@@ -0,0 +1,303 @@
1
+ @import "../helpers/index.scss";
2
+
3
+ .index-page {
4
+ margin-top: 204px;
5
+ background-color: $white;
6
+
7
+ &__filters {
8
+ // If you want to overwrite filters styles ---> add styles here
9
+ }
10
+
11
+ &__table-container {
12
+ margin-top: 174px; //This should be height of the filters + navbar height
13
+ padding: 20px;
14
+ }
15
+
16
+ .admin-table {
17
+ background-color: $white;
18
+ border-radius: $radius-5;
19
+ .record-found {
20
+ padding: 10px;
21
+ color: #31383d;
22
+ font-size: 14px;
23
+ opacity: 0.5;
24
+ }
25
+ .cm-table {
26
+ width: 100%;
27
+ &__header {
28
+ tr > th {
29
+ width: 20%;
30
+ color: #172b4d;
31
+ background-color: #fafbfc;
32
+ box-shadow: inset 0 1px 0 0 #ebecf0;
33
+ font-weight: 600;
34
+ font-size: 14px;
35
+ border-bottom: none;
36
+ height: 40px;
37
+ padding: 0 10px;
38
+ }
39
+ }
40
+
41
+ &__body {
42
+ tr {
43
+ transition: all 0.2s linear;
44
+ &:hover {
45
+ background-color: #dfe4e7;
46
+ }
47
+ }
48
+
49
+ tr > td {
50
+ color: #172b4d;
51
+ font-size: 14px;
52
+ padding: 8px 10px;
53
+ }
54
+ .edit-icon {
55
+ font-size: 20px;
56
+ cursor: pointer;
57
+ @include transition-linear;
58
+ &:hover {
59
+ box-shadow: 0px 37px 20px -20px rgba(0, 0, 0, 0.2);
60
+ transform: scale(1.2);
61
+ }
62
+ }
63
+ }
64
+ }
65
+ }
66
+
67
+ .new-admin-table {
68
+ overflow: auto;
69
+ .cm-table {
70
+ table-layout: fixed;
71
+ position: relative;
72
+ min-width: fit-content;
73
+ border-collapse: collapse;
74
+ white-space: nowrap;
75
+ border: 1px solid $grey-lighter-clr;
76
+ border-radius: $radius-8;
77
+ &__header {
78
+ .header-row {
79
+ display: block;
80
+ position: relative;
81
+ width: 100%;
82
+ box-shadow: inset 0px -1px 0px rgba(148, 151, 155, 0.15);
83
+ th {
84
+ @include font($size: $t6-text, $color: $ink-lighter-clr, $weight: bold);
85
+ text-transform: uppercase;
86
+ min-width: 200px;
87
+ max-width: 200px;
88
+ padding: 12px 16px 12px 16px;
89
+ }
90
+ .check-box-space {
91
+ min-width: fit-content;
92
+ max-width: fit-content;
93
+ padding: 12px 8px 12px 16px;
94
+ span {
95
+ vertical-align: text-top;
96
+ }
97
+ }
98
+ }
99
+ }
100
+ &__body {
101
+ display: block;
102
+ overflow: auto;
103
+ overflow-x: hidden;
104
+ position: relative;
105
+ width: 100%;
106
+ height: 335px;
107
+ .body-row {
108
+ box-shadow: inset 0px -1px 0px rgba(148, 151, 155, 0.15);
109
+ transition: all .2s linear;
110
+ &:nth-last-child(1) {
111
+ box-shadow: none;
112
+ }
113
+ &:hover {
114
+ background-color: $grey-lighter-clr;
115
+ .row-action-cell {
116
+ opacity: 1;
117
+ }
118
+ }
119
+ .check-box-space {
120
+ min-width: fit-content;
121
+ max-width: fit-content;
122
+ padding: 16px 8px 16px 16px;
123
+ span {
124
+ vertical-align: text-top;
125
+ }
126
+ }
127
+ td {
128
+ @include font($size: $t4-text, $color: $primary-text-clr);
129
+ min-width: 200px;
130
+ max-width: 200px;
131
+ padding: 16px;
132
+ }
133
+ .row-action-cell {
134
+ position: absolute;
135
+ // left: 1225px;
136
+ right: 0;
137
+ width: 88px;
138
+ max-width: inherit;
139
+ min-width: inherit;
140
+ height: 56px;
141
+ padding: 0;
142
+ background: linear-gradient(270deg, #F3F4F6 81.75%, rgba(243, 244, 246, 0) 100%);
143
+ opacity: 0;
144
+ transition: all .1s linear;
145
+ .row-action-tool {
146
+ display: flex;
147
+ align-items: center;
148
+ justify-content: center;
149
+ height: 100%;
150
+ .tool-btn {
151
+ background-color: transparent;
152
+ border: none;
153
+ }
154
+ }
155
+ }
156
+ }
157
+ }
158
+ }
159
+ }
160
+
161
+ .admin-table-index {
162
+ .table-sticky-top {
163
+ position: sticky;
164
+ top: 254px;
165
+ }
166
+ .table-top {
167
+ display: flex;
168
+ justify-content: space-between;
169
+ align-items: center;
170
+ padding-bottom: 16px;
171
+ &__total-count {
172
+ font-size: $t4-text;
173
+ line-height: 22px;
174
+ color: $ink-lighter-clr;
175
+ margin: 0;
176
+ }
177
+ &__column-action {
178
+ .column-btn {
179
+ padding: 4px 8px;
180
+ span:nth-child(2) {
181
+ margin: 0 0 0 4px;
182
+ }
183
+ }
184
+ }
185
+ }
186
+ }
187
+
188
+ // table-column-modal
189
+ .table-column-modal {
190
+
191
+ //modal overwritten styles
192
+ .modal-dialog {
193
+ .modal-content {
194
+ .modal-header {
195
+ position: relative;
196
+ padding: 24px 32px 18px;
197
+ border: none;
198
+ box-shadow: inset 0px -1px 0px rgba(148, 151, 155, 0.15);
199
+ .modal-title {
200
+ @include font($size: 24px, $color: $primary-text-clr, $weight: 600);
201
+ line-height: 32px;
202
+ }
203
+ .close {
204
+ position: absolute;
205
+ top: 4px;
206
+ right: 8px;
207
+ padding: 4px;
208
+ margin: 0;
209
+ }
210
+ }
211
+ .modal-body {
212
+ padding: 0;
213
+ }
214
+ .modal-footer {
215
+ padding: 16px 32px;
216
+ border: none;
217
+ box-shadow: inset 0px 1px 0px rgba(148, 151, 155, 0.15);
218
+ }
219
+ }
220
+ }
221
+
222
+ .columns-list {
223
+ .column-item {
224
+ position: relative;
225
+ display: flex;
226
+ align-items: center;
227
+ justify-content: space-between;
228
+ padding: 8px 24px;
229
+ box-shadow: inset 0px -1px 0px rgba(148, 151, 155, 0.15);
230
+ &:hover {
231
+ .dragger {
232
+ display: block;
233
+ }
234
+ }
235
+ &__name {
236
+ font-size: $t4-text;
237
+ line-height: 22px;
238
+ margin-left: 4px;
239
+ color: $primary-text-clr;
240
+ p {
241
+ margin: 0;
242
+ }
243
+ }
244
+ &__action {
245
+ padding: 5px 8px;
246
+ font-size: $t4-text;
247
+ color: $ink-lightest-clr;
248
+ }
249
+ .dragger {
250
+ display: none;
251
+ position: absolute;
252
+ left: 4px;
253
+ top: 8px;
254
+ padding: 5px;
255
+ color: $ink-lightest-clr;
256
+ border-radius: $radius-4;
257
+ animation: fadeIn .1s ease-in-out;
258
+ cursor: grab;
259
+ &:hover {
260
+ background: $grey-lighter-clr;
261
+ }
262
+ }
263
+ }
264
+ }
265
+ }
266
+
267
+ .cm-pagination {
268
+ display: flex;
269
+ justify-content: space-between;
270
+ align-items: center;
271
+ padding: 16px 24px;
272
+ border: 1px solid $grey-lighter-clr;
273
+ &__lhs {
274
+ @include font($size: $t4-text, $color: $ink-lightest-clr, $weight: bold);
275
+ line-height: 22px;
276
+ }
277
+ &__rhs {
278
+ display: inline-flex;
279
+ align-items: center;
280
+ .page-move-btn {
281
+ font-size: 10px;
282
+ line-height: 12px;
283
+ color: $primary-text-clr;
284
+ padding: 10px 11px;
285
+ cursor: pointer;
286
+ &.disabled {
287
+ color: #9CA7AE;
288
+ }
289
+ }
290
+ .page-num-btn {
291
+ @include font($size: $t4-text, $color: $primary-text-clr, $weight: bold);
292
+ margin: 0 8px;
293
+ padding: 5px 11px;
294
+ cursor: pointer;
295
+ &.active {
296
+ background-color: $grey-lightest-clr;
297
+ border: 1px solid $grey-light-clr;
298
+ border-radius: $radius-4;
299
+ }
300
+ }
301
+ }
302
+ }
303
+ }
@@ -0,0 +1,26 @@
1
+ @import "../helpers/index.scss";
2
+
3
+ .cm-tabs-bar {
4
+ position: fixed;
5
+ top: 140px;
6
+ display: flex;
7
+ align-items: center;
8
+ width: 100%;
9
+ height: 54px;
10
+ padding: 0 24px;
11
+ background-color: $white;
12
+ box-shadow: inset 0px -1px 0px rgba(148, 151, 155, 0.15);
13
+ z-index: 1;
14
+
15
+ .tab-item {
16
+ font-size: 14px;
17
+ color: $ink-lighter-clr;
18
+ padding: 16px 0;
19
+ margin-right: 24px;
20
+ cursor: pointer;
21
+ &.active {
22
+ color: $brand-color;
23
+ box-shadow: inset 0px -2px 0px $brand-color;
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,26 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
6
+ * vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require 'cm_admin/base/table'
14
+ *= require 'cm_admin/base/navbar'
15
+ *= require 'cm_admin/base/sidebar'
16
+ *= require 'cm_admin/base/show'
17
+ *= require 'cm_admin/base/form'
18
+ *= require 'cm_admin/base/quicksearch'
19
+ *= require 'cm_admin/base/scaffold'
20
+ *= require 'cm_admin/base/auth'
21
+ *= require 'cm_admin/base/filters'
22
+ *= require 'cm_admin/base/common'
23
+ *= require 'cm_admin/components/index'
24
+ *= require 'cm_admin/dependency/bootstrap.min'
25
+ *= require_self
26
+ */
@@ -0,0 +1,101 @@
1
+ @import "../helpers/index.scss";
2
+
3
+ .flag-alert {
4
+ max-width: 752px;
5
+ padding: 24px;
6
+ background: $red-lightest-clr;
7
+ border-radius: $radius-4;
8
+ .alert-header {
9
+ @include font($size: $t6-text, $color: $red-regular-clr, $weight: bold);
10
+ line-height: 16px;
11
+ text-transform: uppercase;
12
+ margin: 0;
13
+ span {
14
+ margin-right: 4px;
15
+ }
16
+ }
17
+ .alert-body {
18
+ margin-top: 16px;
19
+ .body-title {
20
+ @include font($size: $t3-text, $color: $primary-text-clr, $weight: bold);
21
+ line-height: 24px;
22
+ margin: 0 0 8px;
23
+ }
24
+ .body-info {
25
+ @include font($size: $t4-text, $color: $primary-text-clr);
26
+ line-height: 22px;
27
+ margin: 0;
28
+ }
29
+ .body-list-info {
30
+ padding-inline-start: 20px;
31
+ margin: 0;
32
+ li {
33
+ @include font($size: $t4-text, $color: $primary-text-clr);
34
+ line-height: 22px;
35
+ margin-bottom: 8px;
36
+ &:nth-last-child(1) {
37
+ margin-bottom: 0;
38
+ }
39
+ }
40
+ }
41
+ }
42
+ }
43
+
44
+ .toast-alert {
45
+ display: flex;
46
+ align-items: center;
47
+ max-width: 225px;
48
+ padding: 8px 16px;
49
+ border-radius: $radius-4;
50
+ &.informative {
51
+ background: $blue-light-clr;
52
+ }
53
+ &.successful {
54
+ background: $green-light-clr;
55
+ }
56
+ &.warning {
57
+ background: $yellow-light-clr;
58
+ }
59
+ &.error {
60
+ background: $red-light-clr;
61
+ }
62
+ .toast-info {
63
+ @include font($size: $t4-text, $color: $primary-text-clr);
64
+ line-height: 22px;
65
+ margin: 0;
66
+ }
67
+ .toast-close {
68
+ @include font($size: $t4-text, $color: $ink-lighter-clr);
69
+ margin-left: 24px;
70
+ cursor: pointer;
71
+ }
72
+ }
73
+
74
+ .inline-alert {
75
+ @include font($size: $t4-text, $color: $primary-text-clr);
76
+ line-height: 22px;
77
+ span {
78
+ margin-right: 4px;
79
+ }
80
+ &.informative {
81
+ span {
82
+ color: $blue-regular-clr;
83
+ }
84
+ }
85
+ &.successful {
86
+ span {
87
+ color: $green-regular-clr;
88
+ }
89
+ }
90
+ &.warning {
91
+ span {
92
+ color: $yellow-regular-clr;
93
+ }
94
+ }
95
+ &.error {
96
+ color: $red-regular-clr;
97
+ span {
98
+ color: $red-regular-clr;
99
+ }
100
+ }
101
+ }