Show up a button to the Quiz related to pages.meet item

This commit is contained in:
Niko 2022-02-23 15:32:20 +01:00
parent 8dc1923219
commit 4e3501ce37
6 changed files with 37 additions and 2 deletions

View File

@ -220,6 +220,13 @@ main {
position: relative;
top: 2px;
}
#meet-actions *[href*="actions.quiz"] .fa {
font-size: 2.5em;
filter: brightness(160%);
color: var(--clr_quiz) !important;
position: relative;
top: 2px;
}
#meet-actions *[href*="actions.discard"] .fa {
font-size: 1.8em;
color: #ffd841 !important;

View File

@ -202,6 +202,14 @@ app.pages.meet = {
}
});
},
quiz: function() {
document.activeElement.blur();
const current = app.pages.meet.dataCurrent();
if (current === undefined || current === null ||
typeof current.quiz_id !== 'string')
return app.toast.error(s('app.error.unknown_error'));
hashredir(`quiz/${current.quiz_id}`);
},
},
carousel: {
_current: 0,
@ -220,6 +228,15 @@ app.pages.meet = {
app.pages.meet.actions._hide();
else app.pages.meet.actions._show();
if (typeof current.quiz_id === 'string') {
document.getElementById('meet-action-crush').style.display = 'none';
document.getElementById('meet-action-quiz').style.removeProperty('display');
app.template.load('quiz.index');
} else {
document.getElementById('meet-action-crush').style.removeProperty('display');
document.getElementById('meet-action-quiz').style.display = 'none';
}
const trail = document.querySelector('#page-meet #trail');
const index = app.pages.meet.carousel._current;
if (trail !== null) {

View File

@ -20,7 +20,8 @@ app.pages.quiz = {
await app.template.loadMany(['quiz.index']);
app.pages.quiz.data = json;
app.pages.quiz.paint(json);
if (getNormalizedURI() === app.vars.app_dir)
if (getNormalizedURI() === app.vars.app_dir &&
window.prevHash === '')
animateTimeout('#quiz', 'slide-from-right');
};
if (data === undefined)

View File

@ -14,12 +14,20 @@
<i class="center fa fa-times-circle fa-fw"></i>
</div>
</a>
<a class="component icon button light round" title="{s:alt.nav_crush}"
<a id="meet-action-crush"
class="component icon button light round" title="{s:alt.nav_crush}"
href="javascript:app.pages.meet.actions.crush()">
<div class="ic-container flex">
<i class="center fa fa-heart fa-fw"></i>
</div>
</a>
<a id="meet-action-quiz"
class="component icon button light round" title="{s:alt.action_quiz}"
href="javascript:app.pages.meet.actions.quiz()">
<div class="ic-container flex">
<i class="center fa fa-quote-right fa-fw"></i>
</div>
</a>
<a class="component icon button light round" title="{s:alt.nav_crush}"
href="javascript:app.pages.meet.actions.maybe()">
<div class="ic-container flex">

View File

@ -4,6 +4,7 @@ $strings = [
'alt' => [
'nav_crush' => 'Mark this person as your new crush!',
'nav_close' => 'Close this window',
'action_quiz' => 'Fill the quiz requested by your crush',
],
'form' => [
'login' => 'Log in',

View File

@ -4,6 +4,7 @@ $strings = [
'alt' => [
'nav_crush' => '¡Marcar a esta persona como tu nuevo crush!',
'nav_close' => 'Cerrar esta ventana',
'action_quiz' => 'Rellena el quiz que te ha pedido tu crush',
],
'form' => [
'login' => 'Iniciar sesión',