Fix input and file variables

This commit is contained in:
Jeremy Thomas
2018-06-16 21:12:34 +01:00
parent 1ff1edcf53
commit e8f3fc0d66
6 changed files with 120 additions and 166 deletions

View File

@@ -0,0 +1,35 @@
{% include elements/anchor.html name="Variables" %}
<div class="content">
<p>
You can use <a href="{{ site.data.meta.github | append: '/blob/master/sass/elements/form.sass#L1,L23' }}" target="_blank">these variables</a> to <strong>customize</strong> this element. Simply set one or multiple of these variables <em>before</em> importing Bulma. <a href="{{ site.url }}/documentation/overview/customize/">Learn how</a>.
</p>
</div>
<table class="table is-bordered">
<thead>
<tr>
<th>Name</th>
<th>Default value</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Name</th>
<th>Default value</th>
</tr>
</tfoot>
<tbody>
{% for key in page.variables_keys %}
{% assign variable = site.data.variables.elements.form.vars[key] %}
<tr>
<td>
<code>{{ variable.name }}</code>
</td>
<td>
<code>{{ variable.value }}</code>
</td>
</tr>
{% endfor %}
</tbody>
</table>

View File

@@ -0,0 +1,26 @@
<tr>
<td >
<code style="white-space: nowrap;">{{ include.variable.name }}</code>
</td>
<td>
<small>
{% if include.variable.computed_type and include.variable.computed_type != include.variable.type %}
{{ include.variable.computed_type }}
{% else %}
{{ include.variable.type }}
{% endif %}
</small>
</td>
<td>
<code>{{ include.variable.value }}</code>
</td>
<td>
{% if include.variable.computed_value != '' %}
{% if include.variable.computed_type == 'color' %}
{% include elements/color-square.html value=variable.computed_value %}
{% elsif include.variable.computed_value and include.variable.computed_value != include.variable.value %}
<code>{{ include.variable.computed_value }}</code>
{% endif %}
{% endif %}
</td>
</tr>

View File

@@ -53,36 +53,22 @@
</tr>
</tfoot>
<tbody>
{% for variable_name in variables %}
{% assign variable = data.by_name[variable_name] %}
<tr>
<td >
<code style="white-space: nowrap;">{{ variable.name }}</code>
</td>
<td>
<small>
{% if variable.computed_type and variable.computed_type != variable.type %}
{{ variable.computed_type }}
{% else %}
{{ variable.type }}
{% endif %}
</small>
</td>
<td>
<code>{{ variable.value }}</code>
</td>
<td>
{% if variable.computed_value != '' %}
{% if variable.computed_type == 'color' %}
{% include elements/color-square.html value=variable.computed_value %}
{% elsif variable.computed_value and variable.computed_value != variable.value %}
<code>{{ variable.computed_value }}</code>
{% endif %}
{% endif %}
</td>
</tr>
{% endfor %}
{% if include.variables_keys %}
{% for key in include.variables_keys %}
{% if include.responsiveness_variables %}
{% assign variable = site.data.variables.utilities.initial-variables.by_name[key] %}
{% include elements/variable-row.html variable=variable %}
{% else %}
{% assign variable = site.data.variables.elements.form.by_name[key] %}
{% include elements/variable-row.html variable=variable %}
{% endif %}
{% endfor %}
{% else %}
{% for variable_name in variables %}
{% assign variable = data.by_name[variable_name] %}
{% include elements/variable-row.html variable=variable %}
{% endfor %}
{% endif %}
</tbody>
</table>
</div>