refined controls

This commit is contained in:
Steffen 2020-04-11 23:02:04 +02:00
parent 6722053d9c
commit 93ac7145b2
No known key found for this signature in database
GPG Key ID: 764D74E98267DFC6
1 changed files with 16 additions and 2 deletions

View File

@ -49,10 +49,10 @@
<li @click="clearRoles" v-if="players.length"> <li @click="clearRoles" v-if="players.length">
Clear Roles Clear Roles
</li> </li>
<li @click="isEditionModalOpen = true" v-if="players.length > 4"> <li @click="showEditionModal" v-if="players.length > 4">
Select Edition Select Edition
</li> </li>
<li @click="isRoleModalOpen = true" v-if="players.length > 4"> <li @click="showRoleModal" v-if="players.length > 4">
Select Roles Select Roles
</li> </li>
</ul> </ul>
@ -103,6 +103,8 @@ export default {
} }
}, },
randomizeSeatings() { randomizeSeatings() {
this.isPublic = false;
this.isControlOpen = false;
if (confirm("Are you sure you want to randomize seatings?")) { if (confirm("Are you sure you want to randomize seatings?")) {
this.players = this.players this.players = this.players
.map(a => [Math.random(), a]) .map(a => [Math.random(), a])
@ -111,11 +113,13 @@ export default {
} }
}, },
clearPlayers() { clearPlayers() {
this.isControlOpen = false;
if (confirm("Are you sure you want to remove all players?")) { if (confirm("Are you sure you want to remove all players?")) {
this.players = []; this.players = [];
} }
}, },
clearRoles() { clearRoles() {
this.isControlOpen = false;
if (confirm("Are you sure you want to remove all player roles?")) { if (confirm("Are you sure you want to remove all player roles?")) {
this.players.forEach(player => { this.players.forEach(player => {
player.role = {}; player.role = {};
@ -134,10 +138,20 @@ export default {
.map(role => [role.id, role]) .map(role => [role.id, role])
); );
}, },
showEditionModal() {
this.isEditionModalOpen = true;
this.isPublic = false;
this.isControlOpen = false;
},
setEdition(edition) { setEdition(edition) {
this.edition = edition; this.edition = edition;
this.isEditionModalOpen = false; this.isEditionModalOpen = false;
}, },
showRoleModal() {
this.isRoleModalOpen = true;
this.isPublic = false;
this.isControlOpen = false;
},
keyup({ key }) { keyup({ key }) {
switch (key) { switch (key) {
case "g": case "g":