Skip to content

Commit d497db6

Browse files
committed
UI - Notifications - Tidyup - Hide the notification tokens but show with a button/link
1 parent 7355ac8 commit d497db6

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

changedetectionio/static/js/global-settings.js

+5
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,10 @@ $(document).ready(function () {
3232
window.getSelection().removeAllRanges();
3333

3434
});
35+
36+
$("#notification-token-toggle").click(function (e) {
37+
e.preventDefault();
38+
$('#notification-tokens-info').toggle();
39+
});
3540
});
3641

changedetectionio/static/js/watch-settings.js

+4
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,8 @@ $(document).ready(function () {
4242
$('#notification_urls').val('');
4343
e.preventDefault();
4444
});
45+
$("#notification-token-toggle").click(function (e) {
46+
e.preventDefault();
47+
$('#notification-tokens-info').toggle();
48+
});
4549
});

changedetectionio/templates/_common_fields.jinja

+11-7
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,19 @@
3535
</div>
3636
<div class="pure-control-group">
3737
{{ render_field(form.notification_body , rows=5, class="notification-body", placeholder=settings_application['notification_body']) }}
38-
<span class="pure-form-message-inline">Body for all notifications</span>
38+
<span class="pure-form-message-inline">Body for all notifications &dash; You can use <a target="_new" href="https://jinja.palletsprojects.com/en/3.0.x/templates/">Jinja2</a> templating in the notification title, body and URL, and tokens from below.
39+
</span>
40+
41+
</div>
42+
<div class="pure-controls">
43+
<div id="notification-token-toggle" class="pure-button button-tag button-xsmall">Show token/placeholders</div>
3944
</div>
4045
<div class="pure-control-group">
4146
<!-- unsure -->
4247
{{ render_field(form.notification_format , class="notification-format") }}
4348
<span class="pure-form-message-inline">Format for all notifications</span>
4449
</div>
45-
<div class="pure-controls">
46-
<p class="pure-form-message-inline">
47-
You can use <a target="_new" href="https://jinja.palletsprojects.com/en/3.0.x/templates/">Jinja2</a> templating in the notification title, body and URL.
48-
</p>
49-
50+
<div class="pure-controls" style="display: none;" id="notification-tokens-info">
5051
<table class="pure-table" id="token-table">
5152
<thead>
5253
<tr>
@@ -115,7 +116,10 @@
115116
</tbody>
116117
</table>
117118
<div class="pure-form-message-inline">
118-
Warning: Contents of <code>{{ '{{diff}}' }}</code>, <code>{{ '{{diff_removed}}' }}</code>, and <code>{{ '{{diff_added}}' }}</code> depend on how the difference algorithm perceives the change. For example, an addition or removal could be perceived as a change in some cases. <a target="_new" href="https://github.com/dgtlmoon/changedetection.io/wiki/Using-the-%7B%7Bdiff%7D%7D,-%7B%7Bdiff_added%7D%7D,-and-%7B%7Bdiff_removed%7D%7D-notification-tokens">More Here</a> <br>
119+
<p>
120+
Warning: Contents of <code>{{ '{{diff}}' }}</code>, <code>{{ '{{diff_removed}}' }}</code>, and <code>{{ '{{diff_added}}' }}</code> depend on how the difference algorithm perceives the change. <br>
121+
For example, an addition or removal could be perceived as a change in some cases. <a target="_new" href="https://github.com/dgtlmoon/changedetection.io/wiki/Using-the-%7B%7Bdiff%7D%7D,-%7B%7Bdiff_added%7D%7D,-and-%7B%7Bdiff_removed%7D%7D-notification-tokens">More Here</a> <br>
122+
</p>
119123
</div>
120124
</div>
121125
</div>

0 commit comments

Comments
 (0)