Skip to content

Commit

Permalink
Handle values without leading # in color picker
Browse files Browse the repository at this point in the history
  • Loading branch information
ThiefMaster committed Oct 27, 2017
1 parent 074010b commit aa8a67c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion indico/web/templates/forms/color_picker_widget.html
@@ -1,10 +1,13 @@
{% extends 'forms/base_widget.html' %}

{% set value = field._value() %}
{% if value and value[0] != '#' %}{% set value = '#' + value %}{% endif %}

{% block html %}
<div class="i-color-field clearfix">
<div class="clickable-wrapper">
<span class="color-preview"></span>
<input id="{{ field.id }}" name="{{ field.name }}" value="{{ field._value() }}" type="text" maxlength="7">
<input id="{{ field.id }}" name="{{ field.name }}" value="{{ value }}" type="text" maxlength="7">
</div>
</div>
{% endblock %}
Expand Down

0 comments on commit aa8a67c

Please sign in to comment.