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 +4 -4
- data/.github/workflows/deploy-yard-docs.yml +6 -1
- data/.yardopts +1 -0
- data/Gemfile.lock +1 -1
- data/app/assets/stylesheets/cm_admin/base/form.scss +4 -0
- data/app/views/cm_admin/main/import_form.html.slim +2 -2
- data/lib/cm_admin/version.rb +1 -1
- data/lib/cm_admin/view_helpers/form_field_helper.rb +2 -2
- data/lib/cm_admin/view_helpers/form_helper.rb +4 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 063a8dffa41719953d125e6fddb24a3e59f3869ba6a82da090b50aaee5a0d495
|
4
|
+
data.tar.gz: 470c4ffbeff36d4bdbc77af410430b5861eac385b5848536d4796eaa480a4a9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
.import-page
|
2
2
|
.import-page__header
|
3
3
|
h1.header-title #{@model.name} Import
|
4
|
-
p.header-description To import #{@model.name.
|
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: "
|
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
|
data/lib/cm_admin/version.rb
CHANGED
@@ -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:
|
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.
|
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-
|
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
|