From a5d0a2a0be9777c5d499303b2ff873463b782356 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 5 Jun 2020 12:10:42 -0300 Subject: [PATCH] Estructura de formularios --- _includes/form/boolean.html | 29 ++++++++++++++----------- _includes/form/hidden.html | 6 +++++- _includes/form/input.html | 27 +++++++++++++++-------- _includes/form/predefined_array.html | 27 +++++++++++++++-------- _includes/form/string.html | 4 +++- _includes/form/submit.html | 2 +- _includes/form/text.html | 32 +++++++++++++++++----------- 7 files changed, 82 insertions(+), 45 deletions(-) diff --git a/_includes/form/boolean.html b/_includes/form/boolean.html index 1e0ee21..32d35b4 100644 --- a/_includes/form/boolean.html +++ b/_includes/form/boolean.html @@ -1,25 +1,30 @@ +{%- assign name = include.field[0] -%} +{%- assign id = include.field[1].id | default: name -%} +{%- assign label = include.field[1].label[site.locale] -%} +{%- assign help = include.field[1].help[site.locale] -%} +{%- assign autocomplete = include.field[1].autocomplete -%} +
- + - {%- if include.field[1].help -%} - - {{ include.field[1].help }} + {%- if help -%} + + {{ help }} {%- endif -%}
diff --git a/_includes/form/hidden.html b/_includes/form/hidden.html index 50688ab..e9ab603 100644 --- a/_includes/form/hidden.html +++ b/_includes/form/hidden.html @@ -1 +1,5 @@ - +{%- assign name = include.field[0] -%} +{%- assign id = include.field[1].id | default: name -%} +{%- assign value = include.field[1].value -%} + + diff --git a/_includes/form/input.html b/_includes/form/input.html index 36253b8..cc674c2 100644 --- a/_includes/form/input.html +++ b/_includes/form/input.html @@ -1,24 +1,33 @@ +{%- assign name = include.field[0] -%} +{%- assign id = include.field[1].id | default: name -%} +{%- assign label = include.field[1].label[site.locale] -%} +{%- assign help = include.field[1].help[site.locale] -%} +{%- assign autocomplete = include.field[1].autocomplete -%} +
-
diff --git a/_includes/form/predefined_array.html b/_includes/form/predefined_array.html index 883c59b..bdbf6ad 100644 --- a/_includes/form/predefined_array.html +++ b/_includes/form/predefined_array.html @@ -1,18 +1,27 @@ +{%- assign name = include.field[0] -%} +{%- assign id = include.field[1].id | default: name -%} +{%- assign label = include.field[1].label[site.locale] -%} +{%- assign help = include.field[1].help[site.locale] -%} +{%- assign autocomplete = include.field[1].autocomplete -%} +
-
diff --git a/_includes/form/string.html b/_includes/form/string.html index a92aa57..8f6c389 100644 --- a/_includes/form/string.html +++ b/_includes/form/string.html @@ -1 +1,3 @@ -{% include input.html field=field %} +{% assign f = field %} +{% assign f.type = 'text' %} +{% include input.html field=f %} diff --git a/_includes/form/submit.html b/_includes/form/submit.html index ce8862a..5032564 100644 --- a/_includes/form/submit.html +++ b/_includes/form/submit.html @@ -1 +1 @@ - + diff --git a/_includes/form/text.html b/_includes/form/text.html index 46b0c8c..3f145ef 100644 --- a/_includes/form/text.html +++ b/_includes/form/text.html @@ -1,24 +1,32 @@ +{%- assign name = include.field[0] -%} +{%- assign id = include.field[1].id | default: name -%} +{%- assign label = include.field[1].label[site.locale] -%} +{%- assign help = include.field[1].help[site.locale] -%} +{%- assign autocomplete = include.field[1].autocomplete -%} +
-