|
43 | 43 | <div class="pure-control-group"> |
44 | 44 | {{ render_field(form.title, placeholder="https://...", required=true, class="m-d") }} |
45 | 45 | </div> |
| 46 | + <div class="pure-control-group"> |
| 47 | + {{ render_field(form.url_match_pattern, class="m-d") }} |
| 48 | + <span class="pure-form-message-inline">{{ _('Automatically applies this tag to any watch whose URL matches. Supports wildcards: <code>*example.com*</code> or plain substring: <code>github.com/myorg</code>')|safe }}</span> |
| 49 | + </div> |
| 50 | + {% if matching_watches %} |
| 51 | + <div class="pure-control-group"> |
| 52 | + <label>{{ _('Currently matching watches') }} ({{ matching_watches|length }})</label> |
| 53 | + <ul class="tag-url-match-list"> |
| 54 | + {% for w_uuid, w in matching_watches.items() %} |
| 55 | + <li><a href="{{ url_for('ui.ui_edit.edit_page', uuid=w_uuid) }}">{{ w.label }}</a></li> |
| 56 | + {% endfor %} |
| 57 | + </ul> |
| 58 | + </div> |
| 59 | + {% endif %} |
| 60 | + <div class="pure-control-group"> |
| 61 | + <label>{{ _('Tag colour') }}</label> |
| 62 | + <div style="display:flex; align-items:center; gap:0.75em;"> |
| 63 | + <input type="checkbox" id="use_custom_colour" |
| 64 | + {% if data.get('tag_colour') %}checked{% endif %}> |
| 65 | + <label for="use_custom_colour" style="margin:0">{{ _('Custom colour') }}</label> |
| 66 | + <input type="color" id="tag_colour_picker" |
| 67 | + value="{{ data.get('tag_colour') or '#4f8ef7' }}" |
| 68 | + {% if not data.get('tag_colour') %}disabled{% endif %}> |
| 69 | + <input type="hidden" name="tag_colour" id="tag_colour_hidden" |
| 70 | + value="{{ data.get('tag_colour', '') }}"> |
| 71 | + </div> |
| 72 | + <span class="pure-form-message-inline">{{ _('Leave unchecked to use the auto-generated colour based on the tag name.') }}</span> |
| 73 | + </div> |
| 74 | + <script> |
| 75 | + (function () { |
| 76 | + var cb = document.getElementById('use_custom_colour'); |
| 77 | + var picker = document.getElementById('tag_colour_picker'); |
| 78 | + var hidden = document.getElementById('tag_colour_hidden'); |
| 79 | + picker.addEventListener('input', function () { hidden.value = this.value; }); |
| 80 | + cb.addEventListener('change', function () { |
| 81 | + picker.disabled = !this.checked; |
| 82 | + hidden.value = this.checked ? picker.value : ''; |
| 83 | + }); |
| 84 | + })(); |
| 85 | + </script> |
46 | 86 | </fieldset> |
47 | 87 | </div> |
48 | 88 |
|
|
0 commit comments