You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2021/12/11 17:50:10 UTC
[isis] branch master updated: ISIS-2882: if TextFieldWithDateTimePicker is readonly, don't use tempusdominus datetimepicker at all
This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git
The following commit(s) were added to refs/heads/master by this push:
new 001fd4e ISIS-2882: if TextFieldWithDateTimePicker is readonly, don't use tempusdominus datetimepicker at all
001fd4e is described below
commit 001fd4eb86199a3fc6fed96c36c808b542bd2878
Author: andi-huber <ah...@apache.org>
AuthorDate: Sat Dec 11 18:50:10 2021 +0100
ISIS-2882: if TextFieldWithDateTimePicker is readonly, don't use
tempusdominus datetimepicker at all
- just render like a regular read-only text field
- fixes values magically disappearing after rendering
---
.../scalars/datepicker/TextFieldWithDateTimePicker.java | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/datepicker/TextFieldWithDateTimePicker.java b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/datepicker/TextFieldWithDateTimePicker.java
index dea4326..075cf1e 100644
--- a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/datepicker/TextFieldWithDateTimePicker.java
+++ b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/datepicker/TextFieldWithDateTimePicker.java
@@ -147,13 +147,16 @@ implements IConverter<T> {
protected void onComponentTag(final ComponentTag tag) {
super.onComponentTag(tag);
+ if(!isEnabled()) {
+ return;
+ }
+
checkComponentTag(tag, "input");
Attributes.set(tag, "type", "text");
Attributes.addClass(tag, "datetimepicker-input");
Attributes.set(tag, "data-toggle", "datetimepicker");
Attributes.set(tag, "data-target", getMarkupId());
-
Attributes.set(tag, "autocomplete", "off");
}
@@ -161,13 +164,17 @@ implements IConverter<T> {
public void renderHead(final IHeaderResponse response) {
super.renderHead(response);
+ if(!isEnabled()) {
+ return;
+ }
+
response.render(CssHeaderItem.forReference(new CssResourceReference(TextFieldWithDateTimePicker.class, "css/fa-patch.css")));
response.render(CssHeaderItem.forReference(new CssResourceReference(TextFieldWithDateTimePicker.class, "css/tempusdominus-bootstrap-4.css")));
response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(TextFieldWithDateTimePicker.class, "js/moment-with-locales.js")));
response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(TextFieldWithDateTimePicker.class, "js/tempusdominus-bootstrap-4.js")));
- config.readonly(! isEnabled());
+ config.readonly(!isEnabled());
response.render(OnDomReadyHeaderItem.forScript(createScript(config)));
}