1
0
mirror of https://github.com/nextcloud/ocsms.git synced 2026-08-22 05:43:07 +00:00

Add a generic modal to wipe data properly

This commit is contained in:
Loic Blot
2018-09-08 11:33:24 +02:00
committed by Loïc Blot
parent e2999f37ad
commit 38235b1a60
3 changed files with 127 additions and 4 deletions
+26 -2
View File
@@ -73,8 +73,6 @@ var ContactRenderer = {
}
};
Vue.filter('firstCharacter', ContactRenderer.generateFirstCharacter);
$.urlParam = function (name) {
var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
if (results == null) {
@@ -85,6 +83,32 @@ $.urlParam = function (name) {
}
};
Vue.filter('firstCharacter', ContactRenderer.generateFirstCharacter);
const Dialog = Vue.extend({
template: '#modal-template'
});
Vue.directive('confirm', {
bind(el, binding, vnode) {
const yesMethod = binding.value[1];
const bodyMessage = binding.value[0];
console.log(bodyMessage);
el.handleClick = (e) => {
const data = {
doYes: function () { yesMethod(); data.show = false; },
show: true,
bodyMessage: bodyMessage
};
let dialog = new Dialog({ data: data }).$mount();
document.getElementById('app').appendChild(dialog.$el);
}
el.addEventListener('click', el.handleClick);
},
unbind(el) {
el.removeEventListener('click', el.handleClick);
}
});
(function ($, OC) {
// reset count and title
window.onfocus = function () {