From: Andrea Zagli Date: Sat, 6 May 2017 15:33:18 +0000 (+0200) Subject: Adjustments to checkbox and radio rendering. X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=b234f138d2d5241b5c791175f4ec660f24273254;p=zakform%2Fcgi Adjustments to checkbox and radio rendering. --- diff --git a/src/formelementcheck.c b/src/formelementcheck.c index a8c1b83..c8cb55c 100644 --- a/src/formelementcheck.c +++ b/src/formelementcheck.c @@ -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 ("
\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\n%s %s%s", priv->in_line ? "" : "
\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

"); + if (ht_label_attrs != NULL) + { + g_string_append (str, "

\n"); + } + ret = g_strdup (str->str); g_string_free (str, TRUE); diff --git a/src/formelementradio.c b/src/formelementradio.c index 93465af..8b6035d 100644 --- a/src/formelementradio.c +++ b/src/formelementradio.c @@ -291,7 +291,7 @@ static gchar ++new_id), ht_attrs_option), value, - priv->in_line ? "" : "\n
"); + priv->in_line ? "" : "\n"); g_hash_table_unref (ht_attrs_option); }