cm-admin 1.5.10 → 1.5.11

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: 13710f4822ce508ecf0fa69b136368cfc21c2d381414fa002e7e26217ccafc03
4
- data.tar.gz: 658aec550f94375067dac5e27c4805eb9d9fcae7b201c90e55bd04ee35818c07
3
+ metadata.gz: 8d46388e08f654f888bb33807afaa1eccf7911831f5a47aec2c2ca8051c1e8ea
4
+ data.tar.gz: 79be71a21dc68d7118465c6abbddbf500d68744564d3ea2a002af138e065a41c
5
5
  SHA512:
6
- metadata.gz: 653d760b396e835a65129ecd591664cc01ae343921aa36a831f0150503530b803deb5305c85b204fc5634b3d449815c55362b2d3bf281bcf03594db500dd5dd1
7
- data.tar.gz: bb5a3a55e20b0a020039bac2e45498f225224ac5ee249a9646fd9da1b1e00aeb322d3716a16414f19049a06d6423baffa22a6fc48b2c80a238b5c23e062eb8a1
6
+ metadata.gz: 8fc060fb6bc652c9e3b6abec4d55724aec3af6bb95d37e6827f9ce8e0d71ecce427a96abda152a39c5e3be9c344a3c9f74bf9d4c76c375fe228b2fb9fd779dca
7
+ data.tar.gz: d67ce654a076de309bdb53bf8fd62e90ac839f144ac9e8c2861be231b87db122fad71f65536a19e09ff018c81ae5a4048a1f38769d1fdab776d0885a237d44ec
@@ -19,6 +19,10 @@ jobs:
19
19
  rubocop_extensions: rubocop-rails:2.14.2
20
20
  github_token: ${{ secrets.GITHUB_TOKEN }}
21
21
  reporter: github-pr-check # Possible values are github-pr-check, github-pr-review
22
+ - name: reek
23
+ uses: reviewdog/action-reek@v1
24
+ with:
25
+ reek_version: 6.1.1
22
26
  - uses: actions/checkout@v3
23
27
  - name: stylelint
24
28
  uses: reviewdog/action-stylelint@v1
@@ -1,4 +1,5 @@
1
- name: Bump Gem
1
+ # .github/workflows/push_gem.yml
2
+ name: Push Gem
2
3
 
3
4
  on:
4
5
  workflow_dispatch:
@@ -17,8 +18,8 @@ permissions:
17
18
  contents: read
18
19
 
19
20
  jobs:
20
- build:
21
- name: Build gem
21
+ push:
22
+ name: Push gem to RubyGems.org
22
23
  runs-on: ubuntu-latest
23
24
 
24
25
  permissions:
@@ -36,6 +37,8 @@ jobs:
36
37
  git config --global user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com"
37
38
  git config --global user.name "$(gh api /users/${GITHUB_ACTOR} | jq .name -r)"
38
39
  git config -l
40
+
41
+
39
42
  - name: Set up Ruby
40
43
  uses: ruby/setup-ruby@v1
41
44
  with:
@@ -45,48 +48,14 @@ jobs:
45
48
  - name: Install the gem-release
46
49
  run: gem install gem-release
47
50
 
48
- - name: Bump the gem
49
- run: gem bump ${{ github.events.inputs.bump_type }}
50
-
51
51
  - name: Remove lock on bundle
52
52
  run: bundle config set frozen false
53
53
 
54
- - name: Bundle Install
55
- run: bundle install
56
-
57
- - name: Git Add files
58
- run: git add Gemfile.lock
59
-
60
- - name: Git Commit
61
- run: git commit -m "Add bundle files"
62
-
63
- - name: Push the new version
64
- run: git push origin ${{ github.ref_name }}
65
-
66
- release:
67
-
68
- name: Release gem
69
- runs-on: ubuntu-latest
70
- needs: build
71
- permissions:
72
- id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
73
- contents: write # IMPORTANT: this permission is required for `rake release` to push the release tag
74
-
75
- steps:
76
- - uses: actions/checkout@v4
77
-
78
- - name: Git Pull
79
- run: git pull
80
-
81
- - name: Set up Ruby
82
- uses: ruby/setup-ruby@v1
83
- with:
84
- ruby-version: ruby
85
- bundler-cache: true
54
+ - name: Bump the gem
55
+ run: gem bump ${{ github.events.inputs.bump_type }}
86
56
 
87
- - name: Remove lock on bundle
88
- run: bundle config set frozen false
57
+ - name: Commit the new version
58
+ run: git push
89
59
 
90
- - uses: rubygems/release-gem@v1
91
- with:
92
- await-release: false
60
+ # Release
61
+ - uses: rubygems/release-gem@v1
data/.reek.yml ADDED
@@ -0,0 +1,9 @@
1
+ detectors:
2
+ IrresponsibleModule:
3
+ enabled: false
4
+ UncommunicativeVariableName:
5
+ enabled: true
6
+ accept:
7
+ - e
8
+ TooManyStatements:
9
+ enabled: false
data/Gemfile CHANGED
@@ -8,9 +8,9 @@ gem 'rspec', '~> 3.0'
8
8
  gem 'slim'
9
9
 
10
10
  group :development do
11
- gem 'rubocop', require: false
12
- gem 'rubocop-performance', require: false
13
- gem 'rubocop-rails', require: false
11
+ gem 'rubocop', '~> 1.35.1', require: false
12
+ gem 'rubocop-rails', '~> 2.15.2', require: false
13
+ gem 'rubocop-performance', '~> 1.14.3', require: false
14
14
  end
15
15
  # Specify your gem's dependencies in cm_admin.gemspec
16
16
  gemspec
data/Gemfile.lock CHANGED
@@ -98,7 +98,7 @@ GEM
98
98
  cocoon (1.2.15)
99
99
  coercible (1.0.0)
100
100
  descendants_tracker (~> 0.0.1)
101
- concurrent-ruby (1.3.3)
101
+ concurrent-ruby (1.2.2)
102
102
  crass (1.0.6)
103
103
  csv-importer (0.8.2)
104
104
  virtus
@@ -110,15 +110,14 @@ GEM
110
110
  globalid (1.2.1)
111
111
  activesupport (>= 6.1)
112
112
  htmlentities (4.3.4)
113
- i18n (1.14.5)
113
+ i18n (1.14.1)
114
114
  concurrent-ruby (~> 1.0)
115
115
  ice_nine (0.11.2)
116
116
  importmap-rails (2.0.1)
117
117
  actionpack (>= 6.0.0)
118
118
  activesupport (>= 6.0.0)
119
119
  railties (>= 6.0.0)
120
- json (2.7.2)
121
- language_server-protocol (3.17.0.3)
120
+ json (2.6.2)
122
121
  local_time (2.1.0)
123
122
  loofah (2.22.0)
124
123
  crass (~> 1.0.2)
@@ -132,7 +131,7 @@ GEM
132
131
  method_source (1.1.0)
133
132
  mini_mime (1.1.5)
134
133
  mini_portile2 (2.8.7)
135
- minitest (5.24.0)
134
+ minitest (5.18.1)
136
135
  net-imap (0.4.11)
137
136
  date
138
137
  net-protocol
@@ -151,14 +150,13 @@ GEM
151
150
  nokogiri (1.16.5-x86_64-linux)
152
151
  racc (~> 1.4)
153
152
  pagy (4.11.0)
154
- parallel (1.25.1)
155
- parser (3.3.3.0)
153
+ parallel (1.22.1)
154
+ parser (3.1.2.1)
156
155
  ast (~> 2.4.1)
157
- racc
158
156
  pundit (2.2.0)
159
157
  activesupport (>= 3.0.0)
160
158
  racc (1.8.0)
161
- rack (2.2.9)
159
+ rack (2.2.7)
162
160
  rack-proxy (0.7.7)
163
161
  rack
164
162
  rack-test (2.1.0)
@@ -193,9 +191,8 @@ GEM
193
191
  zeitwerk (~> 2.5)
194
192
  rainbow (3.1.1)
195
193
  rake (12.3.3)
196
- regexp_parser (2.9.2)
197
- rexml (3.3.0)
198
- strscan
194
+ regexp_parser (2.6.1)
195
+ rexml (3.2.5)
199
196
  rspec (3.10.0)
200
197
  rspec-core (~> 3.10.0)
201
198
  rspec-expectations (~> 3.10.0)
@@ -209,34 +206,31 @@ GEM
209
206
  diff-lcs (>= 1.2.0, < 2.0)
210
207
  rspec-support (~> 3.10.0)
211
208
  rspec-support (3.10.2)
212
- rubocop (1.64.1)
209
+ rubocop (1.35.1)
213
210
  json (~> 2.3)
214
- language_server-protocol (>= 3.17.0)
215
211
  parallel (~> 1.10)
216
- parser (>= 3.3.0.2)
212
+ parser (>= 3.1.2.1)
217
213
  rainbow (>= 2.2.2, < 4.0)
218
214
  regexp_parser (>= 1.8, < 3.0)
219
215
  rexml (>= 3.2.5, < 4.0)
220
- rubocop-ast (>= 1.31.1, < 2.0)
216
+ rubocop-ast (>= 1.20.1, < 2.0)
221
217
  ruby-progressbar (~> 1.7)
222
- unicode-display_width (>= 2.4.0, < 3.0)
223
- rubocop-ast (1.31.3)
224
- parser (>= 3.3.1.0)
225
- rubocop-performance (1.21.1)
226
- rubocop (>= 1.48.1, < 2.0)
227
- rubocop-ast (>= 1.31.1, < 2.0)
228
- rubocop-rails (2.25.0)
218
+ unicode-display_width (>= 1.4.0, < 3.0)
219
+ rubocop-ast (1.23.0)
220
+ parser (>= 3.1.1.0)
221
+ rubocop-performance (1.14.3)
222
+ rubocop (>= 1.7.0, < 2.0)
223
+ rubocop-ast (>= 0.4.0)
224
+ rubocop-rails (2.15.2)
229
225
  activesupport (>= 4.2.0)
230
226
  rack (>= 1.1)
231
- rubocop (>= 1.33.0, < 2.0)
232
- rubocop-ast (>= 1.31.1, < 2.0)
233
- ruby-progressbar (1.13.0)
227
+ rubocop (>= 1.7.0, < 2.0)
228
+ ruby-progressbar (1.11.0)
234
229
  rubyzip (2.3.2)
235
230
  semantic_range (3.0.0)
236
231
  slim (4.1.0)
237
232
  temple (>= 0.7.6, < 0.9)
238
233
  tilt (>= 2.0.6, < 2.1)
239
- strscan (3.1.0)
240
234
  temple (0.8.2)
241
235
  thor (1.3.1)
242
236
  thread_safe (0.3.6)
@@ -244,7 +238,7 @@ GEM
244
238
  timeout (0.4.1)
245
239
  tzinfo (2.0.6)
246
240
  concurrent-ruby (~> 1.0)
247
- unicode-display_width (2.5.0)
241
+ unicode-display_width (2.3.0)
248
242
  virtus (2.0.0)
249
243
  axiom-types (~> 0.1)
250
244
  coercible (~> 1.0)
@@ -273,9 +267,9 @@ DEPENDENCIES
273
267
  pundit
274
268
  rake (~> 12.0)
275
269
  rspec (~> 3.0)
276
- rubocop
277
- rubocop-performance
278
- rubocop-rails
270
+ rubocop (~> 1.35.1)
271
+ rubocop-performance (~> 1.14.3)
272
+ rubocop-rails (~> 2.15.2)
279
273
  slim
280
274
 
281
275
  BUNDLED WITH
@@ -4,10 +4,7 @@
4
4
  p.section-heading = section.section_name
5
5
  .card
6
6
  .card-body
7
- - if !section.section_fields.empty?
8
- - section.section_fields.each do |field|
9
- = show_field(@ar_object, field)
10
- - if section.rows.present?
11
- = show_rows(@ar_object, section.rows)
7
+ - section.section_fields.each do |field|
8
+ = show_field(@ar_object, field)
12
9
  - section.nested_table_fields.each do |nested_field|
13
- = render partial: 'cm_admin/main/nested_table_section', locals: { nested_field: nested_field, ar_object: @ar_object }
10
+ = render partial: 'cm_admin/main/nested_table_section', locals: { nested_field: nested_field, ar_object: @ar_object }
@@ -6,7 +6,7 @@ module CmAdmin
6
6
  include Utils::Helpers
7
7
 
8
8
  attr_accessor :field_name, :label, :header, :input_type, :collection, :disabled, :helper_method,
9
- :placeholder, :display_if, :html_attrs, :target, :col_size, :ajax_url
9
+ :placeholder, :display_if, :html_attr, :target, :col_size, :ajax_url
10
10
 
11
11
  VALID_INPUT_TYPES = %i[
12
12
  integer decimal string single_select multi_select date date_time text
@@ -28,7 +28,7 @@ module CmAdmin
28
28
  self.disabled = lambda { |arg| return false } if display_if.nil?
29
29
  self.label = self.field_name.to_s.titleize
30
30
  self.input_type = :string
31
- self.html_attrs = {}
31
+ self.html_attr = {}
32
32
  self.target = {}
33
33
  self.col_size = nil
34
34
  end
@@ -27,14 +27,6 @@ module CmAdmin
27
27
  end
28
28
  end
29
29
 
30
- def field(field_name, options={})
31
- if @current_nested_field
32
- @current_nested_field.fields << CmAdmin::Models::Field.new(field_name, options)
33
- else
34
- @row_fields << CmAdmin::Models::Field.new(field_name, options)
35
- end
36
- end
37
-
38
30
  def cm_section(section_name, col_size: nil, display_if: nil, &block)
39
31
  @sections << CmAdmin::Models::Section.new(section_name, @current_action, @model, display_if, col_size, &block)
40
32
  end
@@ -45,4 +37,4 @@ module CmAdmin
45
37
  end
46
38
  end
47
39
  end
48
- end
40
+ end
@@ -1,3 +1,3 @@
1
1
  module CmAdmin
2
- VERSION = '1.5.10'
2
+ VERSION = '1.5.11'
3
3
  end
@@ -9,23 +9,6 @@ module CmAdmin
9
9
  end
10
10
  end
11
11
 
12
- def show_rows(ar_object, rows, col_size: 3)
13
- rows.map do |row|
14
- content_tag(:div, class: 'row') do
15
- row.row_fields.map do |field|
16
- next unless field.display_if.call(ar_object)
17
-
18
- content_tag(:div, class: "col-#{col_size}") do
19
- content_tag(:div, class: "card-info") do
20
- concat show_field_label(ar_object, field)
21
- concat value_with_prefix_and_suffix(ar_object, field)
22
- end
23
- end
24
- end.compact.join.html_safe
25
- end
26
- end.join.html_safe
27
- end
28
-
29
12
  def show_field_label(ar_object, field)
30
13
  content_tag(:div, class: "card-info__label") do
31
14
  field_label = if field.label.present?
@@ -88,7 +71,7 @@ module CmAdmin
88
71
  when :tag
89
72
  tag_class = field.tag_class.dig("#{ar_object.send(field.field_name.to_s)}".to_sym).to_s
90
73
  content_tag :span, class: "status-tag #{tag_class}" do
91
- ar_object.send(field.field_name).to_s.titleize.upcase
74
+ ar_object.send(field.field_name).to_s.upcase
92
75
  end
93
76
  when :attachment
94
77
  show_attachment_value(ar_object, field)
@@ -19,73 +19,57 @@ module CmAdmin
19
19
 
20
20
  def cm_integer_field(form_obj, cm_field, value, required_class, _target_action, _ajax_url)
21
21
  form_obj.text_field cm_field.field_name,
22
- merge_wrapper_options(
23
- {
24
- class: "field-control #{required_class}",
25
- disabled: cm_field.disabled.call(form_obj.object),
26
- value: value,
27
- placeholder: cm_field.placeholder,
28
- data: { behaviour: 'integer-only' }
29
- }, cm_field.html_attrs )
22
+ class: "field-control #{required_class}",
23
+ disabled: cm_field.disabled.call(form_obj.object),
24
+ value: value,
25
+ placeholder: cm_field.placeholder,
26
+ data: { behaviour: 'integer-only' }
30
27
  end
31
28
 
32
29
  def cm_decimal_field(form_obj, cm_field, value, required_class, _target_action, _ajax_url)
33
30
  form_obj.text_field cm_field.field_name,
34
- merge_wrapper_options({
35
31
  class: "field-control #{required_class}",
36
32
  disabled: cm_field.disabled.call(form_obj.object),
37
33
  value: value,
38
34
  placeholder: cm_field.placeholder,
39
35
  data: { behaviour: 'decimal-only' }
40
- }, cm_field.html_attrs )
41
36
  end
42
37
 
43
38
  def cm_string_field(form_obj, cm_field, value, required_class, _target_action, _ajax_url)
44
39
  form_obj.text_field cm_field.field_name,
45
- merge_wrapper_options(
46
- {
47
- class: "field-control #{required_class}",
48
- disabled: cm_field.disabled.call(form_obj.object),
49
- value: value,
50
- placeholder: cm_field.placeholder
51
- }, cm_field.html_attrs )
40
+ class: "field-control #{required_class}",
41
+ disabled: cm_field.disabled.call(form_obj.object),
42
+ value: value,
43
+ placeholder: cm_field.placeholder
52
44
  end
53
45
 
54
46
  def cm_custom_string_field(form_obj, cm_field, value, required_class, _target_action)
55
- text_field_tag cm_field.html_attrs[:name] || cm_field.field_name,
56
- merge_wrapper_options(
57
- {
58
- value: value,
59
- class: "field-control #{required_class}",
60
- disabled: cm_field.disabled.call(form_obj.object),
61
- placeholder: cm_field.placeholder
62
- }, cm_field.html_attrs )
47
+ text_field_tag cm_field.html_attr[:name] || cm_field.field_name,
48
+ value, class: "field-control #{required_class}",
49
+ disabled: cm_field.disabled.call(form_obj.object),
50
+ placeholder: cm_field.placeholder
63
51
  end
64
52
 
65
53
  def cm_single_select_field(form_obj, cm_field, value, required_class, target_action, ajax_url)
66
54
  class_name = ajax_url.present? ? 'select-2-ajax' : 'select-2'
67
55
  form_obj.select cm_field.field_name, options_for_select(select_collection_value(form_obj.object, cm_field), form_obj.object.send(cm_field.field_name)),
68
- {include_blank: cm_field.placeholder},
69
- merge_wrapper_options(
70
- {
71
- class: "field-control #{required_class} #{class_name}",
72
- disabled: cm_field.disabled.call(form_obj.object),
73
- data: {
74
- field_name: cm_field.field_name,
75
- field_type: 'linked-field',
76
- target_action: target_action&.name,
77
- target_url: target_action&.name ? cm_admin.send("#{@model.name.underscore}_#{target_action&.name}_path") : '',
78
- ajax_url: ajax_url
79
- }
80
- }, cm_field.html_attrs )
56
+ { include_blank: cm_field.placeholder },
57
+ class: "field-control #{required_class} #{class_name}",
58
+ disabled: cm_field.disabled.call(form_obj.object),
59
+ data: {
60
+ field_name: cm_field.field_name,
61
+ field_type: 'linked-field',
62
+ target_action: target_action&.name,
63
+ target_url: target_action&.name ? cm_admin.send("#{@model.name.underscore}_#{target_action&.name}_path") : '',
64
+ ajax_url: ajax_url
65
+ }
81
66
  end
82
67
 
83
68
  def cm_custom_single_select_field(form_obj, cm_field, value, required_class, target_action, _ajax_url)
84
- select_tag cm_field.html_attrs[:name] || cm_field.field_name,
69
+ select_tag cm_field.html_attr[:name] || cm_field.field_name,
85
70
  options_for_select(select_collection_value(form_obj.object, cm_field)),
86
- {include_blank: cm_field.placeholder}
87
- merge_wrapper_options(
88
71
  {
72
+ include_blank: cm_field.placeholder,
89
73
  class: "field-control #{required_class} select-2",
90
74
  disabled: cm_field.disabled.call(form_obj.object),
91
75
  data: {
@@ -94,94 +78,66 @@ module CmAdmin
94
78
  target_action: target_action&.name,
95
79
  target_url: target_action&.name ? cm_admin.send("#{@model.name.underscore}_#{target_action&.name}_path") : ''
96
80
  }
97
- }, cm_field.html_attrs )
81
+ }
98
82
  end
99
83
 
100
84
  def cm_multi_select_field(form_obj, cm_field, value, required_class, target_action, _ajax_url)
101
85
  form_obj.select cm_field.field_name,
102
86
  options_for_select(select_collection_value(form_obj.object, cm_field), form_obj.object.send(cm_field.field_name)),
103
- {include_blank: cm_field.placeholder}
104
- merge_wrapper_options(
105
- {
106
- class: "field-control #{required_class} select-2",
107
- disabled: cm_field.disabled.call(form_obj.object), multiple: true
108
- }, cm_field.html_attrs )
87
+ { include_blank: cm_field.placeholder },
88
+ class: "field-control #{required_class} select-2",
89
+ disabled: cm_field.disabled.call(form_obj.object), multiple: true
109
90
  end
110
91
 
111
92
  def cm_date_field(form_obj, cm_field, value, required_class, _target_action, _ajax_url)
112
93
  form_obj.text_field cm_field.field_name,
113
- merge_wrapper_options(
114
- {
115
94
  class: "field-control #{required_class}",
116
95
  disabled: cm_field.disabled.call(form_obj.object),
117
96
  value: value&.strftime('%d-%m-%Y'),
118
97
  placeholder: cm_field.placeholder,
119
98
  data: { behaviour: 'date-only' }
120
- }, cm_field.html_attrs )
121
99
  end
122
100
 
123
101
  def cm_custom_date_field(form_obj, cm_field, value, required_class, _target_action, _ajax_url)
124
- text_field_tag cm_field.html_attrs[:name] || cm_field.field_name, value&.strftime('%d-%m-%Y'),
125
- merge_wrapper_options(
126
- {
102
+ text_field_tag cm_field.html_attr[:name] || cm_field.field_name, value&.strftime('%d-%m-%Y'),
127
103
  class: "field-control #{required_class}",
128
104
  disabled: cm_field.disabled.call(form_obj.object),
129
105
  value: value&.strftime('%d-%m-%Y'),
130
106
  placeholder: cm_field.placeholder,
131
107
  data: { behaviour: 'date-only' }
132
- }, cm_field.html_attrs )
133
108
  end
134
109
 
135
110
  def cm_date_time_field(form_obj, cm_field, value, required_class, _target_action, _ajax_url)
136
111
  form_obj.text_field cm_field.field_name,
137
- merge_wrapper_options(
138
- {
139
112
  class: "field-control #{required_class}",
140
113
  disabled: cm_field.disabled.call(form_obj.object),
141
114
  value: value,
142
115
  placeholder: cm_field.placeholder,
143
116
  data: { behaviour: 'date-time' }
144
- }, cm_field.html_attrs )
145
117
  end
146
118
 
147
119
  def cm_text_field(form_obj, cm_field, value, required_class, _target_action, _ajax_url)
148
120
  form_obj.text_area cm_field.field_name,
149
- merge_wrapper_options(
150
- {
151
- class: "field-control #{required_class}",
152
- placeholder: cm_field.placeholder
153
- }, cm_field.html_attrs)
121
+ class: "field-control #{required_class}",
122
+ placeholder: cm_field.placeholder
154
123
  end
155
124
 
156
125
  def cm_rich_text_field(form_obj, cm_field, value, required_class, _target_action, _ajax_url)
157
126
  form_obj.rich_text_area cm_field.field_name,
158
- merge_wrapper_options(
159
- {
160
- class: "field-control #{required_class}",
161
- placeholder: cm_field.placeholder
162
- }, cm_field.html_attrs)
127
+ class: "field-control #{required_class}",
128
+ placeholder: cm_field.placeholder
163
129
  end
164
130
 
165
131
  def cm_single_file_upload_field(form_obj, cm_field, _value, required_class, _target_action, _ajax_url)
166
132
  content_tag(:div) do
167
- concat form_obj.file_field cm_field.field_name,
168
- merge_wrapper_options(
169
- {
170
- class: "field-control #{required_class}",
171
- disabled: cm_field.disabled.call(form_obj.object)
172
- }, cm_field.html_attrs )
133
+ concat form_obj.file_field cm_field.field_name, class: "field-control #{required_class}", disabled: cm_field.disabled.call(form_obj.object)
173
134
  concat attachment_list(form_obj, cm_field, _value, required_class, _target_action)
174
135
  end
175
136
  end
176
137
 
177
138
  def cm_multi_file_upload_field(form_obj, cm_field, _value, required_class, _target_action, _ajax_url)
178
139
  content_tag(:div) do
179
- concat form_obj.file_field cm_field.field_name,
180
- merge_wrapper_options(
181
- {
182
- multiple: true, class: "field-control #{required_class}",
183
- disabled: cm_field.disabled.call(form_obj.object)
184
- }, cm_field.html_attrs )
140
+ concat form_obj.file_field cm_field.field_name, multiple: true, class: "field-control #{required_class}", disabled: cm_field.disabled.call(form_obj.object)
185
141
  concat attachment_list(form_obj, cm_field, _value, required_class, _target_action)
186
142
  end
187
143
  end
@@ -189,7 +145,7 @@ module CmAdmin
189
145
  def attachment_list(form_obj, cm_field, _value, required_class, _target_action)
190
146
  attached = form_obj.object.send(cm_field.field_name)
191
147
  return if defined?(::Paperclip) && attached.instance_of?(::Paperclip::Attachment)
192
-
148
+
193
149
  content_tag(:div) do
194
150
  if attached.class == ActiveStorage::Attached::Many
195
151
  attached.each do |attachment|
@@ -220,11 +176,8 @@ module CmAdmin
220
176
 
221
177
  def cm_hidden_field(form_obj, cm_field, value, required_class, _target_action, _ajax_url)
222
178
  form_obj.hidden_field cm_field.field_name,
223
- merge_wrapper_options(
224
- {
225
- value: value,
226
- name: cm_field.html_attrs[:name] || "#{form_obj.object_name}[#{cm_field.field_name}]"
227
- }, cm_field.html_attrs )
179
+ value: value,
180
+ name: cm_field.html_attr[:name] || "#{form_obj.object_name}[#{cm_field.field_name}]"
228
181
  end
229
182
 
230
183
  # Refactor: Collection argument can be removed.
@@ -244,16 +197,15 @@ module CmAdmin
244
197
  format_check_box_array(value, form_obj, cm_field, required_class, target_action)
245
198
  else
246
199
  form_obj.check_box cm_field.field_name,
247
- merge_wrapper_options(
248
- {
249
- class: "cm-checkbox #{required_class} #{target_action.present? ? 'linked-field-request' : ''}",
250
- disabled: cm_field.disabled.call(form_obj.object),
251
- data: {
252
- field_name: cm_field.field_name,
253
- target_action: target_action&.name,
254
- target_url: target_action&.name ? cm_admin.send("#{@model.name.underscore}_#{target_action&.name}_path") : ''
255
- }
256
- }, cm_field.html_attrs )
200
+ {
201
+ class: "cm-checkbox #{required_class} #{target_action.present? ? 'linked-field-request' : ''}",
202
+ disabled: cm_field.disabled.call(form_obj.object),
203
+ data: {
204
+ field_name: cm_field.field_name,
205
+ target_action: target_action&.name,
206
+ target_url: target_action&.name ? cm_admin.send("#{@model.name.underscore}_#{target_action&.name}_path") : ''
207
+ }
208
+ }
257
209
  end
258
210
  end
259
211
 
@@ -275,7 +227,6 @@ module CmAdmin
275
227
  def format_check_box_tag(val, form_obj, cm_field, required_class, target_action)
276
228
  content_tag :div, class: 'cm-radio-tag' do
277
229
  concat form_obj.check_box cm_field.field_name,
278
- merge_wrapper_options(
279
230
  {
280
231
  class: "cm-checkbox #{required_class} #{target_action.present? ? 'linked-field-request' : ''}",
281
232
  disabled: cm_field.disabled.call(form_obj.object),
@@ -284,8 +235,7 @@ module CmAdmin
284
235
  target_action: target_action&.name,
285
236
  target_url: target_action&.name ? cm_admin.send("#{@model.name.underscore}_#{target_action&.name}_path", ':param_1') : ''
286
237
  }
287
- }, cm_field.html_attrs ),
288
- val
238
+ }, val
289
239
  end
290
240
  end
291
241
 
@@ -309,24 +259,6 @@ module CmAdmin
309
259
  concat form_obj.radio_button :level, val, class: 'field-control cm-radio'
310
260
  end
311
261
  end
312
-
313
- def merge_wrapper_options(options, html_attrs)
314
- if html_attrs
315
- options.merge(html_attrs) do |key, oldval, newval|
316
- case key.to_s
317
- when "class"
318
- oldval + " " + newval
319
- when "data", "aria"
320
- oldval.merge(newval)
321
- else
322
- newval
323
- end
324
- end
325
- else
326
- options
327
- end
328
- end
329
-
330
262
  end
331
263
  end
332
264
  end
data/package-lock.json CHANGED
@@ -13650,9 +13650,9 @@
13650
13650
  }
13651
13651
  },
13652
13652
  "node_modules/ws": {
13653
- "version": "8.17.1",
13654
- "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz",
13655
- "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==",
13653
+ "version": "8.13.0",
13654
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz",
13655
+ "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==",
13656
13656
  "dev": true,
13657
13657
  "engines": {
13658
13658
  "node": ">=10.0.0"
data/yarn.lock CHANGED
@@ -7717,9 +7717,9 @@ write-file-atomic@^4.0.2:
7717
7717
  signal-exit "^3.0.7"
7718
7718
 
7719
7719
  ws@^8.4.2:
7720
- version "8.17.1"
7721
- resolved "https://registry.yarnpkg.com/ws/-/ws-8.17.1.tgz#9293da530bb548febc95371d90f9c878727d919b"
7722
- integrity sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==
7720
+ version "8.8.0"
7721
+ resolved "https://registry.npmjs.org/ws/-/ws-8.8.0.tgz"
7722
+ integrity sha512-JDAgSYQ1ksuwqfChJusw1LSJ8BizJ2e/vVu5Lxjq3YvNJNlROv1ui4i+c/kUUrPheBvQl4c5UbERhTwKa6QBJQ==
7723
7723
 
7724
7724
  xtend@^4.0.0, xtend@~4.0.1:
7725
7725
  version "4.0.2"
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cm-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.10
4
+ version: 1.5.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - sajinmp
8
8
  - anbublacky
9
9
  - AdityaTiwari2102
10
- autorequire:
10
+ autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2024-06-21 00:00:00.000000000 Z
13
+ date: 2024-06-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: caxlsx_rails
@@ -168,8 +168,9 @@ files:
168
168
  - ".github/ISSUE_TEMPLATE/config.yml"
169
169
  - ".github/ISSUE_TEMPLATE/feature_request.md"
170
170
  - ".github/workflows/linters.yml"
171
- - ".github/workflows/release-gem.yml"
171
+ - ".github/workflows/push_gem.yml"
172
172
  - ".gitignore"
173
+ - ".reek.yml"
173
174
  - ".rspec"
174
175
  - ".rubocop-https---raw-githubusercontent-com-commutatus-cm-linters-main-rubocop-yml"
175
176
  - ".rubocop.yml"
@@ -483,7 +484,7 @@ licenses:
483
484
  metadata:
484
485
  homepage_uri: https://github.com/commutatus/cm-admin
485
486
  source_code_uri: https://github.com/commutatus/cm-admin
486
- post_install_message:
487
+ post_install_message:
487
488
  rdoc_options: []
488
489
  require_paths:
489
490
  - lib
@@ -498,8 +499,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
498
499
  - !ruby/object:Gem::Version
499
500
  version: '0'
500
501
  requirements: []
501
- rubygems_version: 3.5.11
502
- signing_key:
502
+ rubygems_version: 3.5.13
503
+ signing_key:
503
504
  specification_version: 4
504
505
  summary: CmAdmin is a robust gem designed to assist in creating admin panels for Rails
505
506
  applications