cm-admin 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 590c14bc3ee438f00943ac40316aaf1e0850639a5eda8da1d4c73dec80b11963
4
- data.tar.gz: df5b1269f85267cc86e123c15b950e50292396771cb83cc10dc27bb3337d7416
3
+ metadata.gz: 740dc3d69ceebeee0f6137dc2858b9d10bea0f5ef5c71013c988115e445b779b
4
+ data.tar.gz: d6f44e0ad96646096ab7fd33595c9e57e9605d5f6e746638b1a3141876854adb
5
5
  SHA512:
6
- metadata.gz: 1b530f87e1a584d25e43684491ddee0156d7544bcb31f13c8b4d53aedff611ff0ffae7fc4ea9898d5186f4a3453463d7d77b7ecf4f39bee8020fcb4c753f6e76
7
- data.tar.gz: ec22d42e7c47f2755642a902821db15616378361b661b0a609d22fe5b678527ae6ddddf62d902ba0aa55fc647eb215bb4704df046f5b7bbf5625c1b7ffceaa2f
6
+ metadata.gz: 95e5b8b2e3ac48e776577fe2cdbfb864f82c29777210e57c5342a726593b51d8f543d4b5ef1bafe7e4bb693746881b646ca3504857d07b7749c5ee791b8d4721
7
+ data.tar.gz: 3b6a1a37c18bbae57b57e662f4ff6401a8fba43470cc7da6b5e1b8af3f174120d15fa928e8d745afddb7f3be20841b4f9b6bc391a935ca2dd29de66bf7f1fe47
@@ -5,6 +5,13 @@
5
5
  background-color: $white;
6
6
  overflow: auto;
7
7
 
8
+ .sticky-container {
9
+ z-index: 4;
10
+ .cm-filters-v2 {
11
+ padding: 16px 24px 36px 24px;
12
+ }
13
+ }
14
+
8
15
  &__filters {
9
16
  // If you want to overwrite filters styles ---> add styles here
10
17
  }
@@ -65,10 +72,12 @@
65
72
  }
66
73
  }
67
74
 
75
+
68
76
  .new-admin-table {
69
77
  overflow: auto;
70
78
  margin-top: 40px;
71
79
  margin-bottom: 50px;
80
+ height: 280px;
72
81
  .cm-table {
73
82
  table-layout: fixed;
74
83
  position: relative;
@@ -79,8 +88,8 @@
79
88
  &__header {
80
89
  .header-row {
81
90
  display: block;
82
- position: relative;
83
91
  width: 100%;
92
+ position: relative;
84
93
  box-shadow: inset 0px -1px 0px rgba(148, 151, 155, 0.15);
85
94
  th {
86
95
  @include font($size: $t6-text, $color: $ink-lighter-clr, $weight: bold);
@@ -89,10 +98,22 @@
89
98
  max-width: 200px;
90
99
  padding: 12px 16px 12px 16px;
91
100
  }
101
+ th:nth-child(2){
102
+ position: sticky;
103
+ left: 38px;
104
+ z-index: 2;
105
+ background-color: #fff;
106
+ border-bottom: 1.21px solid rgb(240, 239, 239);
107
+ }
92
108
  .check-box-space {
109
+ position: sticky;
110
+ left: 0;
93
111
  min-width: fit-content;
94
112
  max-width: fit-content;
95
113
  padding: 12px 8px 12px 16px;
114
+ z-index: 2;
115
+ background-color: #fff;
116
+ border-bottom: 1.21px solid rgb(240, 239, 239);
96
117
  span {
97
118
  vertical-align: text-top;
98
119
  }
@@ -100,24 +121,47 @@
100
121
  }
101
122
  }
102
123
  &__body {
124
+ // display: block;
125
+ // overflow: auto;
126
+ // overflow-x: hidden;
127
+ // position: relative;
128
+ // width: 100%;
129
+ // height: 335px;
103
130
  display: block;
104
131
  position: relative;
105
- width: 100%; .body-row {
106
- box-shadow: inset 0px -1px 0px rgba(148, 151, 155, 0.15);
107
- transition: all .2s linear;
132
+ width: 100%;
133
+ .body-row {
134
+ border-bottom: 1.21px solid rgb(240, 239, 239);
135
+ td:nth-child(2){
136
+ position: sticky;
137
+ left: 38px;
138
+ z-index: 2;
139
+ background-color: #fff;
140
+ }
141
+
108
142
  &:nth-last-child(1) {
109
143
  box-shadow: none;
110
144
  }
111
145
  &:hover {
112
146
  background-color: $grey-lighter-clr;
147
+ td:nth-child(1) {
148
+ background-color: $grey-lighter-clr;
149
+ }
150
+ td:nth-child(2) {
151
+ background-color: $grey-lighter-clr;
152
+ }
113
153
  .row-action-cell {
114
154
  opacity: 1;
115
155
  }
116
156
  }
117
157
  .check-box-space {
158
+ position: sticky;
159
+ left: 0;
118
160
  min-width: fit-content;
119
161
  max-width: fit-content;
120
162
  padding: 16px 8px 16px 16px;
163
+ z-index: 2;
164
+ background-color: #fff;
121
165
  span {
122
166
  vertical-align: text-top;
123
167
  }
@@ -145,6 +189,17 @@
145
189
  align-items: center;
146
190
  justify-content: center;
147
191
  height: 100%;
192
+ .popup-card {
193
+ width:fit-content;
194
+ .popup-option {
195
+ a {
196
+ font-weight: 500;
197
+ font-size: 14px;
198
+ line-height: 22px;
199
+ color: #1D2129;
200
+ }
201
+ }
202
+ }
148
203
  .tool-btn {
149
204
  background-color: transparent;
150
205
  border: none;
@@ -154,15 +209,20 @@
154
209
  }
155
210
  }
156
211
  }
212
+ .cm-table > thead {
213
+ position:sticky;
214
+ top:0;
215
+ background-color: #fff;
216
+ z-index: 3;
217
+ }
157
218
  }
158
219
 
159
220
  .admin-table-index {
160
-
161
221
  position: fixed;
162
222
  width: calc(100% - 285px);
163
223
  left: 245px;
164
224
  background-color: #fff;
165
- z-index: 1;
225
+ z-index: 4;
166
226
  .table-sticky-top {
167
227
  position: sticky;
168
228
  top: 254px;
@@ -172,6 +232,8 @@
172
232
  justify-content: space-between;
173
233
  align-items: center;
174
234
  padding-bottom: 16px;
235
+ margin-top: -20px;
236
+ background-color: #fff;
175
237
  &__total-count {
176
238
  font-size: $t4-text;
177
239
  line-height: 22px;
@@ -0,0 +1,86 @@
1
+ @import "../helpers/index.scss";
2
+
3
+ .cm-drawer {
4
+ position: fixed;
5
+ top: 0;
6
+ right: 0;
7
+ bottom: 0;
8
+ left: 0;
9
+ width: 100%;
10
+ height: 100%;
11
+ z-index: 5;
12
+ background-color: rgba(0, 0, 0, .7);
13
+ &__container {
14
+ position: relative;
15
+ width: 360px;
16
+ height: 100%;
17
+ background: $white;
18
+ box-shadow: 0px 4px 16px rgba(0, 0, 0, 0.16);
19
+ .header {
20
+ display: flex;
21
+ align-items: center;
22
+ justify-content: space-between;
23
+ padding: 24px;
24
+ background: #F8F9FA;
25
+ &__lhs {
26
+ .title {
27
+ font-family: $primary-font;
28
+ font-size: $t1-text;
29
+ font-weight: 600;
30
+ line-height: 28px;
31
+ color: $primary-text-clr;
32
+ margin-bottom: 8px;
33
+ }
34
+ .description {
35
+ font-family: $primary-font;
36
+ font-size: $t4-text;
37
+ line-height: 22px;
38
+ color: $primary-text-clr;
39
+ margin-bottom: 0;
40
+ }
41
+ }
42
+ &__rhs {
43
+ color: $ink-lighter-clr;
44
+ }
45
+ }
46
+ .body {
47
+ padding: 24px;
48
+ .info-text {
49
+ font-family: $primary-font;
50
+ font-size: $t4-text;
51
+ line-height: 22px;
52
+ color: $primary-text-clr;
53
+ }
54
+ }
55
+ }
56
+ }
57
+
58
+ .drawer-slide-in {
59
+ animation: slideInLeft .3s ease-in forwards;
60
+ }
61
+
62
+ .drawer-slide-out {
63
+ animation: slideOutLeft .3s ease-in forwards;
64
+ }
65
+
66
+ @keyframes slideInLeft {
67
+ 0% {
68
+ left: -400px;
69
+ opacity: 0;
70
+ }
71
+ 100% {
72
+ left: 0;
73
+ opacity: 1;
74
+ }
75
+ }
76
+
77
+ @keyframes slideOutLeft {
78
+ 0% {
79
+ left: 0;
80
+ opacity: 1;
81
+ }
82
+ 100% {
83
+ left: -400px;
84
+ opacity: 0;
85
+ }
86
+ }
@@ -5,3 +5,4 @@
5
5
  @import './dropdown-popup';
6
6
  @import './range';
7
7
  @import './modal';
8
+ @import './drawer';
@@ -40,4 +40,27 @@ $(document).on('click', '.row-action-cell', function(e) {
40
40
  } else {
41
41
  return $(this).find('.table-export-popup').addClass('hidden');
42
42
  }
43
+ });
44
+
45
+
46
+ $(document).on('click', '.drawer-btn', function(e) {
47
+ e.stopPropagation();
48
+ if ($('.cm-drawer').hasClass('hidden')) {
49
+ $('.cm-drawer').removeClass('hidden');
50
+ if ($('#drawer-container').hasClass('drawer-slide-out')) {
51
+ $('#drawer-container').removeClass('drawer-slide-out');
52
+ }
53
+ $('#drawer-container').addClass('drawer-slide-in');
54
+ } else {
55
+ return $('.cm-drawer').addClass('hidden');
56
+ }
57
+ });
58
+
59
+ $(document).on('click', '.drawer-close', function(e) {
60
+ e.stopPropagation();
61
+ $('#drawer-container').removeClass('drawer-slide-in');
62
+ $('#drawer-container').addClass('drawer-slide-out');
63
+ setTimeout(() => {
64
+ $('.cm-drawer').addClass('hidden');
65
+ }, 300);
43
66
  });
@@ -0,0 +1,13 @@
1
+ .cm-drawer.hidden
2
+ .cm-drawer__container#drawer-container
3
+ .header
4
+ .header__lhs
5
+ h2.title Review
6
+ p.description Theresa Webb
7
+ .header__rhs
8
+ i.fa.fa-times.drawer-close.pointer
9
+ .body
10
+ p.info-text
11
+ | It was really an amazing experience being an Unschooler. Its really different from other e-learning websites in every aspects like certification, providing internship opportunities and many more. I am going to recommend Unschool for sure!
12
+
13
+
@@ -16,6 +16,7 @@
16
16
  input.cm-checkbox type="checkbox"
17
17
  - @model.available_fields[:index].each do |column|
18
18
  th = column.header
19
+ // th Drawer
19
20
  tbody.cm-table__body
20
21
  - @ar_object.data.each do |ar_object|
21
22
  tr.body-row
@@ -29,6 +30,8 @@
29
30
  = link_to ar_object.send(column.field_name), "/cm_admin/#{ar_object.model_name.collection}/#{ar_object.id}"
30
31
  - else
31
32
  = show_field_value(ar_object, column)
33
+ // td
34
+ // button.drawer-btn Open Drawer
32
35
  td.row-action-cell
33
36
  .row-action-tool
34
37
  button.secondary-btn.tool-btn type="button"
@@ -10,3 +10,4 @@
10
10
 
11
11
  = column_pop_up(@model)
12
12
  = manage_column_pop_up(@model)
13
+ == render 'cm_admin/main/drawer'
@@ -7,12 +7,10 @@ module CmAdmin
7
7
  def initialize(section_name, &block)
8
8
  @available_section_fields = []
9
9
  @section_name = section_name
10
- puts "-- reached here --"
11
10
  instance_eval(&block)
12
11
  end
13
12
 
14
13
  def field(field_name, options={})
15
- puts "For printing field #{field_name}"
16
14
  @available_section_fields << CmAdmin::Models::Field.new(field_name, options)
17
15
  end
18
16
  end
@@ -7,23 +7,23 @@ module CmAdmin
7
7
  @current_action = CmAdmin::Models::Action.find_by(self, name: 'show')
8
8
  @ar_object = @ar_model.find(params[:id])
9
9
  end
10
-
10
+
11
11
  def index(params)
12
12
  @current_action = CmAdmin::Models::Action.find_by(self, name: 'index')
13
13
  # Based on the params the filter and pagination object to be set
14
14
  @ar_object = filter_by(params, nil, filter_params(params))
15
15
  end
16
-
16
+
17
17
  def new(params)
18
18
  @current_action = CmAdmin::Models::Action.find_by(self, name: 'new')
19
19
  @ar_object = @ar_model.new
20
20
  end
21
-
21
+
22
22
  def edit(params)
23
23
  @current_action = CmAdmin::Models::Action.find_by(self, name: 'edit')
24
24
  @ar_object = @ar_model.find(params[:id])
25
25
  end
26
-
26
+
27
27
  def update(params)
28
28
  @ar_object = @ar_model.find(params[:id])
29
29
  @ar_object.assign_attributes(resource_params(params))
@@ -50,7 +50,7 @@ module CmAdmin
50
50
  # filtered_result.facets.sort = sort_params
51
51
  return filtered_result
52
52
  end
53
-
53
+
54
54
  def resource_params(params)
55
55
  permittable_fields = @permitted_fields || @ar_model.columns.map(&:name).reject { |i| CmAdmin::REJECTABLE_FIELDS.include?(i) }.map(&:to_sym)
56
56
  permittable_fields += @ar_model.reflect_on_all_attachments.map {|x|
@@ -62,15 +62,16 @@ module CmAdmin
62
62
  }.compact
63
63
  nested_tables = self.available_fields[:new].except(:fields).keys
64
64
  nested_tables += self.available_fields[:edit].except(:fields).keys
65
- nested_fields = nested_tables.map {|table|
65
+ nested_fields = nested_tables.uniq.map {|table|
66
66
  Hash[
67
67
  table.to_s + '_attributes',
68
68
  table.to_s.classify.constantize.columns.map(&:name).reject { |i| CmAdmin::REJECTABLE_FIELDS.include?(i) }.map(&:to_sym) + [:id, :_destroy]
69
69
  ]
70
70
  }
71
71
  permittable_fields += nested_fields
72
+ @ar_model.columns.map { |col| permittable_fields << col.name.split('_cents') if col.name.include?('_cents') }
72
73
  params.require(self.name.underscore.to_sym).permit(*permittable_fields)
73
74
  end
74
75
  end
75
76
  end
76
- end
77
+ end
@@ -15,6 +15,7 @@ module CmAdmin
15
15
 
16
16
  def set_default_values
17
17
  self.disabled = false
18
+ self.label = self.field_name.to_s.titleize
18
19
  end
19
20
  end
20
21
  end
@@ -1,3 +1,3 @@
1
1
  module CmAdmin
2
- VERSION = "0.5.4"
2
+ VERSION = "0.5.5"
3
3
  end
@@ -44,10 +44,10 @@ module CmAdmin
44
44
  if field.input_type.eql?(:hidden)
45
45
  concat input_field_for_column(f, field)
46
46
  else
47
- concat f.label field.field_name, class: 'field-label'
47
+ concat f.label field.label, class: 'field-label'
48
48
  concat tag.br
49
49
  concat(content_tag(:div, class: "datetime-wrapper") do
50
- concat input_field_for_column(f, field)
50
+ concat input_field_for_column(f, field)
51
51
  end)
52
52
  concat tag.p resource.errors[field.field_name].first if resource.errors[field.field_name].present?
53
53
  end
@@ -1 +1 @@
1
- 33d3c35c58c8db0310c4cb3ec7ff742813910e07
1
+ 07d558738c316293586496817b2bccbf6430b5bd
data/yarn.lock CHANGED
@@ -2941,9 +2941,9 @@ flush-write-stream@^1.0.0:
2941
2941
  readable-stream "^2.3.6"
2942
2942
 
2943
2943
  follow-redirects@^1.0.0:
2944
- version "1.14.1"
2945
- resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.1.tgz#d9114ded0a1cfdd334e164e6662ad02bfd91ff43"
2946
- integrity sha512-HWqDgT7ZEkqRzBvc2s64vSZ/hfOceEol3ac/7tKwzuvEyWx3/4UegXh5oBOIotkGsObyk3xznnSRVADBgWSQVg==
2944
+ version "1.14.8"
2945
+ resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.8.tgz#016996fb9a11a100566398b1c6839337d7bfa8fc"
2946
+ integrity sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA==
2947
2947
 
2948
2948
  for-in@^1.0.2:
2949
2949
  version "1.0.2"
@@ -6589,9 +6589,9 @@ urix@^0.1.0:
6589
6589
  integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=
6590
6590
 
6591
6591
  url-parse@^1.4.3, url-parse@^1.5.1:
6592
- version "1.5.3"
6593
- resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.3.tgz#71c1303d38fb6639ade183c2992c8cc0686df862"
6594
- integrity sha512-IIORyIQD9rvj0A4CLWsHkBBJuNqWpFQe224b6j9t/ABmquIS0qDU2pY6kl6AuOrL5OkCXHMCFNe1jBcuAggjvQ==
6592
+ version "1.5.7"
6593
+ resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.7.tgz#00780f60dbdae90181f51ed85fb24109422c932a"
6594
+ integrity sha512-HxWkieX+STA38EDk7CE9MEryFeHCKzgagxlGvsdS7WBImq9Mk+PGwiT56w82WI3aicwJA8REp42Cxo98c8FZMA==
6595
6595
  dependencies:
6596
6596
  querystringify "^2.1.1"
6597
6597
  requires-port "^1.0.0"
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: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - sajinmp
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2022-02-15 00:00:00.000000000 Z
13
+ date: 2022-02-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: pagy
@@ -116,6 +116,7 @@ files:
116
116
  - app/assets/stylesheets/cm_admin/cm_admin.css.scss
117
117
  - app/assets/stylesheets/cm_admin/components/_alerts.scss
118
118
  - app/assets/stylesheets/cm_admin/components/_buttons.scss
119
+ - app/assets/stylesheets/cm_admin/components/_drawer.scss
119
120
  - app/assets/stylesheets/cm_admin/components/_dropdown-popup.scss
120
121
  - app/assets/stylesheets/cm_admin/components/_input.scss
121
122
  - app/assets/stylesheets/cm_admin/components/_modal.scss
@@ -139,6 +140,7 @@ files:
139
140
  - app/javascript/stylesheets/cm_admin/application.scss
140
141
  - app/views/cm_admin/main/_associated_table.html.slim
141
142
  - app/views/cm_admin/main/_cm_pagy_nav.html.slim
143
+ - app/views/cm_admin/main/_drawer.html.slim
142
144
  - app/views/cm_admin/main/_filters.html.slim
143
145
  - app/views/cm_admin/main/_nested_fields.html.slim
144
146
  - app/views/cm_admin/main/_nested_table_form.html.slim