convert linebreaks to <br> when outputting facility description, fixes #569
This commit is contained in:
parent
26e471ef2a
commit
1739297caf
|
@ -38,7 +38,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Description</th>
|
<th>Description</th>
|
||||||
<td>{{ facility.description }}</td>
|
<td>{{ facility.description|linebreaksbr }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Opening Hours</th>
|
<th>Opening Hours</th>
|
||||||
|
@ -125,7 +125,7 @@
|
||||||
function MapReadyCallback() {
|
function MapReadyCallback() {
|
||||||
// add a marker for this facility
|
// add a marker for this facility
|
||||||
var marker = L.marker([{{ facility.location.y }}, {{ facility.location.x }}], {icon: {{ facility.facility_type.marker }}})
|
var marker = L.marker([{{ facility.location.y }}, {{ facility.location.x }}], {icon: {{ facility.facility_type.marker }}})
|
||||||
marker.bindPopup("<b>{{ facility.name }}</b><br><p>{{ facility.description}}</p>").addTo(this);
|
marker.bindPopup("<b>{{ facility.name }}</b><br><p>{{ facility.description|linebreaksbr }}</p>").addTo(this);
|
||||||
// max zoom since we have only one marker
|
// max zoom since we have only one marker
|
||||||
this.setView(marker.getLatLng(), 13);
|
this.setView(marker.getLatLng(), 13);
|
||||||
};
|
};
|
||||||
|
|
|
@ -43,7 +43,7 @@ Facilities | BackOffice | {{ block.super }}
|
||||||
<td>{{ facility.name }}</td>
|
<td>{{ facility.name }}</td>
|
||||||
<td><i class="fas fa-{{ facility.facility_type.icon }} fa-2x fa-fw"></i> {{ facility.facility_type.name }}</td>
|
<td><i class="fas fa-{{ facility.facility_type.icon }} fa-2x fa-fw"></i> {{ facility.facility_type.name }}</td>
|
||||||
<td>{{ facility.team.name }} Team</td>
|
<td>{{ facility.team.name }} Team</td>
|
||||||
<td>{{ facility.description|default:"N/A" }}</td>
|
<td>{{ facility.description|linebreaksbr|default:"N/A" }}</td>
|
||||||
<td>{{ facility.location }}</td>
|
<td>{{ facility.location }}</td>
|
||||||
<td class="text-center"><span class="badge">{{ facility.feedbacks.count }}</span> / <span class="badge">{{ facility.unhandled_feedbacks.count }}</span></td>
|
<td class="text-center"><span class="badge">{{ facility.feedbacks.count }}</span> / <span class="badge">{{ facility.unhandled_feedbacks.count }}</span></td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -69,7 +69,7 @@ function MapReadyCallback() {
|
||||||
var markers = new Array();
|
var markers = new Array();
|
||||||
{% for facility in facility_list %}
|
{% for facility in facility_list %}
|
||||||
{% url "backoffice:facility_detail" camp_slug=facility.camp.slug facility_uuid=facility.uuid as detail %}
|
{% url "backoffice:facility_detail" camp_slug=facility.camp.slug facility_uuid=facility.uuid as detail %}
|
||||||
marker = L.marker([{{ facility.location.y }}, {{ facility.location.x }}], {icon: {{ facility.facility_type.marker }}}).bindPopup("<b>{{ facility.name }}</b><br><p>{{ facility.description }}</p><p>Responsible team: {{ facility.facility_type.responsible_team.name }} Team</p>{% if request.user.is_authenticated %}<p><a href='{{ detail }}' class='btn btn-primary' style='color: white;'><i class='fas fa-search'></i> Details</a></p>{% endif %}").addTo(this);
|
marker = L.marker([{{ facility.location.y }}, {{ facility.location.x }}], {icon: {{ facility.facility_type.marker }}}).bindPopup("<b>{{ facility.name }}</b><br><p>{{ facility.description|linebreaksbr }}</p><p>Responsible team: {{ facility.facility_type.responsible_team.name }} Team</p>{% if request.user.is_authenticated %}<p><a href='{{ detail }}' class='btn btn-primary' style='color: white;'><i class='fas fa-search'></i> Details</a></p>{% endif %}").addTo(this);
|
||||||
markers.push(marker.getLatLng());
|
markers.push(marker.getLatLng());
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
var markerBounds = L.latLngBounds(markers);
|
var markerBounds = L.latLngBounds(markers);
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Description</th>
|
<th>Description</th>
|
||||||
<td>{{ facility.description }}</td>
|
<td>{{ facility.description|linebreaksbr }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Location</th>
|
<th>Location</th>
|
||||||
|
@ -85,7 +85,7 @@ function MapReadyCallback() {
|
||||||
// add a marker for this facility
|
// add a marker for this facility
|
||||||
{% url "facilities:facility_feedback" camp_slug=facility.camp.slug facility_type_slug=facility.facility_type.slug facility_uuid=facility.uuid as feedback %}
|
{% url "facilities:facility_feedback" camp_slug=facility.camp.slug facility_type_slug=facility.facility_type.slug facility_uuid=facility.uuid as feedback %}
|
||||||
var marker = L.marker([{{ facility.location.y }}, {{ facility.location.x }}], {icon: {{ facility.facility_type.marker }}})
|
var marker = L.marker([{{ facility.location.y }}, {{ facility.location.x }}], {icon: {{ facility.facility_type.marker }}})
|
||||||
marker.bindPopup("<b>{{ facility.name }}</b><br><p>{{ facility.description }}</p><p>Responsible team: {{ facility.facility_type.responsible_team.name }} Team</p>{% if request.user.is_authenticated %}<p><a href='{{ feedback }}' class='btn btn-primary' style='color: white;'><i class='fas fa-comment-dots'></i> Feedback</a></p>{% endif %}").addTo(this);
|
marker.bindPopup("<b>{{ facility.name }}</b><br><p>{{ facility.description|linebreaksbr }}</p><p>Responsible team: {{ facility.facility_type.responsible_team.name }} Team</p>{% if request.user.is_authenticated %}<p><a href='{{ feedback }}' class='btn btn-primary' style='color: white;'><i class='fas fa-comment-dots'></i> Feedback</a></p>{% endif %}").addTo(this);
|
||||||
// max zoom since we have only one marker
|
// max zoom since we have only one marker
|
||||||
this.setView(marker.getLatLng(), 13);
|
this.setView(marker.getLatLng(), 13);
|
||||||
};
|
};
|
||||||
|
|
|
@ -45,7 +45,6 @@ Facilities of type {{ facilitytype }} | {{ block.super }}
|
||||||
<a href="{% url "facilities:facility_type_list" camp_slug=camp.slug %}" class="btn btn-default"><i class="fas fa-undo"></i> Back to facility type list</a>
|
<a href="{% url "facilities:facility_type_list" camp_slug=camp.slug %}" class="btn btn-default"><i class="fas fa-undo"></i> Back to facility type list</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function MapReadyCallback() {
|
function MapReadyCallback() {
|
||||||
// loop over facilities and add a marker for each,
|
// loop over facilities and add a marker for each,
|
||||||
|
@ -54,7 +53,7 @@ function MapReadyCallback() {
|
||||||
{% for facility in facility_list %}
|
{% for facility in facility_list %}
|
||||||
{% url "facilities:facility_detail" camp_slug=facility.camp.slug facility_type_slug=facility.facility_type.slug facility_uuid=facility.uuid as detail %}
|
{% url "facilities:facility_detail" camp_slug=facility.camp.slug facility_type_slug=facility.facility_type.slug facility_uuid=facility.uuid as detail %}
|
||||||
{% url "facilities:facility_feedback" camp_slug=facility.camp.slug facility_type_slug=facility.facility_type.slug facility_uuid=facility.uuid as feedback %}
|
{% url "facilities:facility_feedback" camp_slug=facility.camp.slug facility_type_slug=facility.facility_type.slug facility_uuid=facility.uuid as feedback %}
|
||||||
marker = L.marker([{{ facility.location.y }}, {{ facility.location.x }}], {icon: {{ facility.facility_type.marker }}}).bindPopup("<b>{{ facility.name }}</b><br><p>{{ facility.description }}</p><p>Responsible team: {{ facility.facility_type.responsible_team.name }} Team</p>{% if request.user.is_authenticated %}<p><a href='{{ detail }}' class='btn btn-primary' style='color: white;'><i class='fas fa-search'></i> Details</a><a href='{{ feedback }}' class='btn btn-primary' style='color: white;'><i class='fas fa-comment-dots'></i> Feedback</a></p>{% endif %}").addTo(this);
|
marker = L.marker([{{ facility.location.y }}, {{ facility.location.x }}], {icon: {{ facility.facility_type.marker }}}).bindPopup("<b>{{ facility.name }}</b><br><p>{{ facility.description|linebreaksbr }}</p><p>Responsible team: {{ facility.facility_type.responsible_team.name }} Team</p>{% if request.user.is_authenticated %}<p><a href='{{ detail }}' class='btn btn-primary' style='color: white;'><i class='fas fa-search'></i> Details</a><a href='{{ feedback }}' class='btn btn-primary' style='color: white;'><i class='fas fa-comment-dots'></i> Feedback</a></p>{% endif %}").addTo(this);
|
||||||
markers.push(marker.getLatLng());
|
markers.push(marker.getLatLng());
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
var markerBounds = L.latLngBounds(markers);
|
var markerBounds = L.latLngBounds(markers);
|
||||||
|
|
|
@ -46,7 +46,7 @@ function MapReadyCallback() {
|
||||||
{% for facility in ft.facilities.all %}
|
{% for facility in ft.facilities.all %}
|
||||||
{% url "facilities:facility_detail" camp_slug=facility.camp.slug facility_type_slug=facility.facility_type.slug facility_uuid=facility.uuid as detail %}
|
{% url "facilities:facility_detail" camp_slug=facility.camp.slug facility_type_slug=facility.facility_type.slug facility_uuid=facility.uuid as detail %}
|
||||||
{% url "facilities:facility_feedback" camp_slug=facility.camp.slug facility_type_slug=facility.facility_type.slug facility_uuid=facility.uuid as feedback %}
|
{% url "facilities:facility_feedback" camp_slug=facility.camp.slug facility_type_slug=facility.facility_type.slug facility_uuid=facility.uuid as feedback %}
|
||||||
marker = L.marker([{{ facility.location.y }}, {{ facility.location.x }}], {icon: {{ facility.facility_type.marker }}}).bindPopup("<b>{{ facility.name }}</b><br><p>{{ facility.description }}</p><p>Responsible team: {{ facility.facility_type.responsible_team.name }} Team</p>{% if request.user.is_authenticated %}<p><a href='{{ detail }}' class='btn btn-primary' style='color: white;'><i class='fas fa-search'></i> Details</a><a href='{{ feedback }}' class='btn btn-primary' style='color: white;'><i class='fas fa-comment-dots'></i> Feedback</a></p>{% endif %}").addTo(this);
|
marker = L.marker([{{ facility.location.y }}, {{ facility.location.x }}], {icon: {{ facility.facility_type.marker }}}).bindPopup("<b>{{ facility.name }}</b><br><p>{{ facility.description|linebreaksbr }}</p><p>Responsible team: {{ facility.facility_type.responsible_team.name }} Team</p>{% if request.user.is_authenticated %}<p><a href='{{ detail }}' class='btn btn-primary' style='color: white;'><i class='fas fa-search'></i> Details</a><a href='{{ feedback }}' class='btn btn-primary' style='color: white;'><i class='fas fa-comment-dots'></i> Feedback</a></p>{% endif %}").addTo(this);
|
||||||
markers.push(marker.getLatLng());
|
markers.push(marker.getLatLng());
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
Loading…
Reference in a new issue