cm-admin 0.2.0 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) 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 +7 -1
  6. data/Gemfile.lock +121 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +8 -19
  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 +4 -6
  11. data/app/assets/stylesheets/cm_admin/base/common.scss +237 -0
  12. data/app/assets/stylesheets/cm_admin/base/filters.scss +200 -0
  13. data/{lib/generators/cm_admin/templates/assets/stylesheets → app/assets/stylesheets/cm_admin}/base/form.scss +83 -11
  14. data/app/assets/stylesheets/cm_admin/base/main-nav.scss +47 -0
  15. data/app/assets/stylesheets/cm_admin/base/navbar.scss +65 -0
  16. data/app/assets/stylesheets/cm_admin/base/quicksearch.scss +76 -0
  17. data/app/assets/stylesheets/cm_admin/base/scaffold.scss +96 -0
  18. data/app/assets/stylesheets/cm_admin/base/show.scss +76 -0
  19. data/app/assets/stylesheets/cm_admin/base/sidebar.scss +225 -0
  20. data/app/assets/stylesheets/cm_admin/base/table.scss +320 -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 +153 -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 +31 -0
  29. data/app/assets/stylesheets/cm_admin/components/_status-tag.scss +68 -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 +87 -0
  34. data/app/assets/stylesheets/cm_admin/helpers/index.scss +2 -0
  35. data/app/controllers/cm_admin/application_controller.rb +11 -0
  36. data/app/controllers/cm_admin/exports_controller.rb +16 -0
  37. data/app/controllers/cm_admin/static_controller.rb +12 -0
  38. data/app/helpers/cm_admin/application_helper.rb +11 -0
  39. data/app/helpers/cm_admin/custom_helper.rb +4 -0
  40. data/app/javascript/packs/cm_admin/application.js +22 -0
  41. data/app/javascript/packs/cm_admin/filters.js +347 -0
  42. data/app/javascript/packs/cm_admin/quick_search.js +67 -0
  43. data/app/javascript/packs/cm_admin/scaffolds.js +43 -0
  44. data/app/javascript/stylesheets/cm_admin/application.scss +3 -0
  45. data/app/views/cm_admin/main/_associated_table.html.slim +60 -0
  46. data/app/views/cm_admin/main/_cm_pagy_nav.html.slim +23 -0
  47. data/app/views/cm_admin/main/_filters.html.slim +1 -0
  48. data/app/views/cm_admin/main/_nested_fields.html.slim +7 -0
  49. data/app/views/cm_admin/main/_nested_table_form.html.slim +6 -0
  50. data/app/views/cm_admin/main/_table.html.slim +60 -0
  51. data/app/views/cm_admin/main/_tabs.html.slim +5 -0
  52. data/app/views/cm_admin/main/_top_navbar.html.slim +25 -0
  53. data/app/views/cm_admin/main/associated_index.html.slim +6 -0
  54. data/app/views/cm_admin/main/associated_show.html.slim +6 -0
  55. data/app/views/cm_admin/main/dashboard.html.slim +1 -0
  56. data/app/views/cm_admin/main/edit.html.slim +19 -0
  57. data/app/views/cm_admin/main/index.html.slim +12 -0
  58. data/app/views/cm_admin/main/new.html.slim +22 -0
  59. data/app/views/cm_admin/main/show.html.slim +12 -0
  60. data/app/views/cm_admin/static/error_401.html.slim +4 -0
  61. data/app/views/layouts/_left_sidebar_nav.html.slim +34 -0
  62. data/app/views/layouts/_quick_links.html.slim +25 -0
  63. data/app/views/layouts/cm_admin.html.slim +41 -0
  64. data/app/views/layouts/static.html.slim +18 -0
  65. data/bin/webpack +18 -0
  66. data/bin/webpack-dev-server +18 -0
  67. data/cm_admin.gemspec +21 -31
  68. data/config/.DS_Store +0 -0
  69. data/config/initializers/active_record_extension.rb +9 -0
  70. data/config/routes.rb +19 -0
  71. data/config/webpack/development.js +5 -0
  72. data/config/webpack/environment.js +13 -0
  73. data/config/webpack/production.js +5 -0
  74. data/config/webpack/test.js +5 -0
  75. data/config/webpacker.yml +92 -0
  76. data/lib/cm_admin/constants.rb +33 -0
  77. data/lib/cm_admin/engine.rb +38 -0
  78. data/lib/cm_admin/model.rb +152 -0
  79. data/lib/cm_admin/models/action.rb +36 -0
  80. data/lib/cm_admin/models/actions/blocks.rb +25 -0
  81. data/lib/cm_admin/models/blocks.rb +19 -0
  82. data/lib/cm_admin/models/cm_show_section.rb +20 -0
  83. data/lib/cm_admin/models/column.rb +61 -0
  84. data/lib/cm_admin/models/controller_method.rb +75 -0
  85. data/lib/cm_admin/models/dsl_method.rb +122 -0
  86. data/lib/cm_admin/models/export.rb +54 -0
  87. data/lib/cm_admin/models/field.rb +15 -0
  88. data/lib/cm_admin/models/filter.rb +95 -0
  89. data/lib/cm_admin/models/form_field.rb +21 -0
  90. data/lib/cm_admin/models/tab.rb +13 -0
  91. data/lib/cm_admin/utils.rb +67 -0
  92. data/lib/cm_admin/version.rb +1 -1
  93. data/lib/cm_admin/view_helpers/column_field_helper.rb +29 -0
  94. data/lib/cm_admin/view_helpers/field_display_helper.rb +65 -0
  95. data/lib/cm_admin/view_helpers/filter_helper.rb +190 -0
  96. data/lib/cm_admin/view_helpers/form_field_helper.rb +33 -0
  97. data/lib/cm_admin/view_helpers/form_helper.rb +65 -0
  98. data/lib/cm_admin/view_helpers/manage_column_popup_helper.rb +75 -0
  99. data/lib/cm_admin/view_helpers/navigation_helper.rb +34 -0
  100. data/lib/cm_admin/view_helpers/page_info_helper.rb +57 -0
  101. data/lib/cm_admin/view_helpers.rb +74 -0
  102. data/lib/cm_admin.rb +33 -2
  103. data/lib/generators/cm_admin/install_generator.rb +3 -13
  104. data/lib/tasks/webpack_install.rake +63 -0
  105. data/package.json +23 -0
  106. data/postcss.config.js +12 -0
  107. data/tmp/cache/webpacker/last-compilation-digest-development +1 -0
  108. data/yarn.lock +6933 -0
  109. metadata +155 -46
  110. data/lib/generators/cm_admin/USAGE +0 -8
  111. data/lib/generators/cm_admin/templates/assets/images/cm.png +0 -0
  112. data/lib/generators/cm_admin/templates/assets/stylesheets/application.css.scss +0 -33
  113. data/lib/generators/cm_admin/templates/assets/stylesheets/base/_variable.scss +0 -14
  114. data/lib/generators/cm_admin/templates/assets/stylesheets/base/input-styles.scss +0 -72
  115. data/lib/generators/cm_admin/templates/assets/stylesheets/base/main-nav.scss +0 -79
  116. data/lib/generators/cm_admin/templates/assets/stylesheets/base/scaffold.scss +0 -95
  117. data/lib/generators/cm_admin/templates/assets/stylesheets/base/show.scss +0 -88
  118. data/lib/generators/cm_admin/templates/assets/stylesheets/base/sidebar.scss +0 -69
  119. data/lib/generators/cm_admin/templates/assets/stylesheets/base/table.scss +0 -246
  120. data/lib/generators/cm_admin/templates/layouts/_navbar.html.slim +0 -8
  121. data/lib/generators/cm_admin/templates/layouts/_side_navbar.html.slim +0 -12
  122. data/lib/generators/cm_admin/templates/layouts/application.html.slim +0 -20
  123. data/lib/generators/cm_admin/templates/layouts/initializer.rb +0 -2
  124. data/lib/generators/cm_admin/templates/views/_form.erb +0 -67
  125. data/lib/generators/cm_admin/templates/views/_table.erb +0 -22
  126. data/lib/generators/cm_admin/templates/views/edit.erb +0 -10
  127. data/lib/generators/cm_admin/templates/views/index.erb +0 -11
  128. data/lib/generators/cm_admin/templates/views/new.erb +0 -10
  129. data/lib/generators/cm_admin/templates/views/reset_password.erb +0 -12
  130. data/lib/generators/cm_admin/templates/views/show.erb +0 -18
  131. data/lib/generators/cm_admin/templates/views/sign_in.erb +0 -18
  132. data/lib/generators/cm_admin/view_generator.rb +0 -78
@@ -1,69 +0,0 @@
1
- @import "_variable.scss";
2
-
3
- .sidebar-menu {
4
- position: fixed;
5
- top: 0;
6
- left: 0;
7
- width: 250px;
8
- height: 100%;
9
- background-color: $elephant-black;
10
- overflow: hidden;
11
- z-index: 1;
12
-
13
- &__logo-header {
14
- display: flex;
15
- justify-content: center;
16
- align-items: center;
17
- height: 60px;
18
- padding: 8px;
19
- background-color: $active-bg;
20
- img {
21
- width: 100%;
22
- object-fit: cover;
23
- }
24
- }
25
-
26
- &__tabs-wrapper {
27
- height: calc(100vh - 115px);
28
- padding: 20px 0;
29
- overflow-y: auto;
30
-
31
- .tab-link {
32
- padding: 0;
33
- text-decoration: none;
34
- color: $nav-text-color;
35
- cursor: pointer;
36
- .tab-item {
37
- position: relative;
38
- padding: 10px 0;
39
- transition: all 0.2s linear;
40
- cursor: pointer;
41
- &:hover {
42
- background-color: #4b4b4b;
43
- }
44
- &.active {
45
- background-color: $active-bg;
46
- border-left: 4px solid #0099ff;
47
- }
48
- .tab-name {
49
- color: $nav-text-color;
50
- }
51
- }
52
- }
53
- }
54
-
55
- &__footer {
56
- position: absolute;
57
- bottom: 5px;
58
- width: 100%;
59
- .auth-link {
60
- display: block;
61
- color: $white;
62
- padding: 10px 0;
63
- transition: all 0.2s linear;
64
- &:hover {
65
- background-color: #000000;
66
- }
67
- }
68
- }
69
- }
@@ -1,246 +0,0 @@
1
- @import "_variable.scss";
2
-
3
- .main-body {
4
- margin-top: 60px;
5
-
6
- .top-bar {
7
- position: fixed;
8
- top: 60px;
9
- left: 250px;
10
- width: calc(100% - 250px);
11
- height: 60px;
12
- padding: 10px 20px;
13
- background-color: $white;
14
- box-shadow: 0 1px 0 0 rgba(0, 0, 0, 0.06);
15
- z-index: 9;
16
- @media screen and (max-width: 1280px) {
17
- min-height: 60px;
18
- }
19
- }
20
-
21
- .table-container {
22
- margin-top: 120px;
23
- padding: 20px;
24
- }
25
-
26
- //filter-styles-starts-here
27
- .filter-section {
28
- display: flex;
29
- justify-content: space-between;
30
- align-items: center;
31
- width: 100%;
32
- height: 100%;
33
- @media screen and (max-width: 1280px) {
34
- flex-wrap: wrap;
35
- }
36
- &__lhs {
37
- display: flex;
38
- align-items: center;
39
- width: 75%;
40
- .filter-field {
41
- position: relative;
42
- width: 250px;
43
- margin-right: 10px;
44
- @media screen and (max-width: 1280px) {
45
- margin-bottom: 10px;
46
- }
47
-
48
- //input-styles
49
- input {
50
- width: 100%;
51
- height: 39px;
52
- border: 1px solid #ccc;
53
- border-radius: 4px;
54
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
55
- &:focus {
56
- border-color: #66afe9 !important;
57
- outline: 0 !important;
58
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6) !important;
59
- }
60
- }
61
-
62
- //select2 styles
63
- .select2 {
64
- width: 100% !important;
65
- .selection {
66
- //single-select-styles
67
- .select2-selection--single {
68
- height: 39px;
69
- border: 1px solid #ccc;
70
- border-radius: 4px;
71
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
72
- &:focus {
73
- border-color: #66afe9;
74
- outline: 0;
75
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
76
- }
77
- .select2-selection__rendered {
78
- color: #555555;
79
- line-height: 36px;
80
- .select2-search--inline {
81
- .select2-search__field {
82
- height: 26px !important;
83
- }
84
- }
85
- }
86
- .select2-selection__arrow {
87
- top: 7px;
88
- b {
89
- border-color: #0099ff transparent transparent transparent;
90
- }
91
- }
92
- }
93
- //multi-select-styles
94
- .select2-selection--multiple {
95
- max-height: 39px;
96
- border: 1px solid #ccc;
97
- border-radius: 4px;
98
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
99
- overflow-y: auto;
100
- .select2-selection__rendered {
101
- .select2-search--inline {
102
- .select2-search__field {
103
- height: 26px !important;
104
- border: none;
105
- }
106
- }
107
- }
108
- }
109
- }
110
- }
111
-
112
- //single-select-arrow-styles
113
- .select2-container--open {
114
- .selection {
115
- .select2-selection--single {
116
- .select2-selection__arrow {
117
- top: 7px;
118
- b {
119
- border-color: transparent transparent #0099ff transparent;
120
- }
121
- }
122
- }
123
- }
124
- }
125
-
126
- .filter-rangepicker {
127
- padding: 6px 12px;
128
- color: #172b4d;
129
- font-size: 16px;
130
- }
131
-
132
- .field-area {
133
- display: block;
134
- padding: 6px 12px;
135
- font-size: 16px;
136
- color: #555555;
137
- }
138
- .search-icon {
139
- position: absolute;
140
- top: 10px;
141
- right: 15px;
142
- color: #0099ff;
143
- }
144
- .down-arrow-icon {
145
- position: absolute;
146
- top: 10px;
147
- right: 15px;
148
- font-size: 20px;
149
- color: #0099ff;
150
- }
151
- }
152
- }
153
- &__rhs {
154
- width: 25%;
155
- text-align: right;
156
- .filter-btn {
157
- padding: 5px 10px;
158
- color: $white;
159
- font-size: 16px;
160
- background-color: #0099ff;
161
- border: none;
162
- border-radius: 4px;
163
- transition: all .2s linear;
164
- &:hover {
165
- box-shadow: 0px 37px 20px -20px rgba(0, 0, 0, 0.2);
166
- transform: scale(1.2);
167
- }
168
- span {
169
- margin-right: 5px;
170
- }
171
- }
172
- }
173
- }
174
-
175
- .admin-table {
176
- background-color: $white;
177
- border-radius: 5px;
178
- .record-found {
179
- padding: 10px;
180
- color: #31383d;
181
- font-size: 14px;
182
- opacity: 0.5;
183
- }
184
- .cm-table {
185
- width: 100%;
186
- &__header {
187
- tr > th {
188
- width: 20%;
189
- color: #172b4d;
190
- background-color: #fafbfc;
191
- box-shadow: inset 0 1px 0 0 #ebecf0;
192
- font-weight: 600;
193
- font-size: 14px;
194
- border-bottom: none;
195
- height: 40px;
196
- padding: 0 10px;
197
- }
198
- }
199
-
200
- &__body {
201
- tr {
202
- transition: all 0.2s linear;
203
- &:hover {
204
- background-color: #dfe4e7;
205
- }
206
- }
207
-
208
- tr > td {
209
- color: #172b4d;
210
- font-size: 14px;
211
- padding: 8px 10px;
212
- }
213
- .edit-icon {
214
- font-size: 20px;
215
- cursor: pointer;
216
- transition: all .2s linear;
217
- &:hover {
218
- box-shadow: 0px 37px 20px -20px rgba(0, 0, 0, 0.2);
219
- transform: scale(1.2);
220
- }
221
- }
222
- }
223
- }
224
- }
225
-
226
- .cm-pagination {
227
- display: flex;
228
- justify-content: center;
229
- margin: 30px 0;
230
- &__item {
231
- padding: 5px 10px;
232
- font-size: 16px;
233
- background-color: $white;
234
- border: 1px solid #cbdcde;
235
- border-radius: 4px;
236
- &:nth-child(2) {
237
- margin-left: 16px;
238
- transition: all 0.2s linear;
239
- cursor: pointer;
240
- &:hover {
241
- box-shadow: 0px 8px 15px rgba(0, 0, 0, 0.1);
242
- }
243
- }
244
- }
245
- }
246
- }
@@ -1,8 +0,0 @@
1
- .main-nav
2
- .main-nav__lhs
3
- = yield :bread_crumb
4
- .main-nav__rhs
5
- .profile-avatar
6
- span CM
7
- .auth-popup
8
- p = link_to "Log out", '/sign-out', method: :delete
@@ -1,12 +0,0 @@
1
- .sidebar-menu
2
-
3
- .sidebar-menu__logo-header
4
- = image_tag('cm.png', alt: 'logo image')
5
-
6
-
7
- .sidebar-menu__tabs-wrapper
8
-
9
-
10
- .sidebar-menu__footer
11
- = link_to '/sign-out', method: :delete, class: 'auth-link'
12
- span.p-4.f14 Logout
@@ -1,20 +0,0 @@
1
- doctype html
2
- html
3
- head
4
- title
5
- | CM Admin panel
6
- = csrf_meta_tags
7
- = csp_meta_tag
8
- = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload'
9
- = javascript_pack_tag 'application', 'data-turbolinks-track': 'reload'
10
-
11
- body
12
- - unless controller_path.include?('devise')
13
- .admin-panel
14
- = render 'layouts/side_navbar'
15
- .main
16
- .main-container
17
- = render 'layouts/navbar'
18
- = yield
19
- - else
20
- = yield
@@ -1,2 +0,0 @@
1
-
2
- # Add initialization content here
@@ -1,67 +0,0 @@
1
- .cm-admin-form
2
- = simple_form_for([:admin, @<%= name.singularize %>]) do |f|
3
- = f.error_notification
4
- .custom-validations.error-color
5
- <% options[:column_names].each do |column_name| %>
6
- <% column_name_arr = column_name.split(':') %>
7
- <% case column_name_arr[1]
8
- when 'input-integer' %>
9
- .form-field
10
- .form-label
11
- | <%= column_name_arr[0].titleize %>
12
- .form-input
13
- = f.input :<%= column_name_arr[0] %>, label: false, input_html: { data: {class_name: '<%= column_name_arr[0] %>'} }, placeholder: '<%= column_name_arr[0].gsub('_', ' ').titleize %>', required: true, error_message_html: {class: "<%= column_name_arr[0] %>"}
14
- .<%= column_name_arr[0] %>.error-color.hidden
15
- p Please fill height
16
- <% when 'input-string' %>
17
- .form-field
18
- .form-label
19
- | <%= column_name_arr[0].titleize %>
20
- .form-input
21
- = f.input :<%= column_name_arr[0] %>, label: false, input_html: { data: {class_name: '<%= column_name_arr[0] %>'}, placeholder: '<%= column_name_arr[0].gsub('_', ' ').titleize %>' }
22
- .<%= column_name_arr[0] %>.error-color.hidden
23
- p Please fill height
24
- <% when 'single-select' %>
25
- .form-field
26
- .form-label
27
- | <%= column_name_arr[0].titleize %>
28
- .form-input
29
- = f.input :<%= column_name_arr[0] %>, as: :select, label: false, collection: [], input_html: { class: "select2-single"}, include_blank: "Select <%= column_name_arr[0].gsub('_', ' ').titleize %>"
30
- .<%= column_name_arr[0] %>.error-color.hidden
31
- p Please fill height
32
- <% when 'multi-select' %>
33
- .form-field
34
- .form-label
35
- | <%= column_name_arr[0].titleize %>
36
- .form-input
37
- = f.input :<%= column_name_arr[0] %>, as: :select, label: false, collection: [], input_html: { class: "select2-single"}, include_blank: "Select <%= column_name_arr[0].gsub('_', ' ').titleize %>", multiple: true
38
- .<%= column_name_arr[0] %>.error-color.hidden
39
- p Please fill height
40
- <% when 'checkbox' %>
41
- .form-field
42
- = f.input :<%= column_name_arr[0] %>, input_html: { data: {class_name: '<%= column_name_arr[0] %>'} }, placeholder: '<%= column_name_arr[0].gsub('_', ' ').titleize %>', required: true, error_message_html: {class: "<%= column_name_arr[0] %>"}
43
- label.radio-label for="male" Male
44
- <% when 'radio' %>
45
- .form-field
46
- = f.input :<%= column_name_arr[0] %>, input_html: { data: {class_name: '<%= column_name_arr[0] %>'} }, placeholder: '<%= column_name_arr[0].gsub('_', ' ').titleize %>', required: true, error_message_html: {class: "<%= column_name_arr[0] %>"}
47
- label.radio-label for="male" Male
48
- <% when 'datepicker' %>
49
- .form-field
50
- .form-label
51
- | <%= column_name_arr[0].titleize %>
52
- .form-input
53
- = f.input :<%= column_name_arr[0] %>, as: :string, label: false, input_html: { data: {class_name: '<%= column_name_arr[0] %>'}, class: 'datepicker', value: @<%= name.singularize %>.<%= column_name_arr[0] %>&.strftime('%d/%m/%Y') }, placeholder: '<%= column_name_arr[0].gsub('_', ' ').titleize %>', required: true, error_message_html: {class: "<%= column_name_arr[0] %>"}
54
- .<%= column_name_arr[0] %>.error-color.hidden
55
- p Please fill height
56
- <% when 'file' %>
57
- .form-field
58
- .form-label
59
- | Upload file
60
- .file-upload
61
- = f.file_field :<%= column_name_arr[0] %>, input_html: {}
62
- <% end %>
63
- <% end %>
64
-
65
- .form-actions
66
- = f.button :submit, "Create new <%= name.singularize %>"
67
- / # f.button :submit, "Create new <%= name.singularize %>", class: "float-right", data: {class_name: 'product_template-form',path_name: "admin/products/#{@product.id}/templates", button_name: 'Create new template'}
@@ -1,22 +0,0 @@
1
- .admin-table
2
- .record-found
3
- | #{@filtered_result.facets.total_count} <%= name %> found
4
-
5
- table.cm-table
6
- thead.cm-table__header
7
- tr
8
- <% options[:column_names].each do |column_name| %>
9
- th <%= column_name.titleize %>
10
- <% end %>
11
- th
12
-
13
- tbody.cm-table__body
14
- - @filtered_result.data.each do |<%= name.singularize %>|
15
- tr
16
- <% options[:column_names].each do |column_name| %>
17
- td = <%= name.singularize %>.<%= column_name %>
18
- <% end %>
19
- td
20
- = link_to edit_admin_<%= name.singularize %>_path(<%= name.singularize %>) do
21
- i.fa.fa-pencil.edit-icon
22
- = cm_paginate(@filtered_result.facets)
@@ -1,10 +0,0 @@
1
- .form-wrapper
2
- .form-wrapper__top-bar
3
- = link_to admin_<%= name.singularize %>_path(@<%= name.singularize %>) do
4
- .back-btn
5
- span
6
- i.fa.fa-arrow-left aria-hidden="true"
7
- | Back
8
- .form-wrapper__inner
9
- .paper
10
- == render 'form', <%= name.singularize %>: @<%= name.singularize %>
@@ -1,11 +0,0 @@
1
- - content_for :bread_crumb do
2
- h6.text-light.breadcrumb-nav
3
- = link_to "Home ", admin_<%= name %>_path
4
- '/
5
- span.active = link_to "<%= name.titleize %>", admin_<%= name %>_path
6
-
7
- .main-body
8
- .top-bar
9
- == render 'filters'
10
- .table-container.<%= name %>-table
11
- == render 'table'
@@ -1,10 +0,0 @@
1
- .form-wrapper
2
- .form-wrapper__top-bar
3
- = link_to admin_<%= name %>_path do
4
- .back-btn
5
- span
6
- i.fa.fa-arrow-left aria-hidden="true"
7
- | Back
8
- .form-wrapper__inner
9
- .paper
10
- == render 'form', <%= name.singularize %>: @<%= name.singularize %>
@@ -1,12 +0,0 @@
1
- .auth
2
- .auth__form-inner
3
- .header-log
4
- = image_tag('cm.png', alt: 'logo image')
5
- h2.header-title FORGOT YOUR PASSWORD
6
- = simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f|
7
- .field-100
8
- .field-100__item
9
- = f.input :email, required: true, autofocus: true,
10
- input_html: { autocomplete: "email" }
11
- .field-100
12
- = f.button :submit, "Send me reset password instructions", class: 'btn btn-primary get-start-btn'
@@ -1,18 +0,0 @@
1
- .show-wrapper
2
- .show-wrapper__tab-bar
3
- .tab-menu
4
- .tab-item.active OVERVIEW
5
- .tab-item COMMUTATUS
6
-
7
- = link_to edit_admin_<%= name.singularize %>_path(@<%= name.singularize %>) do
8
- .edit-btn
9
- i.fa.fa-pencil
10
- .show-wrapper__info-inner
11
- .paper
12
- <% options[:column_names].each do |column_name| %>
13
- .info-flex
14
- .info-flex__lhs
15
- p <%= column_name.titleize %>
16
- .info-flex__rhs
17
- p = @<%= name.singularize %>.<%= column_name %>
18
- <% end %>
@@ -1,18 +0,0 @@
1
- .auth
2
- .auth__form-inner
3
- .header-log
4
- = image_tag('cm.png', alt: 'logo image')
5
- h2.header-title LOG IN
6
- = simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
7
- .field-100
8
- .field-100__item
9
- = f.input :email, required: false, autofocus: true, label: false,
10
- input_html: { autocomplete: "email", placeholder: 'Email' }
11
- .field-100
12
- .field-100__item
13
- = f.input :password, required: false, label: false,
14
- input_html: { autocomplete: "current-password", placeholder: 'Password' }
15
- .forgot-password
16
- a href="/reset_password" Forgot your password?
17
- .field-100
18
- = f.button :submit, "Log in", class: 'btn btn-primary get-start-btn'
@@ -1,78 +0,0 @@
1
- module CmAdmin
2
- module ViewActionTemplate
3
- def copy_index_files
4
- template "views/index.erb", "app/views/admin/#{name}/index.html.slim"
5
- template "views/_table.erb", "app/views/admin/#{name}/_table.html.slim"
6
- inject_into_file 'app/views/layouts/_side_navbar.html.slim', after: ".sidebar-menu__tabs-wrapper" do
7
- "\n
8
- = link_to '/admin/#{name}', class: 'tab-link'
9
- .tab-item class=\"\#{(controller_name == '#{name}' ) ? 'active' : ''}\"
10
- span.p-4.tab-name.f14 #{name.titleize}\n"
11
- end
12
- puts "
13
- -------------------------------------------------------------------
14
- # Important
15
- Run the spotlight filter generator which will generate the filter
16
- partial and controller file. Run the following with required filter option.
17
- rails g spotlight_search:filter #{name} --filters scope:datatype
18
- -------------------------------------------------------------------------"
19
- end
20
-
21
- def copy_show_files
22
- template "views/show.erb", "app/views/admin/#{name}/show.html.slim"
23
- end
24
-
25
- def copy_form_files
26
- template "views/new.erb", "app/views/admin/#{name}/new.html.slim"
27
- template "views/edit.erb", "app/views/admin/#{name}/edit.html.slim"
28
- template "views/_form.erb", "app/views/admin/#{name}/_form.html.slim"
29
- end
30
-
31
- def copy_devise_files
32
- template "views/reset_password.erb", "app/views/devise/passwords/new.html.slim"
33
- template "views/sign_in.erb", "app/views/devise/sessions/new.html.slim"
34
- end
35
- end
36
-
37
- class ViewGenerator < Rails::Generators::NamedBase
38
- include ViewActionTemplate
39
- desc <<-DESC.strip_heredoc
40
- Generate views for specific action of the model in admin
41
- Use -c to specify which column names you want to be present on page.
42
- Atleast one option is mandatory.
43
- For example:
44
- rails g cm_admin:view NAME page_type -c options
45
- rails g cm_admin:view products form -c title:string price:integer
46
- rails g cm_admin:view products index -c title price
47
-
48
- NAME is the table name
49
- page_type is the page you want to copy files. It can be the following
50
- index, show, form.
51
-
52
- This will create a files respectively at app/views/admin/#{name}/***.html.slim
53
-
54
- DESC
55
-
56
- source_root File.expand_path('templates', __dir__)
57
-
58
- argument :page_type, required: true, default: nil,
59
- desc: "The scope to copy views to"
60
- class_option :column_names, aliases: "-c", type: :array, required: true,
61
- desc: "Select specific columns in the files to be be added."
62
-
63
- def create_new_file
64
- if page_type == 'index'
65
- copy_index_files
66
- elsif page_type == 'form'
67
- copy_form_files
68
- elsif page_type == 'show'
69
- copy_show_files
70
- elsif page_type == 'devise'
71
- copy_devise_files
72
- else
73
- puts "Wrong page_type provided. It can be either index or show"
74
- end
75
- end
76
-
77
- end
78
- end