Skip to content

Commit

Permalink
Merge pull request #439 from sydoluciani/deform_updating_error_class
Browse files Browse the repository at this point in the history
Deform updating error_class
  • Loading branch information
stevepiercy authored Aug 21, 2020
2 parents 366355c + 023746a commit d9fa170
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
6 changes: 3 additions & 3 deletions deform/templates/mapping_item.pt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
category category|field.widget.category;
structural hidden or category == 'structural';
required required|field.required;"
class="form-group ${field.error and 'has-error' or ''} ${field.widget.item_css_class or ''} ${field.default_item_css_class()}"
class="form-group ${field.error and error_class or ''} ${field.widget.item_css_class or ''} ${field.default_item_css_class()}"
title="${description}"
id="item-${oid}"
tal:omit-tag="structural"
Expand All @@ -31,7 +31,7 @@
tal:condition="input_append">${input_append}</span>
</div>

<p class="help-block"
<p class="form-text text-danger"
tal:define="errstr 'error-%s' % field.oid"
tal:repeat="msg field.error.messages()"
i18n:translate=""
Expand All @@ -42,7 +42,7 @@
</p>

<p tal:condition="field.description and not field.widget.hidden"
class="help-block" >
class="form-text" >
${field.description}
</p>
</div>
6 changes: 3 additions & 3 deletions deform/templates/readonly/mapping_item.pt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
category category|field.widget.category;
structural hidden or category == 'structural';
required required|field.required;"
class="form-group ${field.error and 'has-error' or ''} ${field.widget.item_css_class or ''}"
class="form-group ${field.error and error_class or ''} ${field.widget.item_css_class or ''}"
title="${description}"
id="item-${oid}"
tal:omit-tag="structural"
Expand All @@ -31,7 +31,7 @@
tal:condition="input_append">${input_append}</span>
</div>

<p class="help-block"
<p class="form-text text-danger"
tal:define="errstr 'error-%s' % field.oid"
tal:repeat="msg field.error.messages()"
i18n:translate=""
Expand All @@ -42,7 +42,7 @@
</p>

<p tal:condition="field.description and not field.widget.hidden"
class="help-block" >
class="form-text" >
${field.description}
</p>
</div>
2 changes: 1 addition & 1 deletion deform/templates/sequence_item.pt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
repeat="msg field.error.messages()">
<p tal:condition="msg"
id="${errstr if repeat.msg.index==0 else '%s-%s' % (errstr, repeat.msg.index)}"
class="${error_class} help-block"
class="${error_class} form-text text-danger"
i18n:translate="">${msg}</p>
</tal:errors>
</div>
Expand Down
3 changes: 2 additions & 1 deletion deform/templates/textinput.pt
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<span tal:define="name name|field.name;
css_class css_class|field.widget.css_class;
error_class error_class|field.widget.error_class;
oid oid|field.oid;
mask mask|field.widget.mask;
mask_placeholder mask_placeholder|field.widget.mask_placeholder;
style style|field.widget.style;
autofocus autofocus|field.autofocus"
tal:omit-tag="">
<input type="text" name="${name}" value="${cstruct}"
tal:attributes="class string: form-control ${css_class or ''};
tal:attributes="class string: form-control ${field.error and error_class or css_class or ''};
style style;
autofocus autofocus;
attributes|field.widget.attributes|{};"
Expand Down
6 changes: 3 additions & 3 deletions deform/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class Widget(object):
hidden = False
readonly = False
category = "default"
error_class = "error"
error_class = "is-invalid"
css_class = None
item_css_class = None
style = None
Expand Down Expand Up @@ -1409,7 +1409,7 @@ class MappingWidget(Widget):
readonly_template = "readonly/mapping"
item_template = "mapping_item"
readonly_item_template = "readonly/mapping_item"
error_class = None
error_class = "is-invalid"
category = "structural"
requirements = (("deform", None),)

Expand Down Expand Up @@ -1539,7 +1539,7 @@ class SequenceWidget(Widget):
readonly_template = "readonly/sequence"
item_template = "sequence_item"
readonly_item_template = "readonly/sequence_item"
error_class = None
error_class = "is-invalid"
add_subitem_text_template = _("Add ${subitem_title}")
min_len = None
max_len = None
Expand Down

0 comments on commit d9fa170

Please sign in to comment.