Skip to content

Commit

Permalink
FIx default option
Browse files Browse the repository at this point in the history
  • Loading branch information
Rias committed Dec 18, 2019
1 parent cf02f7f commit 809da90
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## 1.2.5 - 2019-12-18
### Fixed
- Fixed the default option not being set

## 1.2.4 - 2019-10-27
### Added
- background pattern to show transparent color option
Expand Down
7 changes: 1 addition & 6 deletions src/templates/colourOption.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
{% set colours = value.color | split(',') %}
{% endif %}

{# Set the default value #}
{% if option.default %}
{% set defaultValue = value|json_encode %}
{% endif %}

<button type="button" title="{{ option.label }}" data-value="{{ value | json_encode }}" class="option {% if (option.default and (not fieldValue is defined or (fieldValue is defined and not fieldValue.color))) or (fieldValue is defined and fieldValue.color == option.color) %} active{% endif %}"
style="
{% switch colours | length %}
Expand All @@ -22,4 +17,4 @@
{% set percentage = 100 / colours | length %}
--color: linear-gradient(to bottom right, {% for colour in colours %}{{ colour|parseRefs|raw }} {{ percentage * loop.index0 }}%, {{ colour|parseRefs|raw }} {{ percentage * loop.index }}%{% if not loop.last %},{% endif %}{% endfor %});
{% endswitch %}
"></button>
"></button>
5 changes: 5 additions & 0 deletions src/templates/input.twig
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
optionId: namespacedId ~ '-option-' ~ loop.index,
option: option,
} %}

{# Set the default value #}
{% if option.default %}
{% set defaultValue = value|json_encode %}
{% endif %}
{% endfor %}
</div>

Expand Down

0 comments on commit 809da90

Please sign in to comment.