This is an automated email from the ASF dual-hosted git repository.
papegaaij pushed a commit to branch csp
in repository https://gitbox.apache.org/repos/asf/wicket.git
The following commit(s) were added to refs/heads/csp by this push:
new 83f8526 WICKET-6735: replaced inline color:red with a css class
83f8526 is described below
commit 83f852627633acf303a5a4214ec833c2410ef6c7
Author: Emond Papegaaij <[email protected]>
AuthorDate: Wed Feb 5 20:31:45 2020 +0100
WICKET-6735: replaced inline color:red with a css class
---
.../java/org/apache/wicket/Application.properties | 4 +++-
.../main/java/org/apache/wicket/css/wicket-core.css | 3 +++
.../validation/FormComponentFeedbackBorder.html | 2 +-
.../validation/FormComponentFeedbackBorder.java | 11 +++++++++++
.../validation/FormComponentFeedbackIndicator.html | 2 +-
.../validation/FormComponentFeedbackIndicator.java | 21 +++++++++++++++++++++
.../form/feedback/FeedbackFormPage_result2.html | 2 +-
.../feedback/FeedbackIndicatorFormPage_result2.html | 2 +-
8 files changed, 42 insertions(+), 5 deletions(-)
diff --git a/wicket-core/src/main/java/org/apache/wicket/Application.properties
b/wicket-core/src/main/java/org/apache/wicket/Application.properties
index 7ef2b98..f6e8137 100644
--- a/wicket-core/src/main/java/org/apache/wicket/Application.properties
+++ b/wicket-core/src/main/java/org/apache/wicket/Application.properties
@@ -87,4 +87,6 @@ AutoLabel.CSS.invalid=error
AutoLabel.CSS.disabled=disabled
Component.CSS.hidden=wicket--hidden
-Form.CSS.hidden-fields=wicket--hidden-fields
\ No newline at end of file
+Form.CSS.hidden-fields=wicket--hidden-fields
+FormComponentFeedbackBorder.CSS.error-indicator=wicket--color-red
+FormComponentFeedbackIndicator.CSS.error-indicator=wicket--color-red
diff --git a/wicket-core/src/main/java/org/apache/wicket/css/wicket-core.css
b/wicket-core/src/main/java/org/apache/wicket/css/wicket-core.css
index 787ffa9..226de4c 100644
--- a/wicket-core/src/main/java/org/apache/wicket/css/wicket-core.css
+++ b/wicket-core/src/main/java/org/apache/wicket/css/wicket-core.css
@@ -24,4 +24,7 @@
left: -100px;
top: -100px;
overflow: hidden;
+}
+.wicket--color-red {
+ color: red;
}
\ No newline at end of file
diff --git
a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/validation/FormComponentFeedbackBorder.html
b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/validation/FormComponentFeedbackBorder.html
index f985fc5..6a67b5a 100644
---
a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/validation/FormComponentFeedbackBorder.html
+++
b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/validation/FormComponentFeedbackBorder.html
@@ -19,7 +19,7 @@
<body>
<wicket:border>
<wicket:body/>
- <span wicket:id = "errorIndicator"><span
style="color:red;">*</span></span>
+ <span wicket:id="errorIndicator">*</span>
</wicket:border>
</body>
</html>
diff --git
a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/validation/FormComponentFeedbackBorder.java
b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/validation/FormComponentFeedbackBorder.java
index 528e5da..62eef73 100644
---
a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/validation/FormComponentFeedbackBorder.java
+++
b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/validation/FormComponentFeedbackBorder.java
@@ -16,12 +16,15 @@
*/
package org.apache.wicket.markup.html.form.validation;
+import org.apache.wicket.core.util.string.CssUtils;
import org.apache.wicket.feedback.ContainerFeedbackMessageFilter;
import org.apache.wicket.feedback.FeedbackCollector;
import org.apache.wicket.feedback.IFeedback;
import org.apache.wicket.feedback.IFeedbackMessageFilter;
+import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.border.Border;
+import org.apache.wicket.markup.html.form.Form;
/**
* A border that can be placed around a form component to indicate when the
bordered child/children
@@ -69,6 +72,14 @@ public class FormComponentFeedbackBorder extends Border
implements IFeedback
{
return visible;
}
+
+ @Override
+ protected void onComponentTag(ComponentTag tag)
+ {
+ super.onComponentTag(tag);
+ tag.put("class",
+
getString(CssUtils.key(FormComponentFeedbackBorder.class, "error-indicator")));
+ }
}
/**
diff --git
a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/validation/FormComponentFeedbackIndicator.html
b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/validation/FormComponentFeedbackIndicator.html
index 5ac6a06..b971b21 100644
---
a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/validation/FormComponentFeedbackIndicator.html
+++
b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/validation/FormComponentFeedbackIndicator.html
@@ -17,6 +17,6 @@
-->
<html xmlns:wicket="http://wicket.apache.org">
<body>
-<wicket:panel><span style="color:red;">*</span></wicket:panel>
+<wicket:panel><span wicket:id="indicator">*</span></wicket:panel>
</body>
</html>
diff --git
a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/validation/FormComponentFeedbackIndicator.java
b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/validation/FormComponentFeedbackIndicator.java
index 6d703e8..05d5578 100644
---
a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/validation/FormComponentFeedbackIndicator.java
+++
b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/validation/FormComponentFeedbackIndicator.java
@@ -17,10 +17,13 @@
package org.apache.wicket.markup.html.form.validation;
import org.apache.wicket.Component;
+import org.apache.wicket.core.util.string.CssUtils;
import org.apache.wicket.feedback.ComponentFeedbackMessageFilter;
import org.apache.wicket.feedback.FeedbackCollector;
import org.apache.wicket.feedback.IFeedback;
import org.apache.wicket.feedback.IFeedbackMessageFilter;
+import org.apache.wicket.markup.ComponentTag;
+import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.panel.Panel;
/**
@@ -59,6 +62,24 @@ public class FormComponentFeedbackIndicator extends Panel
implements IFeedback
filter = new ComponentFeedbackMessageFilter(component);
}
+ @Override
+ protected void onInitialize()
+ {
+ super.onInitialize();
+ add(new WebMarkupContainer("indicator")
+ {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void onComponentTag(ComponentTag tag)
+ {
+ super.onComponentTag(tag);
+ tag.put("class", getString(
+
CssUtils.key(FormComponentFeedbackIndicator.class, "error-indicator")));
+ }
+ });
+ }
+
/**
* Set the component's visibility according to the existence (or not)
of feedback messages
*/
diff --git
a/wicket-core/src/test/java/org/apache/wicket/markup/html/form/feedback/FeedbackFormPage_result2.html
b/wicket-core/src/test/java/org/apache/wicket/markup/html/form/feedback/FeedbackFormPage_result2.html
index da1bfe0..f3c9297 100644
---
a/wicket-core/src/test/java/org/apache/wicket/markup/html/form/feedback/FeedbackFormPage_result2.html
+++
b/wicket-core/src/test/java/org/apache/wicket/markup/html/form/feedback/FeedbackFormPage_result2.html
@@ -5,7 +5,7 @@
<wicket:body>
<input type="text" wicket:id="input" value=""
name="feedback:feedback_body:input">
</wicket:body>
- <span wicket:id="errorIndicator"><span
style="color:red;">*</span></span>
+ <span wicket:id="errorIndicator" class="wicket--color-red">*</span>
</wicket:border></span>
</form>
</body>
diff --git
a/wicket-core/src/test/java/org/apache/wicket/markup/html/form/feedback/FeedbackIndicatorFormPage_result2.html
b/wicket-core/src/test/java/org/apache/wicket/markup/html/form/feedback/FeedbackIndicatorFormPage_result2.html
index fa72247..3e2258e 100644
---
a/wicket-core/src/test/java/org/apache/wicket/markup/html/form/feedback/FeedbackIndicatorFormPage_result2.html
+++
b/wicket-core/src/test/java/org/apache/wicket/markup/html/form/feedback/FeedbackIndicatorFormPage_result2.html
@@ -2,7 +2,7 @@
<body>
<form wicket:id="form" id="form1" method="post"
action="./org.apache.wicket.markup.html.form.feedback.FeedbackIndicatorFormPage?1-2.-form">
<input type="text" wicket:id="input" value="" name="input">
-<span wicket:id="feedback"><wicket:panel><span
style="color:red;">*</span></wicket:panel></span>
+<span wicket:id="feedback"><wicket:panel><span wicket:id="indicator"
class="wicket--color-red">*</span></wicket:panel></span>
</form>
</body>
</html>
\ No newline at end of file