ui base for reporting issues and missing locations
This commit is contained in:
parent
9664b22a0c
commit
a8d0be6653
10 changed files with 157 additions and 69 deletions
|
@ -379,10 +379,12 @@ section.details {
|
|||
opacity: 0;
|
||||
line-height: 2;
|
||||
}
|
||||
#sidebar section.details.loading > .details-body {
|
||||
#sidebar section.details.loading > .details-body,
|
||||
#sidebar section.details.loading > .details-buttons {
|
||||
max-height: 0;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
#sidebar section.details:not(.loading) > .details-head {
|
||||
-webkit-transition: background-color 50ms;
|
||||
-o-transition: background-color 50ms;
|
||||
|
@ -396,7 +398,8 @@ section.details {
|
|||
pointer-events: auto;
|
||||
opacity: 1;
|
||||
}
|
||||
#sidebar section.details:not(.loading) > div.details-body {
|
||||
#sidebar section.details:not(.loading) > div.details-body,
|
||||
#sidebar section.details:not(.loading) > div.details-buttons {
|
||||
max-height: 100vh;
|
||||
-webkit-transition: max-height 150ms, opacity 50ms;
|
||||
-o-transition: max-height 150ms, opacity 50ms;
|
||||
|
@ -745,18 +748,19 @@ main:not([data-view=route-result]) #route-dots {
|
|||
.buttons {
|
||||
border: 0 #dddddd solid;
|
||||
border-top-width: 1px;
|
||||
.button-clear {
|
||||
display:block;
|
||||
width: 100%;
|
||||
padding: 0 7px;
|
||||
margin: 0;
|
||||
line-height: 3.3rem;
|
||||
}
|
||||
}
|
||||
.location {
|
||||
margin-right: 24px;
|
||||
padding-right: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.button-clear {
|
||||
display:block;
|
||||
width: 100%;
|
||||
padding: 0 7px;
|
||||
margin: 0;
|
||||
}
|
||||
.as-location .material-icons {
|
||||
transform: rotate(-45deg);
|
||||
}
|
||||
|
|
|
@ -193,7 +193,7 @@ c3nav = {
|
|||
.on('submit', 'form', c3nav._modal_submit)
|
||||
.on('click', '.mobileclient-share', c3nav._mobileclient_share_click)
|
||||
.on('click', '.mobileclient-shortcut', c3nav._mobileclient_shortcut_click);
|
||||
$('header #user, #about-link').on('click', c3nav._modal_link_click);
|
||||
$('header #user, #about-link, .buttons a').on('click', c3nav._modal_link_click);
|
||||
|
||||
$('header h1 a').removeAttr('href');
|
||||
|
||||
|
@ -351,13 +351,13 @@ c3nav = {
|
|||
var $location_details = $('#location-details');
|
||||
if ($location_details.attr('data-id') !== String(location.id)) {
|
||||
$location_details.addClass('loading').attr('data-id', location.id);
|
||||
$location_details.find('.details-buttons').hide();
|
||||
c3nav._clear_route_layers();
|
||||
$.getJSON('/api/locations/'+location.id+'/details', c3nav._location_details_loaded).fail(function (data) {
|
||||
var $location_details = $('#location-details');
|
||||
$location_details.find('.details-body').text('Error '+String(data.status));
|
||||
$location_details.find('.details-body').html('').append(elem);
|
||||
$location_details.find('.editor').hide();
|
||||
$location_details.find('.report').hide();
|
||||
$location_details.removeClass('loading');
|
||||
});
|
||||
}
|
||||
|
@ -394,7 +394,6 @@ c3nav = {
|
|||
elem.append(loclist);
|
||||
}
|
||||
}
|
||||
$location_details.find('.details-buttons').show();
|
||||
$location_details.find('.details-body').html('').append(elem);
|
||||
|
||||
var $editor = $location_details.find('.editor');
|
||||
|
@ -404,6 +403,12 @@ c3nav = {
|
|||
$editor.hide();
|
||||
}
|
||||
|
||||
var custom_location = typeof data.id !== 'number',
|
||||
report_url = '/report/l/'+String(data.id)+'/';
|
||||
$location_details.find('.report').attr('href', report_url);
|
||||
$location_details.find('.report-issue').toggle(!custom_location);
|
||||
$location_details.find('.report-missing').toggle(custom_location);
|
||||
|
||||
if (data.geometry && data.level) {
|
||||
L.geoJSON(data.geometry, {
|
||||
style: {
|
||||
|
@ -449,6 +454,7 @@ c3nav = {
|
|||
// loaded too late, information no longer needed
|
||||
return;
|
||||
}
|
||||
$('#route-details .report').attr('href', data.report_issue_url);
|
||||
c3nav._push_state({route_result: data.result, route_options: data.options}, true);
|
||||
c3nav._display_route_result(data.result, nofly);
|
||||
c3nav._display_route_options(data.options);
|
||||
|
@ -465,6 +471,8 @@ c3nav = {
|
|||
item, coords, description;
|
||||
c3nav._clear_route_layers();
|
||||
|
||||
$details_wrapper.find('.report')
|
||||
|
||||
$details.html('');
|
||||
$details.append(c3nav._build_location_html(result.origin));
|
||||
|
||||
|
@ -778,6 +786,8 @@ c3nav = {
|
|||
c3nav.update_state(false);
|
||||
} else if ($(this).is('.share')) {
|
||||
c3nav._buttons_share_click(location);
|
||||
} else if ($(this).is('a')) {
|
||||
c3nav._modal_link_click.call(this, e);
|
||||
} else {
|
||||
var $locationinput = $(this).is('.as-origin') ? $origin : $destination,
|
||||
$other_locationinput = $(this).is('.as-origin') ? $destination : $origin,
|
||||
|
@ -1246,7 +1256,10 @@ c3nav = {
|
|||
if (c3nav._click_anywhere_popup !== popup || !popup.isOpen()) return;
|
||||
popup.remove();
|
||||
popup = L.popup(c3nav._add_map_padding({className: 'location-popup', maxWidth: 500}, 'autoPanPaddingTopLeft', 'autoPanPaddingBottomRight'));
|
||||
popup.setLatLng(e.latlng).setContent(c3nav._build_location_html(data)+$('#popup-buttons').html());
|
||||
var buttons = $('#popup-buttons').clone();
|
||||
buttons.find('.report-issue').remove();
|
||||
buttons.find('.report').attr('href', '/report/l/'+String(data.id)+'/');
|
||||
popup.setLatLng(e.latlng).setContent(c3nav._build_location_html(data)+buttons.html());
|
||||
c3nav._click_anywhere_popup = popup;
|
||||
popup.on('remove', function() { c3nav._click_anywhere_popup = null }).openOn(c3nav.map);
|
||||
}).fail(function() {
|
||||
|
@ -1368,10 +1381,18 @@ c3nav = {
|
|||
}
|
||||
|
||||
var point = c3nav._location_point_overrides[location.id] || location.point.slice(1),
|
||||
latlng = L.GeoJSON.coordsToLatLng(point);
|
||||
latlng = L.GeoJSON.coordsToLatLng(point),
|
||||
buttons = $('#popup-buttons').clone();
|
||||
if (typeof location.id == 'number') {
|
||||
buttons.find('.report-missing').remove();
|
||||
} else {
|
||||
buttons.find('.report-issue').remove();
|
||||
}
|
||||
buttons.find('.report').attr('href', '/report/l/'+String(location.id)+'/');
|
||||
|
||||
L.marker(latlng, {
|
||||
icon: icon
|
||||
}).bindPopup(location.elem+$('#popup-buttons').html(), c3nav._add_map_padding({
|
||||
}).bindPopup(location.elem+buttons.html(), c3nav._add_map_padding({
|
||||
className: 'location-popup',
|
||||
maxWidth: 500
|
||||
}, 'autoPanPaddingTopLeft', 'autoPanPaddingBottomRight')).addTo(c3nav._locationLayers[location.point[0]]);
|
||||
|
|
|
@ -46,6 +46,16 @@
|
|||
<div class="buttons">
|
||||
<button class="button-clear as-origin"><i class="material-icons">directions</i> {% trans 'Route from here' %}</button>
|
||||
</div>
|
||||
<div class="buttons">
|
||||
<a class="button button-clear report report-issue">
|
||||
<i class="material-icons">feedback</i>
|
||||
{% trans 'Report issue' %}
|
||||
</a>
|
||||
<a class="button button-clear report report-missing">
|
||||
<i class="material-icons">feedback</i>
|
||||
{% trans 'Report missing location' %}
|
||||
</a>
|
||||
</div>
|
||||
</section>
|
||||
<section class="share-ui">
|
||||
<h3>{% trans 'Share' %}</h3>
|
||||
|
@ -132,13 +142,21 @@
|
|||
<button class="button close button-clear material-icons float-right">close</button>
|
||||
<h2>{% trans 'Details' %}</h2>
|
||||
</div>
|
||||
<div class="details-buttons buttons">
|
||||
<div class="details-body"></div>
|
||||
<div class="details-buttons buttons">
|
||||
<a class="button button-clear report report-issue">
|
||||
<i class="material-icons">feedback</i>
|
||||
{% trans 'Report issue' %}
|
||||
</a>
|
||||
<a class="button button-clear report report-missing">
|
||||
<i class="material-icons">feedback</i>
|
||||
{% trans 'Report missing location' %}
|
||||
</a>
|
||||
<a class="button button-clear editor" target="_blank">
|
||||
<i class="material-icons">edit</i>
|
||||
{% trans 'Open in Editor' %}
|
||||
</a>
|
||||
</div>
|
||||
<div class="details-body"></div>
|
||||
</section>
|
||||
<section id="route-details" class="details">
|
||||
<div class="details-head">
|
||||
|
@ -146,6 +164,12 @@
|
|||
<h2>{% trans 'Details' %}</h2>
|
||||
</div>
|
||||
<div class="details-body"></div>
|
||||
<div class="details-buttons buttons">
|
||||
<a class="button button-clear report report-issue">
|
||||
<i class="material-icons">feedback</i>
|
||||
{% trans 'Report issue' %}
|
||||
</a>
|
||||
</div>
|
||||
</section>
|
||||
<section id="route-options" class="details">
|
||||
<div class="details-head">
|
||||
|
|
10
src/c3nav/site/templates/site/report.html
Normal file
10
src/c3nav/site/templates/site/report.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
{% extends 'site/base.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
<main class="account">
|
||||
<h2>{% trans 'Coming soon' %}</h2>
|
||||
|
||||
{% include 'site/fragment_messages.html' %}
|
||||
</main>
|
||||
{% endblock %}
|
|
@ -1,9 +1,10 @@
|
|||
from django.conf.urls import url
|
||||
|
||||
from c3nav.site.views import (about_view, access_redeem_view, account_view, change_password_view, choose_language,
|
||||
login_view, logout_view, map_index, qr_code, register_view)
|
||||
login_view, logout_view, map_index, qr_code, register_view, report_view)
|
||||
|
||||
slug = r'(?P<slug>[a-z0-9-_.:]+)'
|
||||
coordinates = r'(?P<coordinates>[a-z0-9-_:]+:-?\d+(\.\d+)?:-?\d+(\.\d+)?)'
|
||||
slug2 = r'(?P<slug2>[a-z0-9-_.:]+)'
|
||||
details = r'(?P<details>details/)?'
|
||||
options = r'(?P<options>options/)?'
|
||||
|
@ -25,4 +26,8 @@ urlpatterns = [
|
|||
url(r'^access/(?P<token>[^/]+)$', access_redeem_view, name='site.access.redeem'),
|
||||
url(r'^lang/$', choose_language, name='site.language'),
|
||||
url(r'^about/$', about_view, name='site.about'),
|
||||
url(r'^report/$', about_view, name='site.about'),
|
||||
url(r'^report/l/%s/$' % coordinates, report_view, name='site.report'),
|
||||
url(r'^report/l/(?P<location>\d+)/$', report_view, name='site.report'),
|
||||
url(r'^report/r/(?P<origin>[^/]+)/(?P<destination>[^/]+)/(?P<options>[^/]+)/$', report_view, name='site.report'),
|
||||
]
|
||||
|
|
|
@ -348,3 +348,8 @@ def about_view(request):
|
|||
'team': settings.IMPRINT_TEAM,
|
||||
'hosting': settings.IMPRINT_HOSTING,
|
||||
})
|
||||
|
||||
|
||||
@never_cache
|
||||
def report_view(request, coordinates=None, location=None, origin=None, destination=None, options=None):
|
||||
return render(request, 'site/report.html', {})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue