]> saetta.ns0.it Git - zakform/cgi/commitdiff
Adjustments to checkbox and radio rendering.
authorAndrea Zagli <azagli@libero.it>
Sat, 6 May 2017 15:33:18 +0000 (17:33 +0200)
committerAndrea Zagli <azagli@libero.it>
Sat, 6 May 2017 15:39:47 +0000 (17:39 +0200)
src/formelementcheck.c
src/formelementradio.c

index a8c1b83d17bf92a35663e34ff9bad4a5e73e0f37..c8cb55c7d768702b1ea1c86bc29798f4c9bdf9a2 100644 (file)
@@ -128,7 +128,7 @@ gchar
 *zak_form_cgi_form_element_check_get_text (ZakFormCgiFormElementCheck *element)
 {
        ZakFormCgiFormElementCheckPrivate *priv = ZAK_FORM_CGI_FORM_ELEMENT_CHECK_GET_PRIVATE (element);
-       g_warning("TEXT %s",priv->text);
+
        return g_strdup (priv->text);
 }
 
@@ -237,6 +237,7 @@ static gchar
        GString *str;
 
        GHashTable *ht_attrs;
+       GHashTable *ht_label_attrs;
 
        gchar *value;
        gchar *attr_class;
@@ -248,6 +249,16 @@ static gchar
        klass = (ZakFormCgiFormElementClass *)g_type_class_peek_parent (ZAK_FORM_CGI_FORM_ELEMENT_CHECK_GET_CLASS (ZAK_FORM_CGI_FORM_ELEMENT_CHECK (element)));
 
        ht_attrs = klass->get_ht_attrs (element);
+       ht_label_attrs = klass->get_ht_label_attrs (element);
+
+       if (ht_label_attrs != NULL)
+               {
+                       str = g_string_new ("<br/>\n");
+               }
+       else
+               {
+                       str = g_string_new ("");
+               }
 
        value = zak_form_element_get_value (ZAK_FORM_ELEMENT (element));
        if (value != NULL
@@ -263,7 +274,6 @@ static gchar
                        g_free (attr_class);
                }
 
-       str = g_string_new ("");
        g_string_append_printf (str, "\n%s<label%s>\n%s %s</label>%s",
                                priv->in_line ? "" : "<div class=\"checkbox\">\n",
                                priv->in_line ? " class=\"checkbox-inline\"" : "",
@@ -271,6 +281,11 @@ static gchar
                                zak_form_cgi_form_element_check_get_text (ZAK_FORM_CGI_FORM_ELEMENT_CHECK (element)),
                                priv->in_line ? "" : "\n</div><br/>");
 
+       if (ht_label_attrs != NULL)
+               {
+                       g_string_append (str, "<br/><br/>\n");
+               }
+
        ret = g_strdup (str->str);
        g_string_free (str, TRUE);
 
index 93465af2eb7d281fec7b741229f052e14a411a1b..8b6035dd04e48ea57659a6e00ad157016279de00 100644 (file)
@@ -291,7 +291,7 @@ static gchar
                                                                                     ++new_id),
                                                                    ht_attrs_option),
                                                value,
-                                               priv->in_line ? "" : "\n</div><br/>");
+                                               priv->in_line ? "" : "\n</div>");
 
                        g_hash_table_unref (ht_attrs_option);
                }