Skip to content

Commit

Permalink
Prevent users selecting display links until server selected
Browse files Browse the repository at this point in the history
  • Loading branch information
versx committed Dec 28, 2020
1 parent e346427 commit be13940
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/views/index.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<div class="row">
<div class="col-md p-1">
<div class="list-group">
<a class="list-group-item" href="/pokemon">
<a class="list-group-item" href="/pokemon" onclick="return isServerSelected();">
<h3 class="pull-right"><img src="./img/pokemon.png" width="64" height="64"/></h3>
<h4 class="list-group-item-heading text-light pokemon_count">{{pokemon_count}}</h4>
<p class="list-group-item-text text-light">{{Pokemon}}</p>
Expand All @@ -26,7 +26,7 @@
</div>
<div class="col-md p-1">
<div class="list-group">
<a class="list-group-item" href="/pokemon#pvp">
<a class="list-group-item" href="/pokemon#pvp" onclick="return isServerSelected();">
<h3 class="pull-right"><img src="./img/pvp.png" width="64" height="64"/></h3>
<h4 class="list-group-item-heading text-light pvp_count">{{pvp_count}}</h4>
<p class="list-group-item-text text-light">{{PVP}}</p>
Expand All @@ -37,7 +37,7 @@
<div class="row">
<div class="col-md p-1">
<div class="list-group">
<a class="list-group-item" href="/raids">
<a class="list-group-item" href="/raids" onclick="return isServerSelected();">
<h3 class="pull-right"><img src="./img/raids.png" width="64" height="64"/></h3>
<h4 class="list-group-item-heading text-light raids_count">{{raids_count}}</h4>
<p class="list-group-item-text text-light">{{Raids}}</p>
Expand All @@ -46,7 +46,7 @@
</div>
<div class="col-md p-1">
<div class="list-group">
<a class="list-group-item" href="/raids#gyms">
<a class="list-group-item" href="/raids#gyms" onclick="return isServerSelected();">
<h3 class="pull-right"><img src="./img/gyms.png" width="64" height="64"/></h3>
<h4 class="list-group-item-heading text-light gyms_count">{{gyms_count}}</h4>
<p class="list-group-item-text text-light">{{Gyms}}</p>
Expand All @@ -57,7 +57,7 @@
<div class="row">
<div class="col-md p-1">
<div class="list-group">
<a class="list-group-item" href="/quests">
<a class="list-group-item" href="/quests" onclick="return isServerSelected();">
<h3 class="pull-right"><img src="./img/quests.png" width="64" height="64"/></h3>
<h4 class="list-group-item-heading text-light quests_count">{{quests_count}}</h4>
<p class="list-group-item-text text-light">{{Quests}}</p>
Expand All @@ -66,7 +66,7 @@
</div>
<div class="col-md p-1">
<div class="list-group">
<a class="list-group-item" href="/invasions">
<a class="list-group-item" href="/invasions" onclick="return isServerSelected();">
<h3 class="pull-right"><img src="./img/invasions.png" width="64" height="64"/></h3>
<h4 class="list-group-item-heading text-light invasions_count">{{invasions_count}}</h4>
<p class="list-group-item-text text-light">{{Invasions}}</p>
Expand All @@ -77,7 +77,7 @@
<div class="row">
<div class="col-md p-1">
<div class="list-group">
<a class="list-group-item" href="/lures">
<a class="list-group-item" href="/lures" onclick="return isServerSelected();">
<h3 class="pull-right"><img src="./img/lures/501.png" width="64" height="64"/></h3>
<h4 class="list-group-item-heading text-light lures_count">{{lures_count}}</h4>
<p class="list-group-item-text text-light">{{Lures}}</p>
Expand Down Expand Up @@ -135,6 +135,11 @@
});
});
function isServerSelected() {
const guildId = $('#server_selector').val();
return guildId !== undefined && guildId !== null;
}
function refreshData() {
$.ajax({
url: "/api/server/" + $('#server_selector').val() + "/user/{{user_id}}?type=subscriptions",
Expand Down

0 comments on commit be13940

Please sign in to comment.