From f034644459359abc5152d74ed3e1c3c2c569924e Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Sat, 8 Sep 2018 00:52:08 +0200 Subject: [PATCH] Add a button to wipe all messages --- css/style.css | 18 ++++++++++++++---- js/devel/contactlist.js | 8 +++++++- js/devel/settings.js | 6 ++++++ templates/main.php | 3 +++ 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/css/style.css b/css/style.css index 225b64c..5838bea 100644 --- a/css/style.css +++ b/css/style.css @@ -235,15 +235,25 @@ width: auto; } -#app-settings-content .new-button { - width: 32px; +#app-settings-content .new-button, #app-settings-content .crit-button { + height: 34px; + vertical-align: middle; background-size: 16px; background-position: center; background-repeat: no-repeat; - height: 34px; - vertical-align: middle; } +#app-settings-content .new-button { + width: 32px; +} + +#app-settings-content .crit-button { + width: 200px; + background-color: #822C19; + padding: 0 2em; +} + + #app-settings-content input[type="checkbox"] { vertical-align: middle; cursor: pointer; diff --git a/js/devel/contactlist.js b/js/devel/contactlist.js index 62accf4..1824578 100644 --- a/js/devel/contactlist.js +++ b/js/devel/contactlist.js @@ -18,12 +18,18 @@ var ContactList = new Vue({ lastTotalUnreadCount: 0 }, created: function () { - this.contacts = []; + this.reset(); this.fetch(); this.checkNewMessages(); setInterval(this.checkNewMessages, 10000); }, methods: { + reset: function () { + this.contacts = []; + this.lastRetrievedMessageDate = 0; + this.totalUnreadMessages = 0; + this.lastTotalUnreadCount = 0; + }, fetch: function () { var self = this; // Now bind the events when we click on the phone number diff --git a/js/devel/settings.js b/js/devel/settings.js index 5ca0a24..441b52a 100644 --- a/js/devel/settings.js +++ b/js/devel/settings.js @@ -70,6 +70,12 @@ var SmsSettings = new Vue({ 'country': self.country } ); + }, + wipeAllMessages: function () { + $.post(Sms.generateURL('/front-api/v1/delete/all'), {}, function () { + ContactList.reset(); + Conversation.clear(); + }); } } }); \ No newline at end of file diff --git a/templates/main.php b/templates/main.php index 5b57814..d5802d6 100644 --- a/templates/main.php +++ b/templates/main.php @@ -72,6 +72,9 @@ use \OCA\OcSms\Lib\CountryCodes; +
+ +