diff --git a/changedetectionio/__init__.py b/changedetectionio/__init__.py index 594747ef..1ba329d5 100644 --- a/changedetectionio/__init__.py +++ b/changedetectionio/__init__.py @@ -1186,6 +1186,36 @@ def changedetection_app(config=None, datastore_o=None): flash("{} watches are queued for rechecking.".format(i)) return redirect(url_for('index', tag=tag)) + @app.route("/form/checkbox-operations", methods=['POST']) + @login_required + def form_watch_list_checkbox_operations(): + op = request.form['op'] + uuids = request.form.getlist('uuids') + + if (op == 'delete'): + for uuid in uuids: + uuid = uuid.strip() + if datastore.data['watching'].get(uuid): + datastore.delete(uuid.strip()) + flash("{} watches deleted".format(len(uuids))) + + if (op == 'pause'): + for uuid in uuids: + uuid = uuid.strip() + if datastore.data['watching'].get(uuid): + datastore.data['watching'][uuid.strip()]['paused'] = True + + flash("{} watches paused".format(len(uuids))) + + if (op == 'unpause'): + for uuid in uuids: + uuid = uuid.strip() + if datastore.data['watching'].get(uuid): + datastore.data['watching'][uuid.strip()]['paused'] = False + flash("{} watches unpaused".format(len(uuids))) + + return redirect(url_for('index')) + @app.route("/api/share-url", methods=['GET']) @login_required def form_share_put_watch(): diff --git a/changedetectionio/static/js/watch-overview.js b/changedetectionio/static/js/watch-overview.js index a06034b1..4b747c14 100644 --- a/changedetectionio/static/js/watch-overview.js +++ b/changedetectionio/static/js/watch-overview.js @@ -22,5 +22,18 @@ $(function () { }); }); + // checkboxes - check all + $("#check-all").click(function (e) { + $('input[type=checkbox]').not(this).prop('checked', this.checked); + }); + // checkboxes - show/hide buttons + $("input[type=checkbox]").click(function (e) { + if ($('input[type=checkbox]:checked').length) { + $('#checkbox-operations').slideDown(); + } else { + $('#checkbox-operations').slideUp(); + } + }); + }); diff --git a/changedetectionio/static/styles/styles.css b/changedetectionio/static/styles/styles.css index 61b1fbb1..0444da7a 100644 --- a/changedetectionio/static/styles/styles.css +++ b/changedetectionio/static/styles/styles.css @@ -555,3 +555,13 @@ ul { .snapshot-age.error { background-color: #ff0000; color: #fff; } + +#checkbox-operations { + background: rgba(0, 0, 0, 0.05); + padding: 1em; + border-radius: 10px; + margin-bottom: 1em; + display: none; } + +.checkbox-uuid > * { + vertical-align: middle; } diff --git a/changedetectionio/static/styles/styles.scss b/changedetectionio/static/styles/styles.scss index 1801a0e0..4839aec1 100644 --- a/changedetectionio/static/styles/styles.scss +++ b/changedetectionio/static/styles/styles.scss @@ -774,3 +774,15 @@ ul { } } +#checkbox-operations { + background: rgba(0, 0, 0, 0.05); + padding: 1em; + border-radius: 10px; + margin-bottom: 1em; + display: none; +} +.checkbox-uuid { + > * { + vertical-align: middle; + } +} diff --git a/changedetectionio/templates/watch-overview.html b/changedetectionio/templates/watch-overview.html index b5e962c2..a6d8d752 100644 --- a/changedetectionio/templates/watch-overview.html +++ b/changedetectionio/templates/watch-overview.html @@ -24,6 +24,14 @@ Tip: You can also add 'shared' watches. More info + +