You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2019/09/26 07:30:53 UTC

[myfaces-tobago] 02/02: custom element: tobago-label * fixes: tobago-label is not a custom element, it uses

This is an automated email from the ASF dual-hosted git repository.

lofwyr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git

commit c40e25fac8c89dbfdaa459d3d002424c00329799
Author: Udo Schnurpfeil <ud...@irian.eu>
AuthorDate: Thu Sep 26 09:30:34 2019 +0200

    custom element: tobago-label
    * fixes: tobago-label is not a custom element, it uses <label>
    
    issue: TOBAGO-1633: TS refactoring
---
 .../renderkit/renderer/LabelLayoutRendererBase.java   |  5 +++--
 .../myfaces/tobago/renderkit/css/TobagoClass.java     |  1 +
 tobago-core/src/main/resources/scss/_tobago.scss      | 19 +++++++++++++------
 3 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/LabelLayoutRendererBase.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/LabelLayoutRendererBase.java
index 82d75d7..6733303 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/LabelLayoutRendererBase.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/LabelLayoutRendererBase.java
@@ -129,7 +129,7 @@ public abstract class LabelLayoutRendererBase extends DecodingInputRendererBase
 
     if (labelLayout == LabelLayout.gridLeft || labelLayout == LabelLayout.gridRight
         || labelLayout == LabelLayout.gridTop || labelLayout == LabelLayout.gridBottom) {
-      writer.startElement(HtmlElements.TOBAGO_LABEL);
+      writer.startElement(HtmlElements.LABEL);
       writer.writeIdAttribute(clientId + ComponentUtils.SUB_SEPARATOR + "label");
     } else {
       writer.startElement(getComponentTag());
@@ -139,6 +139,7 @@ public abstract class LabelLayoutRendererBase extends DecodingInputRendererBase
         flex ? TobagoClass.FLEX_LAYOUT : null,
         flex ? BootstrapClass.D_FLEX : null,
         BootstrapClass.FORM_GROUP,
+        TobagoClass.LABEL__CONTAINER,
         ComponentUtils.getBooleanAttribute(component, Attributes.required) ? TobagoClass.REQUIRED : null,
         markup != null && markup.contains(Markup.SPREAD) ? TobagoClass.SPREAD : null);
 
@@ -163,7 +164,7 @@ public abstract class LabelLayoutRendererBase extends DecodingInputRendererBase
       case gridRight:
       case gridTop:
       case gridBottom:
-        writer.endElement(HtmlElements.TOBAGO_LABEL);
+        writer.endElement(HtmlElements.LABEL);
 
         writer.startElement(getComponentTag());
         writer.writeIdAttribute(clientId);
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/TobagoClass.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/TobagoClass.java
index 731910e..33abe3a 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/TobagoClass.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/TobagoClass.java
@@ -140,6 +140,7 @@ public enum TobagoClass implements CssItem {
   @Deprecated
   INPUT_GROUP_OUTER(INPUT__GROUP__OUTER.getName()),
   LABEL("tobago-label"),
+  LABEL__CONTAINER("tobago-label-container"),
   LINK("tobago-link"),
   LINKS("tobago-links"),
   MESSAGES("tobago-messages"),
diff --git a/tobago-core/src/main/resources/scss/_tobago.scss b/tobago-core/src/main/resources/scss/_tobago.scss
index 21cc683..8a2ccd7 100644
--- a/tobago-core/src/main/resources/scss/_tobago.scss
+++ b/tobago-core/src/main/resources/scss/_tobago.scss
@@ -277,7 +277,7 @@ tobago-file {
 }
 
 /* the non-label-element inside of a label-layout with flex box */
-tobago-label.tobago-flexLayout > {
+.tobago-label-container.tobago-flexLayout > {
   .form-control, .form-control-plaintext, .twitter-typeahead,
   .tobago-input-group-outer, .tobago-messages-container,
   .tobago-selectManyShuttle {
@@ -316,7 +316,7 @@ tobago-label.tobago-flexLayout > {
   grid-column-gap: $spacer-x; // old
   column-gap: $spacer-x;
 
-  tobago-label > {
+  .tobago-label-container > {
     .tobago-textarea, .tobago-selectManyListbox, .tobago-selectManyShuttle {
       height: 100%;
     }
@@ -366,11 +366,18 @@ tobago-label.tobago-flexLayout > {
 }
 
 /* label ----------------------------------------------------------- */
-tobago-label {
+
+// todo remove
+.tobago-label {
+}
+
+/* XXX check if this is needed (was .tobago-label before)
+label {
   width: 100%;
 }
+*/
 
-.tobago-flexLayout > tobago-label {
+.tobago-flexLayout > label {
   width: 155px;
 }
 
@@ -1644,8 +1651,8 @@ fixme: there is a problem with the selectManyShuttle with this style.
   display: none;
 }
 
-.tobago-required .tobago-label:after,
-tobago-label.tobago-required:after {
+.tobago-required label:after,
+label.tobago-required:after {
   content: "*";
   color: theme-color("danger");
 }