MAPG-235 allow only logged in users to start a challenge
This commit is contained in:
parent
517d758e8e
commit
ae7fd98256
@ -112,13 +112,15 @@
|
|||||||
document.getElementById('playMode').style.visibility = 'hidden';
|
document.getElementById('playMode').style.visibility = 'hidden';
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById('challengeButton').onclick = function () {
|
if (document.getElementById('challengeButton')) {
|
||||||
MapGuesser.showModal('challenge');
|
document.getElementById('challengeButton').onclick = function () {
|
||||||
document.getElementById('createNewChallengeButton').href = '/challenge/new/' + this.dataset.mapId;
|
MapGuesser.showModal('challenge');
|
||||||
document.getElementById('playMode').style.visibility = 'hidden';
|
document.getElementById('createNewChallengeButton').href = '/challenge/new/' + this.dataset.mapId;
|
||||||
|
document.getElementById('playMode').style.visibility = 'hidden';
|
||||||
var timeLimit = document.getElementById('timeLimit').value;
|
|
||||||
document.getElementById('timeLimitLabel').innerText = 'Time limit of ' + timeLimit + ' seconds per round';
|
var timeLimit = document.getElementById('timeLimit').value;
|
||||||
|
document.getElementById('timeLimitLabel').innerText = 'Time limit of ' + timeLimit + ' seconds per round';
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById('closePlayModeButton').onclick = function () {
|
document.getElementById('closePlayModeButton').onclick = function () {
|
||||||
|
@ -48,6 +48,7 @@ class MapsController
|
|||||||
$user = $this->request->user();
|
$user = $this->request->user();
|
||||||
return new HtmlContent('maps', [
|
return new HtmlContent('maps', [
|
||||||
'maps' => $maps,
|
'maps' => $maps,
|
||||||
|
'isLoggedIn' => $user !== null,
|
||||||
'isAdmin' => $user !== null && $user->hasPermission(IUser::PERMISSION_ADMIN)
|
'isAdmin' => $user !== null && $user->hasPermission(IUser::PERMISSION_ADMIN)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,10 @@ TODO: condition!
|
|||||||
<a id="singleButton" class="button fullWidth marginTop" href="" title="Single player">Single player</a>
|
<a id="singleButton" class="button fullWidth marginTop" href="" title="Single player">Single player</a>
|
||||||
<p class="bold center marginTop marginBottom">OR</p>
|
<p class="bold center marginTop marginBottom">OR</p>
|
||||||
<button id="multiButton" class="fullWidth green" data-map-id="">Multiplayer (beta)</button>
|
<button id="multiButton" class="fullWidth green" data-map-id="">Multiplayer (beta)</button>
|
||||||
<p class="bold center marginTop marginBottom">OR</p>
|
<?php if ($isLoggedIn): ?>
|
||||||
<button id="challengeButton" class="fullWidth yellow" data-map-id="" data-timer="">Challenge (gamma)</button>
|
<p class="bold center marginTop marginBottom">OR</p>
|
||||||
|
<button id="challengeButton" class="fullWidth yellow" data-map-id="" data-timer="">Challenge (gamma)</button>
|
||||||
|
<?php endif; ?>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
<button id="closePlayModeButton" class="gray marginTop" type="button">Close</button>
|
<button id="closePlayModeButton" class="gray marginTop" type="button">Close</button>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user