Skip to content

Commit

Permalink
UI - Preview single snapshot - Date and button fixes (#2389)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgtlmoon committed May 27, 2024
1 parent 778680d commit be91c54
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions changedetectionio/flask_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ def _jinja2_filter_datetime(watch_obj, format="%Y-%m-%d %H:%M:%S"):

@app.template_filter('format_timestamp_timeago')
def _jinja2_filter_datetimestamp(timestamp, format="%Y-%m-%d %H:%M:%S"):
if timestamp == False:
if not timestamp:
return 'Not yet'

return timeago.format(timestamp, time.time())
return timeago.format(int(timestamp), time.time())


@app.template_filter('pagination_slice')
Expand Down
4 changes: 4 additions & 0 deletions changedetectionio/static/js/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@ if (selectElement) {
if (selectedOption) {
if (selectedOption.previousElementSibling) {
document.getElementById('btn-previous').href = "?version=" + selectedOption.previousElementSibling.value;
} else {
document.getElementById('btn-previous').remove()
}
if (selectedOption.nextElementSibling) {
document.getElementById('btn-next').href = "?version=" + selectedOption.nextElementSibling.value;
} else {
document.getElementById('btn-next').remove()
}

}
Expand Down
2 changes: 1 addition & 1 deletion changedetectionio/templates/preview.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
</div>

<div class="tab-pane-inner" id="text">
<div class="snapshot-age">{{ watch.snapshot_text_ctime|format_timestamp_timeago }}</div>
<div class="snapshot-age">{{ current_version|format_timestamp_timeago }}</div>
<span class="ignored">Grey lines are ignored</span> <span class="triggered">Blue lines are triggers</span>
<span class="tip"><strong>Pro-tip</strong>: Highlight text to add to ignore filters</span>

Expand Down

0 comments on commit be91c54

Please sign in to comment.