VC/Zoom: Confirm making yourself alternative host (#149)

This commit is contained in:
Javier Ferrer 2021-06-25 18:11:22 +02:00 committed by GitHub
parent e37eff0f93
commit a9ccd18b3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 53 additions and 11 deletions

View File

@ -7,6 +7,12 @@ source_file = vc_zoom/indico_vc_zoom/translations/messages.pot
source_lang = en
type = PO
[indico.vc-zoom-messages-js]
file_filter = vc_zoom/indico_vc_zoom/translations/<lang>/LC_MESSAGES/messages-js.po
source_file = vc_zoom/indico_vc_zoom/translations/messages-js.pot
source_lang = en
type = PO
[indico.piwik-messages]
file_filter = piwik/indico_piwik/translations/<lang>/LC_MESSAGES/messages.po
source_file = piwik/indico_piwik/translations/messages.pot

View File

@ -5,8 +5,12 @@
// them and/or modify them under the terms of the MIT License;
// see the LICENSE file for more details.
/* global confirmPrompt:false, $T:false */
import {handleAxiosError, indicoAxios} from 'indico/utils/axios';
const $t = $T.domain('vc_zoom');
document.addEventListener('DOMContentLoaded', async () => {
$('.vc-toolbar').dropdown({
positioning: {
@ -15,15 +19,20 @@ document.addEventListener('DOMContentLoaded', async () => {
});
document.querySelectorAll('.vc-toolbar .action-make-host').forEach(elem => {
elem.addEventListener('click', async () => {
const killProgress = IndicoUI.Dialogs.Util.progress();
try {
await indicoAxios.post(elem.dataset.href);
window.location.reload();
} catch (error) {
handleAxiosError(error);
killProgress();
}
elem.addEventListener('click', () => {
confirmPrompt(
$t.gettext('Are you sure you want to be added as an alternative host?'),
$t.gettext('Make me an alternative host')
).then(async () => {
const killProgress = IndicoUI.Dialogs.Util.progress();
try {
await indicoAxios.post(elem.dataset.href);
window.location.reload();
} catch (error) {
handleAxiosError(error);
killProgress();
}
});
});
});
});

View File

@ -7,7 +7,7 @@
<li>
<a href="#"
title="{% trans %}You will become an alternative host of this Zoom meeting{% endtrans %}"
class="action-make-host"}}"
class="action-make-host"
data-href="{{ url_for_plugin('vc_zoom.make_me_alt_host', event_vc_room) }}">
{% trans %}Make me alternative host{% endtrans %}
</a>

View File

@ -0,0 +1,27 @@
# Translations template for PROJECT.
# Copyright (C) 2021 ORGANIZATION
# This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2021.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2021-06-25 18:04+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: indico_vc_zoom/client/index.js:24
msgid "Are you sure you want to be added as an alternative host?"
msgstr ""
#: indico_vc_zoom/client/index.js:25
msgid "Make me an alternative host"
msgstr ""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2021-05-26 17:54+0200\n"
"POT-Creation-Date: 2021-06-25 18:04+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"