From 83ad0aa34970ebe9d07b08b49465c61ddb9b0073 Mon Sep 17 00:00:00 2001 From: sairaj mote Date: Thu, 15 Sep 2022 16:44:43 +0530 Subject: [PATCH] minor code refactoring --- index.html | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/index.html b/index.html index aa6299c..28102a7 100644 --- a/index.html +++ b/index.html @@ -53,8 +53,8 @@

- Cancel - OK + Cancel + OK
@@ -998,16 +998,17 @@ // displays a popup for asking permission. Use this instead of JS confirm - const getConfirmation = (title, message, cancelText = 'Cancel', confirmText = 'OK') => { + const getConfirmation = (title, options = {}) => { return new Promise(resolve => { + const { message = '', cancelText = 'Cancel', confirmText = 'OK' } = options openPopup('confirmation_popup', true) - getRef('confirm_title').textContent = title; - getRef('confirm_message').textContent = message; - let cancelButton = getRef('confirmation_popup').children[2].children[0], - submitButton = getRef('confirmation_popup').children[2].children[1] - submitButton.textContent = confirmText + getRef('confirm_title').innerText = title; + getRef('confirm_message').innerText = message; + const cancelButton = getRef('confirmation_popup').querySelector('.cancel-button'); + const confirmButton = getRef('confirmation_popup').querySelector('.confirm-button') + confirmButton.textContent = confirmText cancelButton.textContent = cancelText - submitButton.onclick = () => { + confirmButton.onclick = () => { closePopup() resolve(true); } @@ -2093,7 +2094,7 @@ } function signOut() { - getConfirmation('Sign out?', 'You are about to sign out of the app, continue?', 'Stay', 'Leave') + getConfirmation('Sign out?', { message: 'You are about to sign out of the app, continue?', confirmText: 'Stay', cancelText: 'Leave' }) .then(async (res) => { if (res) { await floDapps.clearCredentials(); @@ -2523,13 +2524,13 @@ if (type === 'task') { result = RIBC.admin.processTaskRequest(vectorClock, true) if (result === 'Accepted') { - notify('Intern assigned.', 'success') + notify('Intern assigned, commit changes to make it permanent.', 'success') removeRequest(e.delegateTarget.closest('.request-card')) } } else if (type === 'internship') { result = RIBC.admin.processInternRequest(vectorClock, true) if (result === 'Accepted') { - notify('Added intern', 'success') + notify('Added intern, commit changes to make it permanent.', 'success') removeRequest(e.delegateTarget.closest('.request-card')) } }