Commit 7b54b9ff authored by antoine-boiteau's avatar antoine-boiteau
Browse files

Addition of a print button on the list of courses, it uses the same function...

Addition of a print button on the list of courses, it uses the same function as the previous print button from the course/id/info page.
parent 919c039d
......@@ -175,4 +175,9 @@ function showPreview(data, divXml, divMap, divLeaflet, map, overlay, img) {
previewXml(data, divXml);
previewMap(data, divMap, divLeaflet, map, overlay, img);
addControlPointOnMap(data, map);
}
\ No newline at end of file
}
function printMap(imageURL){ //see library printJS for further print options.
let printableMap = window.open(window.location.origin + "/" + imageURL);
printableMap.print();
}
......@@ -2,17 +2,25 @@
{% block title %}{% trans %}courses.title{% endtrans %}{% endblock %}
{% block javascripts %}
<script src="{{ asset('/public/javascript/showMap.js') }}"></script>
{% endblock %}
{% block body %}
<div class="container" style="padding-top: 20pt">
<h2 class="text-center">{% trans %}courses.title{% endtrans %}</h2>
<div class="border border-secondary rounded">
{% for course in courses %}
<div class="list-group list-group-item-action d-flex flex-row align-items-center p-2">
<div class="d-flex flex-column">
<div class="list-group list-group-item-action d-flex flex-row flex-wrap justify-content-end align-items-center p-2">
<div class="d-flex flex-column mr-auto" style="max-width: 35vw">
<span class="list-group-item-secondary">{{ course.name }}</span>
<span class="flex-shrink-1 badge badge-primary badge-pill">{% trans %}course.number_of_routes{% endtrans %}: {{ course.orienteer|length }}</span>
</div>
<a href="{{ path('show_info', {id: course.id}) }}" class="ml-auto btn btn-primary">{% trans %}course.show.info{% endtrans %}</a>
{% if course.printable %}
<button onclick="printMap('{{ course.image }}')" class="btn btn-secondary">{% trans %}Imprimer la carte{% endtrans %}</button>
{% endif %}
<a href="{{ path('show_info', {id: course.id}) }}" class="ml-2 btn btn-primary">{% trans %}course.show.info{% endtrans %}</a>
<a href="{{ path('show_tracks', {id: course.id}) }}" class="ml-2 btn btn-primary">{% trans %}course.show.tracks{% endtrans %}</a>
</div>
{% endfor %}
......
......@@ -57,11 +57,6 @@
overlay.setOpacity(overlayOpacity);
}
function printMap(){ //see library printJS for further print options.
let printableMap = window.open(window.location.origin + "/" + imageURL);
printableMap.print();
}
window.addEventListener("load", function () {
divLeaflet = document.createElement("div");
map = generateMap(divLeaflet);
......@@ -88,7 +83,7 @@
<button class="btn btn-primary" id="show-map" onclick="switchMapDisplay()" style="position: absolute; z-index: 9999; top: 60px; right: 35px">{% trans %} course.description.mask.map {% endtrans %}</button>
<button class="btn btn-primary" id="hide-map" onclick="switchMapDisplay()" style="display:none; position: absolute; z-index: 9999; top: 60px; right: 35px">{% trans %} course.description.show.map {% endtrans %}</button>
{% if isPrintable %}
<button class="btn btn-primary" onclick="printMap()" style="position: absolute; z-index: 9999; top: 105px; right: 35px">{% trans %} course.description.print {% endtrans %}</button>
<button class="btn btn-primary" onclick="printMap(imageURL)" style="position: absolute; z-index: 9999; top: 105px; right: 35px">{% trans %} course.description.print {% endtrans %}</button>
{% endif %}
<div id="map-div" style="min-width: 300px">
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment