1
0
mirror of https://github.com/nerzhul/ocsms.git synced 2025-06-07 16:06:15 +00:00

Add a button to wipe all messages

This commit is contained in:
Loic Blot 2018-09-08 00:52:08 +02:00 committed by Loïc Blot
parent 267872b396
commit f034644459
4 changed files with 30 additions and 5 deletions

View File

@ -235,15 +235,25 @@
width: auto; width: auto;
} }
#app-settings-content .new-button { #app-settings-content .new-button, #app-settings-content .crit-button {
width: 32px; height: 34px;
vertical-align: middle;
background-size: 16px; background-size: 16px;
background-position: center; background-position: center;
background-repeat: no-repeat; 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"] { #app-settings-content input[type="checkbox"] {
vertical-align: middle; vertical-align: middle;
cursor: pointer; cursor: pointer;

View File

@ -18,12 +18,18 @@ var ContactList = new Vue({
lastTotalUnreadCount: 0 lastTotalUnreadCount: 0
}, },
created: function () { created: function () {
this.contacts = []; this.reset();
this.fetch(); this.fetch();
this.checkNewMessages(); this.checkNewMessages();
setInterval(this.checkNewMessages, 10000); setInterval(this.checkNewMessages, 10000);
}, },
methods: { methods: {
reset: function () {
this.contacts = [];
this.lastRetrievedMessageDate = 0;
this.totalUnreadMessages = 0;
this.lastTotalUnreadCount = 0;
},
fetch: function () { fetch: function () {
var self = this; var self = this;
// Now bind the events when we click on the phone number // Now bind the events when we click on the phone number

View File

@ -70,6 +70,12 @@ var SmsSettings = new Vue({
'country': self.country 'country': self.country
} }
); );
},
wipeAllMessages: function () {
$.post(Sms.generateURL('/front-api/v1/delete/all'), {}, function () {
ContactList.reset();
Conversation.clear();
});
} }
} }
}); });

View File

@ -72,6 +72,9 @@ use \OCA\OcSms\Lib\CountryCodes;
<option value="0"><?php p($l->t('Disable'));?></option> <option value="0"><?php p($l->t('Disable'));?></option>
</select> </select>
</div> </div>
<div>
<button class="crit-button primary" v-on:click="wipeAllMessages();">Reset all messages</button>
</div>
</div> <!-- app-settings-content --> </div> <!-- app-settings-content -->
</div> </div>
<div id="app-conversation"> <div id="app-conversation">