Added more features (map toggle, return to start), made things look a lot lot lot nicer imo

This commit is contained in:
root 2019-11-28 01:14:29 +01:00
parent c61adb84e2
commit 3b6f10431f
5 changed files with 58 additions and 30 deletions

View File

@ -216,6 +216,8 @@ class RemoveCoordView(View):
if game.challenge:
round.score = 30000
round.guess_lat = 0
round.guess_lng = 0
round.save()
next = round.order + 1
next_round = GameRound.objects.filter(
@ -233,6 +235,7 @@ class RemoveCoordView(View):
)
)
else:
round.game.challenge.update_average_score()
return redirect(
reverse_lazy(
'game:end-recap-view',
@ -319,7 +322,7 @@ class GameRecapView(views.UserPassesTestMixin, TemplateView):
coord_results.append(
[
[round.coord.lat, round.coord.lng],
[round.guess_lat, round.guess_lng]
[round.guess_lat if round.guess_lat else 0, round.guess_lng if round.guess_lng else 0]
]
)

View File

@ -17,7 +17,7 @@
Your average guess was {{average_distance|intcomma}}m away.{% if all_average %} The average for this challenge is {{all_average|intcomma}}m{%endif%}
</div>
<div id="map" class="map"></div>
<div id="map" class="guessMap"></div>
<a class="btn btn-success btn-lg btn-block" href="{% url 'home' %}" role="button">Homepage</a>

View File

@ -69,9 +69,7 @@
<p>For now I have managed to find some data on uk coordinates that I can use, but its not so easy getting data for other countries.</p>
<p><strong>I didn't receive my email reset password, what gives?</strong></p>
<p>I am using a free mail server to send password reset emails, the limit is 100/day.</p>
<p>If you require assisstance accessing your account, please email edward.wilding3@gmail.com</p>
<p><strong>This site is atrocious and you should feel bad</strong></p>
<p>Firstly that isn't a question, secondly that hurts my feelings, thirdly I built it in 2 days after geoguessr changed their site.</p>
<p>If you require assistance accessing your account, please email edward.wilding3@gmail.com</p>
<p><strong>This site is amazing, how can I contact you to discuss this, or another, site?</strong></p>
<p>Thank you! Please get in touch: edward.wilding3@gmail.com</p>

View File

@ -2,41 +2,39 @@
{% block content %}
{% if messages %}
<div class="container">
<div class="row">
<div class="col-lg-12">
{% if messages %}
{% for message in messages %}
<div class="alert alert-{{message.tags}}">
{{ message }}
</div>
{% endfor %}
</div>
</div>
</div>
{% endif %}
<div id="map" class="map"></div>
<div id="map" class="map panoramaMap"></div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div id="map2" class="map guessMap"></div>
<div id="map2" class="map"></div>
<form action="{% url 'game:round-view' game_pk=game_pk round_pk=round_pk %}" method="POST">
<div class="mapButtons">
<button id="resizeMap" type="submit" class="btn btn-dark btn-circle btn-xl mapButton" title="Toggle Map">Map</button>
<button id="returnToStart" type="submit" class="btn btn-info btn-circle btn-xl mapButton" title="Return To Start">Start</button>
<form class="mapForm" action="{% url 'game:round-view' game_pk=game_pk round_pk=round_pk %}" method="POST">
{{ form.non_field_errors }}
{% csrf_token %}
{{form.as_p}}
<button type="submit" class="btn btn-primary btn-block">Make Guess</button>
<button type="submit" class="btn btn-primary btn-circle btn-xl mapButton" title="Make Your Guess">Guess</button>
</form>
<form action="{% url 'game:remove-coord' game_pk=game_pk round_pk=round_pk %}" method="POST">
<form class="mapForm" action="{% url 'game:remove-coord' game_pk=game_pk round_pk=round_pk %}" method="POST" onsubmit="return confirm('Are you sure this streetview is broken?');">
{% csrf_token %}
<button type="submit" class="btn btn-warning btn-block">Broken Streetview</button>
<button type="submit" class="btn btn-warning btn-circle btn-xl mapButton" title="Report Broken Streetview">Broken</button>
</form>
</div>
</div>
</div>
<script>
@ -78,8 +76,37 @@
map: map2
});
};
function returnToStart() {
panorama.setPosition(new google.maps.LatLng({{lat}},{{lng}}));
};
document.getElementById("returnToStart").addEventListener("click", function(){
returnToStart()
});
var toggle = false
document.getElementById("resizeMap").addEventListener("click", function(){
if (toggle == true) {
console.log("show it");
toggle = false;
document.getElementById('map2').style.minHeight = "40vh";
document.getElementById('map2').style.height = "40vh";
document.getElementById('map').style.height = "53vh";
} else {
console.log("hide it");
toggle = true;
document.getElementById('map2').style.minHeight = "0vh";
document.getElementById('map2').style.height = "0vh";
document.getElementById('map').style.height = "93vh";
};
google.maps.event.trigger(panorama, 'resize');
});
}
</script>
<script async defer

View File

@ -17,7 +17,7 @@
Your guess was {{distance|intcomma}}m away.
</div>
<div id="map" class="map"></div>
<div id="map" class="guessMap"></div>
{% if last_round %}
<a class="btn btn-success btn-lg btn-block" href="{% url 'game:end-recap-view' game_pk=game_id %}" role="button">Game Recap</a>