cm-admin 1.5.7 → 1.5.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d2683d5547505d258f1bf7c0ea82236130ec6287ead5ab3670a29d909bc7a895
4
- data.tar.gz: ad8a5db9a2a05d60ba04ced18d09591c56b78dc0cf849823c9a63b296ec43454
3
+ metadata.gz: 94f9ea02b086e8af0391fd20f7022e27ac569120264a1c3a35933df453ee1116
4
+ data.tar.gz: eecd4a2bfdbfd0c5a8638749fdcb6b3fdd196fed10469703caead69daee4febd
5
5
  SHA512:
6
- metadata.gz: 7630c3561997e736dc4a0400d2c734d3e383545f11a5173061196fc84ab12b27322ac6f3945168db80e50713158d341534573632b148c3f682314c7a32fbdc0f
7
- data.tar.gz: edef5e258984bdd78e2a195ad0434df645d13a8c8c4a84254ea9689b7ede1d1aaa6b0e1fad0a2e0ed87c415e1219f4406991411e8bb7f7dfc93b66a6f672ea4a
6
+ metadata.gz: c624e3c088c6bf3d19e10a45708a376baffb539911f8a0a7f984f2fae763f3e4a746e9d2a7f70f68944d24423d6969a7c50f08d3300fc45ac3c520608f403542
7
+ data.tar.gz: 953765a6b3bf55d8b8dbd85a105469007f107238773562543f8ffc7c97104a6b6529dcbb4580addda3c997ce2036d056887ba72ec103f24a95d0cfb7061a86fa
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cm-admin (1.5.6)
4
+ cm-admin (1.5.9)
5
5
  caxlsx_rails
6
6
  cocoon (~> 1.2.15)
7
7
  csv-importer (~> 0.8.2)
@@ -245,7 +245,7 @@ GEM
245
245
  websocket-driver (0.7.6)
246
246
  websocket-extensions (>= 0.1.0)
247
247
  websocket-extensions (0.1.5)
248
- zeitwerk (2.6.14)
248
+ zeitwerk (2.6.15)
249
249
 
250
250
  PLATFORMS
251
251
  arm64-darwin-20
@@ -28,12 +28,6 @@ $(document).on(
28
28
 
29
29
  $(document).on("click", ".row-action-cell", function (e) {
30
30
  e.stopPropagation();
31
- if ($(this).hasClass("opacity-1")) {
32
- $(".row-action-cell").removeClass("opacity-1");
33
- } else {
34
- $(".row-action-cell").removeClass("opacity-1");
35
- $(this).addClass("opacity-1");
36
- }
37
31
  if ($(this).find(".table-export-popup").hasClass("hidden")) {
38
32
  return $(this).find(".table-export-popup").removeClass("hidden");
39
33
  } else {
@@ -41,6 +35,10 @@ $(document).on("click", ".row-action-cell", function (e) {
41
35
  }
42
36
  });
43
37
 
38
+ $(document).on("mouseleave", ".row-action-cell", function () {
39
+ $(this).find(".table-export-popup").addClass("hidden");
40
+ });
41
+
44
42
  $(document).on("click", ".drawer-btn", function (e) {
45
43
  e.stopPropagation();
46
44
  var drawer_el = $(this).parent().closest(".drawer").find(".cm-drawer");
@@ -16,16 +16,15 @@
16
16
  border-radius: $radius-4;
17
17
  z-index: 1;
18
18
  &.table-export-popup {
19
- top: 40px;
20
- right: 30px;
19
+ top: 36px;
20
+ right: 40px;
21
21
  width: 156px;
22
22
  padding: 8px 0;
23
- animation: fadeIn .2s ease-in-out;
24
23
  .popup-option {
25
24
  padding: 8px 16px;
26
25
  @include font($size: $t4-text, $color: $primary-text-clr);
27
26
  line-height: 22px;
28
- transition: all .2s linear;
27
+ transition: all 0.2s linear;
29
28
  cursor: pointer;
30
29
  &:hover {
31
30
  background-color: $grey-lighter-clr;
@@ -34,6 +33,14 @@
34
33
  margin-right: 8px;
35
34
  }
36
35
  }
36
+ button {
37
+ width: 100%;
38
+ margin: 0;
39
+ padding: 0;
40
+ background: transparent;
41
+ border: none;
42
+ text-align: left;
43
+ }
37
44
  }
38
45
  }
39
46
 
@@ -67,15 +67,21 @@
67
67
  }
68
68
  }
69
69
 
70
+ [data-field-type="action-cell-th"] {
71
+ min-width: 60px;
72
+ max-width: 60px;
73
+ }
74
+
70
75
  tbody {
71
76
  tr {
72
77
  border-bottom: 1px solid var(--bs-border-color);
73
78
  &:hover {
74
- .row-action-cell {
79
+ .row-action-tool {
75
80
  visibility: visible;
76
81
  }
77
82
  }
78
83
  }
84
+
79
85
  td {
80
86
  font-size: $t4-text;
81
87
  min-width: 120px;
@@ -101,10 +107,11 @@
101
107
  max-width: inherit;
102
108
  min-width: inherit;
103
109
  padding: 4px;
104
- background: $gradient-one;
105
- visibility: hidden;
106
110
  z-index: 3 !important;
111
+ background: transparent;
107
112
  .row-action-tool {
113
+ visibility: hidden;
114
+ position: relative;
108
115
  .popup-card {
109
116
  .popup-option {
110
117
  a {
@@ -39,6 +39,7 @@ module CmAdmin
39
39
  else
40
40
  format.html { render '/cm_admin/main/' + action_name }
41
41
  end
42
+ format.json { render json: @ar_object }
42
43
  end
43
44
  end
44
45
 
@@ -34,7 +34,7 @@
34
34
  - @model.available_fields[:index].each do |column|
35
35
  - if column.display_if.call(Current.user) && column.viewable
36
36
  th data-field-type="#{column.field_type}" = column.header
37
- th
37
+ th data-field-type='action-cell-th'
38
38
  tbody
39
39
  - @ar_object.data.each do |ar_object|
40
40
  tr.body-row
@@ -1,3 +1,3 @@
1
1
  module CmAdmin
2
- VERSION = '1.5.7'
2
+ VERSION = '1.5.9'
3
3
  end
@@ -126,16 +126,17 @@ module CmAdmin
126
126
  end
127
127
 
128
128
  def set_form_with_sections(resource, entities, url, method)
129
- polymorphic_name, associated_id, associated_class = extract_referrer_query_params
130
- form_for(resource, url: url, method: method, html: { class: "cm_#{resource.class.name.downcase}_form" } ) do |form_obj|
129
+ url_with_query_params = extract_query_params(url)
130
+
131
+ form_for(resource, url: url_with_query_params || url, method: method, html: { class: "cm_#{resource.class.name.downcase}_form" } ) do |form_obj|
131
132
  if params[:referrer]
132
133
  concat form_obj.text_field "referrer", class: "normal-input", hidden: true, value: params[:referrer], name: 'referrer'
133
134
  end
134
- if params[:polymorphic_name].present? || polymorphic_name.present?
135
- concat form_obj.text_field ( params[:polymorphic_name] || polymorphic_name ) + '_type', class: "normal-input", hidden: true, value: ( params[:associated_class] || associated_class ).classify
136
- concat form_obj.text_field ( params[:polymorphic_name] || polymorphic_name ) + '_id', class: "normal-input", hidden: true, value: ( params[:associated_id] || associated_id )
137
- elsif (params[:associated_class] && params[:associated_id] || associated_id.present? && associated_class.present? )
138
- concat form_obj.text_field ( params[:associated_class] || associated_class ) + '_id', class: "normal-input", hidden: true, value: ( params[:associated_id] || associated_id )
135
+ if params[:polymorphic_name].present?
136
+ concat form_obj.text_field params[:polymorphic_name] + '_type', class: "normal-input", hidden: true, value: params[:associated_class].classify
137
+ concat form_obj.text_field params[:polymorphic_name] + '_id', class: "normal-input", hidden: true, value: params[:associated_id]
138
+ elsif params[:associated_class] && params[:associated_id]
139
+ concat form_obj.text_field params[:associated_class] + '_id', class: "normal-input", hidden: true, value: params[:associated_id]
139
140
  end
140
141
 
141
142
  concat split_form_into_section(resource, form_obj, entities)
@@ -145,18 +146,16 @@ module CmAdmin
145
146
  end
146
147
 
147
148
 
148
- def extract_referrer_query_params
149
- uri = URI.parse(request.referrer)
150
-
151
- return unless uri.query.present?
152
-
153
- query_params = CGI.parse(uri.query)
149
+ def extract_query_params(url)
150
+ query_params = {}
151
+ if params[:polymorphic_name].present? || params[:associated_id].present? && params[:associated_class].present?
152
+ query_params[:polymorphic_name] = params[:polymorphic_name]
153
+ query_params[:associated_id] = params[:associated_id]
154
+ query_params[:associated_class] = params[:associated_class]
155
+ query_params[:referrer] = params[:referrer] if params[:referrer].present?
154
156
 
155
- polymorphic_name = query_params['polymorphic_name'].first
156
- associated_id = query_params['associated_id'].first
157
- associated_class = query_params['associated_class'].first
158
-
159
- return polymorphic_name, associated_id, associated_class
157
+ return url + '?' + query_params.to_query unless query_params.empty?
158
+ end
160
159
  end
161
160
  end
162
161
  end
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: 1.5.7
4
+ version: 1.5.9
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: 2024-05-30 00:00:00.000000000 Z
13
+ date: 2024-06-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: caxlsx_rails
@@ -498,7 +498,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
498
498
  - !ruby/object:Gem::Version
499
499
  version: '0'
500
500
  requirements: []
501
- rubygems_version: 3.5.3
501
+ rubygems_version: 3.2.3
502
502
  signing_key:
503
503
  specification_version: 4
504
504
  summary: CmAdmin is a robust gem designed to assist in creating admin panels for Rails