Skip to content

Commit

Permalink
feat(blocks): update block InputSelect #18
Browse files Browse the repository at this point in the history
  • Loading branch information
Awilum committed May 20, 2021
1 parent ee6837f commit c447964
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 78 deletions.
19 changes: 10 additions & 9 deletions blocks/blocks/InputSelect/block.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
{% import "plugins/blueprints/blocks/macros/grid.html" as grid %}
{% import "plugins/blueprints/blocks/macros/attr.html" as attr %}
{% if block.properties.label %}
<label for="{{ block.properties.id }}"
{{ include(template_from_string(attr.class(['form-label', block.properties.label.class]))) }}
{{ include(template_from_string(attr.style(block.properties.label.style))) }}>{{ include(template_from_string(block.properties.label.title)) }}</label>
{% endif %}

<select {{ include(template_from_string(attr.id(block.properties.id))) }}
{{ include(template_from_string(attr.name(block.properties.name))) }}
{{ include(template_from_string(attr.class(['form-control', 'js-select', block.properties.class]))) }}
{{ include(template_from_string(attr.class(['form-control', block.properties.class]))) }}
{{ include(template_from_string(attr.data(block.properties.data))) }}
{{ include(template_from_string(attr.style(block.properties.style))) }}
{{ include(template_from_string(attr.style(block.properties.style))) }}
{{ include(template_from_string(attr.disabled(block.properties.disabled))) }}
{{ include(template_from_string(attr.events(block.properties.events, ['onkeyup', 'onmousedown', 'onmousemove', 'onmouseout',
'onmouseover', 'onmouseup', 'onkeypress', 'onclick', 'ondblclick',
'onkeydown', 'onblur']))) }}>

{% if block.properties.options is iterable %}
{% set options = block.properties.options %}
{% else %}
{% set options = flextype.serializers.json.decode(raw(include(template_from_string(block.properties.options)))) %}
{% if block.properties.items %}
{% if block.properties.items is iterable %}
{% set items = block.properties.items %}
{% else %}
{% set items = flextype.serializers.json.decode(raw(include(template_from_string(block.properties.items)))) %}
{% endif %}
{% endif %}

{% for key, value in options %}
{% for key, value in items %}
<option value="{{ key }}" {% if key == attr.value(block.properties.name, values, block.properties.value) %} selected="selected" {% endif %}>{{ include(template_from_string(value)) }}</option>
{% endfor %}
</select>
Expand Down
1 change: 0 additions & 1 deletion blocks/blocks/InputSelect/block.js

This file was deleted.

68 changes: 0 additions & 68 deletions blocks/blocks/InputSelect/block.scss

This file was deleted.

0 comments on commit c447964

Please sign in to comment.