String refactoring on /app + added discard confirm in pages.meet

This commit is contained in:
Niko 2022-03-02 02:11:16 +01:00
parent 08bc50fcea
commit 9529520bcd
2 changed files with 11 additions and 6 deletions

View File

@ -61,7 +61,7 @@ app.pages.meet = {
if (item.account.props.gender === undefined)
item.account.props.gender = 'unspecified';
if (item.account.props.place === undefined)
item.account.props.place = app.strings.app.the_fediverse;
item.account.props.place = s('app.the_fediverse');
if (item.account.props.pcolors === undefined)
item.account.props.pcolors = {};
@ -176,11 +176,16 @@ app.pages.meet = {
}
});
},
discard: function() {
discard: async function() {
document.activeElement.blur();
const current = app.pages.meet.dataCurrent();
if (current === undefined || current === null)
return app.toast.error(s('app.error.unknown_error'));
if (typeof current.quiz_id !== 'string' &&
!await app.toast.warnConfirm(s('app.confirm.crush_discard')))
return false;
api.accounts.block(current.account.url, function(json) {
setTimeout(function() {
for (var i = app.pages.meet.data.length-1; i >= 0; i--)

View File

@ -44,7 +44,7 @@ app.pages.quiz = {
if (json.from.props.gender === undefined)
json.from.props.gender = 'unspecified';
if (json.from.props.place === undefined)
json.from.props.place = app.strings.app.the_fediverse;
json.from.props.place = s('app.the_fediverse');
const container = document.getElementById('app-container');
container.innerHTML = app.template.fill(json, app.template.get('quiz.index'),
function(k,v) {
@ -158,7 +158,7 @@ app.pages.quiz = {
},
actions: {
discard: async function() {
if (!await app.toast.warnConfirm(app.strings.app.confirm.crush_discard))
if (!await app.toast.warnConfirm(s('app.confirm.crush_discard')))
return false;
const dt = page().data;
if (dt.from === undefined)
@ -168,7 +168,7 @@ app.pages.quiz = {
});
},
send: async function() {
if (!await app.toast.infoConfirm(app.strings.app.confirm.crush_send_quiz))
if (!await app.toast.infoConfirm(s('app.confirm.crush_send_quiz')))
return false;
const form = document.querySelector('form#quiz');
var data = { quiz_id: page().data.id };
@ -183,7 +183,7 @@ app.pages.quiz = {
if (json.error !== undefined)
app.toast.error(app.strings.app.error[json.error]);
else if (json.result === 1) {
app.toast.info(app.strings.app.ok.quiz_sent);
app.toast.info(s('app.ok.quiz_sent_wait'));
setTimeout(function(){ exit() }, app.toast.DEFAULT_MILLIS);
}
});