String refactoring on /app + added discard confirm in pages.meet
This commit is contained in:
parent
08bc50fcea
commit
9529520bcd
|
@ -61,7 +61,7 @@ app.pages.meet = {
|
||||||
if (item.account.props.gender === undefined)
|
if (item.account.props.gender === undefined)
|
||||||
item.account.props.gender = 'unspecified';
|
item.account.props.gender = 'unspecified';
|
||||||
if (item.account.props.place === undefined)
|
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)
|
if (item.account.props.pcolors === undefined)
|
||||||
item.account.props.pcolors = {};
|
item.account.props.pcolors = {};
|
||||||
|
|
||||||
|
@ -176,11 +176,16 @@ app.pages.meet = {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
discard: function() {
|
discard: async function() {
|
||||||
document.activeElement.blur();
|
document.activeElement.blur();
|
||||||
const current = app.pages.meet.dataCurrent();
|
const current = app.pages.meet.dataCurrent();
|
||||||
if (current === undefined || current === null)
|
if (current === undefined || current === null)
|
||||||
return app.toast.error(s('app.error.unknown_error'));
|
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) {
|
api.accounts.block(current.account.url, function(json) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
for (var i = app.pages.meet.data.length-1; i >= 0; i--)
|
for (var i = app.pages.meet.data.length-1; i >= 0; i--)
|
||||||
|
|
|
@ -44,7 +44,7 @@ app.pages.quiz = {
|
||||||
if (json.from.props.gender === undefined)
|
if (json.from.props.gender === undefined)
|
||||||
json.from.props.gender = 'unspecified';
|
json.from.props.gender = 'unspecified';
|
||||||
if (json.from.props.place === undefined)
|
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');
|
const container = document.getElementById('app-container');
|
||||||
container.innerHTML = app.template.fill(json, app.template.get('quiz.index'),
|
container.innerHTML = app.template.fill(json, app.template.get('quiz.index'),
|
||||||
function(k,v) {
|
function(k,v) {
|
||||||
|
@ -158,7 +158,7 @@ app.pages.quiz = {
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
discard: async function() {
|
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;
|
return false;
|
||||||
const dt = page().data;
|
const dt = page().data;
|
||||||
if (dt.from === undefined)
|
if (dt.from === undefined)
|
||||||
|
@ -168,7 +168,7 @@ app.pages.quiz = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
send: async function() {
|
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;
|
return false;
|
||||||
const form = document.querySelector('form#quiz');
|
const form = document.querySelector('form#quiz');
|
||||||
var data = { quiz_id: page().data.id };
|
var data = { quiz_id: page().data.id };
|
||||||
|
@ -183,7 +183,7 @@ app.pages.quiz = {
|
||||||
if (json.error !== undefined)
|
if (json.error !== undefined)
|
||||||
app.toast.error(app.strings.app.error[json.error]);
|
app.toast.error(app.strings.app.error[json.error]);
|
||||||
else if (json.result === 1) {
|
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);
|
setTimeout(function(){ exit() }, app.toast.DEFAULT_MILLIS);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue