cm-admin 1.5.42 → 1.5.44

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: 25d1608feb2a0f90e9e8e8202d8898e511a1e1bbb4bc463e0a327190eeedb27a
4
- data.tar.gz: 7a2ccc290b1545db664634cb915f81a8dca27630c024e38cbbb9fbf1898cee72
3
+ metadata.gz: 063a8dffa41719953d125e6fddb24a3e59f3869ba6a82da090b50aaee5a0d495
4
+ data.tar.gz: 470c4ffbeff36d4bdbc77af410430b5861eac385b5848536d4796eaa480a4a9f
5
5
  SHA512:
6
- metadata.gz: 15783cf2216b6390a976eeacc314f5a89b0b696ee777648c2e8bcd9e58fff27e625b1b5f29336d0ac31327833e148b5fb8c563b984df79e1e8d5c321ba27b23a
7
- data.tar.gz: 2d3672c631061c354c3e2b72589ceb8b4e5d42f81b3efd9eed9f8b55a743336d434c4ea826bd3a66c3befb11bc770a8c647ddf879c9b86fa1c10296f4c2d265f
6
+ metadata.gz: a3e2798dcfc91f39751010f3956d033ceb852a23ab3bc0b0b992d8f64c2679cb3330385055c519c719083e3c7ee9b5c911abd2cbff8a879205caad2e4eb8b415
7
+ data.tar.gz: 393ebc8dd097f9b06f837289e86dba708cce6e21721050354fffeb5732b32e6bfd8cc8229df82aec6bca2a8d0ff5285eff1d254f0f5f4dfdbb251fd9fc450e4f
@@ -1,6 +1,11 @@
1
1
  name: Deploy Yard Docs
2
2
 
3
3
  on:
4
+ workflow_run:
5
+ workflows:
6
+ - Bump Gem
7
+ types:
8
+ - completed
4
9
  workflow_dispatch:
5
10
 
6
11
  jobs:
@@ -15,7 +20,7 @@ jobs:
15
20
  - name: Install Yard gem
16
21
  run: gem install yard
17
22
  - name: Build Yard Docs
18
- run: yardoc lib/cm_admin/models/dsl_method.rb
23
+ run: yardoc
19
24
  - name: Upload artifact
20
25
  uses: actions/upload-pages-artifact@v1
21
26
  with:
data/.yardopts ADDED
@@ -0,0 +1 @@
1
+ lib/cm_admin/models/dsl_method.rb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cm-admin (1.5.42)
4
+ cm-admin (1.5.44)
5
5
  caxlsx_rails
6
6
  cocoon (~> 1.2.15)
7
7
  csv-importer (~> 0.8.2)
@@ -42,6 +42,10 @@
42
42
 
43
43
  .field-label {
44
44
  @extend .form-label;
45
+ &.required-label::after {
46
+ content: " *";
47
+ color: $red;
48
+ }
45
49
  }
46
50
 
47
51
  .field-control {
@@ -1,7 +1,7 @@
1
1
  .import-page
2
2
  .import-page__header
3
3
  h1.header-title #{@model.name} Import
4
- p.header-description To import #{@model.name.underscore} data using the form below.
4
+ p.header-description To import #{@model.name.titleize.downcase} data using the form below.
5
5
  .import-page__body
6
6
  h6.body-title Import data
7
7
  - if flash[:notice]
@@ -15,7 +15,7 @@
15
15
  a.btn-secondary href="#{cm_admin.send(:"#{@model.name.underscore}_import_path")}" Import new data
16
16
  / button.cta-btn.ms-2 Back to Page_Name
17
17
  - else
18
- = simple_form_for(FileImport.new, url: "/admin/#{@model.ar_model.table_name}/import", method: :post, html: { class: "csv-import-form" }) do |f|
18
+ = simple_form_for(FileImport.new, url: "#{cm_admin.send(:"#{@model.name.underscore}_import_path")}", method: :post, html: { class: "csv-import-form" }) do |f|
19
19
  .form-card
20
20
  = f.input :associated_model_name, as: :hidden, placeholder: 'Enter product title', label: false, input_html: { value: @model.name }
21
21
  = f.input :import_file, as: :file, placeholder: 'Enter product title', label: false
@@ -1,3 +1,3 @@
1
1
  module CmAdmin
2
- VERSION = '1.5.42'
2
+ VERSION = '1.5.44'
3
3
  end
@@ -1,7 +1,7 @@
1
1
  module CmAdmin
2
2
  module ViewHelpers
3
3
  module FormFieldHelper
4
- def input_field_for_column(form_obj, cm_field)
4
+ def input_field_for_column(form_obj, cm_field, is_required: nil)
5
5
  return unless cm_field.display_if.call(form_obj.object)
6
6
 
7
7
  value = if cm_field.helper_method
@@ -12,7 +12,7 @@ module CmAdmin
12
12
  form_obj.object.send(cm_field.field_name)
13
13
  end
14
14
  # value = cm_field.helper_method ? send(cm_field.helper_method, form_obj.object, cm_field.field_name) : form_obj.object.send(cm_field.field_name)
15
- is_required = form_obj.object._validators[cm_field.field_name].map(&:kind).include?(:presence)
15
+ is_required = form_obj.object._validators[cm_field.field_name].map(&:kind).include?(:presence) if is_required.nil?
16
16
  required_class = is_required ? 'required' : ''
17
17
  target_action = @model.available_actions.select { |x| x.name == cm_field.target[:action_name].to_s }.first if cm_field.target.present?
18
18
  send("cm_#{cm_field.input_type}_field", form_obj, cm_field, value, required_class, target_action, cm_field.ajax_url)
@@ -106,17 +106,18 @@ module CmAdmin
106
106
 
107
107
  def set_form_field(resource, form_obj, field)
108
108
  return unless field.display_if.call(form_obj.object)
109
+ is_required = form_obj.object._validators[field.field_name].map(&:kind).include?(:presence)
109
110
 
110
111
  content_tag(:div, class: field.col_size ? "col-#{field.col_size}" : 'col') do
111
112
  if field.input_type.eql?(:hidden)
112
- concat input_field_for_column(form_obj, field)
113
+ concat input_field_for_column(form_obj, field, is_required:)
113
114
  else
114
115
  concat(content_tag(:div, class: "form-field #{field.disabled ? 'disabled' : ''}") do
115
116
  if field.label && %i[check_box switch].exclude?(field.input_type)
116
- concat form_obj.label field.label, field.label, class: 'field-label'
117
+ concat form_obj.label field.label, field.label, class: "field-label #{is_required ? 'required-label' : ''}"
117
118
  concat tag.br
118
119
  end
119
- concat input_field_for_column(form_obj, field)
120
+ concat input_field_for_column(form_obj, field, is_required:)
120
121
  concat tag.small field.helper_text, class: 'form-text text-muted' if field.helper_text.present?
121
122
  concat tag.p resource.errors[field.field_name].first if resource.errors[field.field_name].present?
122
123
  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.42
4
+ version: 1.5.44
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: exe
16
16
  cert_chain: []
17
- date: 2024-08-05 00:00:00.000000000 Z
17
+ date: 2024-08-07 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: caxlsx_rails
@@ -185,6 +185,7 @@ files:
185
185
  - ".stylelintrc.json"
186
186
  - ".travis.yml"
187
187
  - ".vscode/settings.json"
188
+ - ".yardopts"
188
189
  - CNAME
189
190
  - CODE_OF_CONDUCT.md
190
191
  - Gemfile