show options summary
This commit is contained in:
parent
8db691b042
commit
c08a3a4f4e
4 changed files with 25 additions and 2 deletions
|
@ -176,3 +176,6 @@ class RouteOptions(models.Model):
|
||||||
return super().save(*args, **kwargs)
|
return super().save(*args, **kwargs)
|
||||||
|
|
||||||
self.request.session['route_options'] = self
|
self.request.session['route_options'] = self
|
||||||
|
|
||||||
|
def items(self):
|
||||||
|
yield from self.data.items()
|
||||||
|
|
|
@ -89,6 +89,24 @@ class Route:
|
||||||
distance_str = '%d m' % distance
|
distance_str = '%d m' % distance
|
||||||
summary = '%s (%s)' % (duration_str, distance_str)
|
summary = '%s (%s)' % (duration_str, distance_str)
|
||||||
|
|
||||||
|
options_summary = [
|
||||||
|
{
|
||||||
|
'fastest': _('fastest route'),
|
||||||
|
'shortest': _('shortest route')
|
||||||
|
}[self.options['mode']],
|
||||||
|
]
|
||||||
|
|
||||||
|
waytypes_excluded = sum((name.startswith('waytype_') and value != 'allow')
|
||||||
|
for name, value in self.options.items())
|
||||||
|
|
||||||
|
if waytypes_excluded:
|
||||||
|
options_summary.append(_('some path types avoided'))
|
||||||
|
else:
|
||||||
|
options_summary.append(_('default options'))
|
||||||
|
|
||||||
|
options_summary = ', '.join(str(s) for s in options_summary)
|
||||||
|
|
||||||
|
|
||||||
return OrderedDict((
|
return OrderedDict((
|
||||||
('origin', describe_location(self.origin, locations)),
|
('origin', describe_location(self.origin, locations)),
|
||||||
('destination', describe_location(self.destination, locations)),
|
('destination', describe_location(self.destination, locations)),
|
||||||
|
@ -97,6 +115,7 @@ class Route:
|
||||||
('distance_str', distance_str),
|
('distance_str', distance_str),
|
||||||
('duration_str', duration_str),
|
('duration_str', duration_str),
|
||||||
('summary', summary),
|
('summary', summary),
|
||||||
|
('options_summary', options_summary),
|
||||||
('items', tuple(item.serialize(locations=locations) for item in items)),
|
('items', tuple(item.serialize(locations=locations) for item in items)),
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
|
@ -368,6 +368,7 @@ c3nav = {
|
||||||
|
|
||||||
c3nav._firstRouteLevel = first_primary_level;
|
c3nav._firstRouteLevel = first_primary_level;
|
||||||
$route.find('span').text(result.summary);
|
$route.find('span').text(result.summary);
|
||||||
|
$route.find('em').text(result.options_summary);
|
||||||
$route.removeClass('loading');
|
$route.removeClass('loading');
|
||||||
$details_wrapper.removeClass('loading');
|
$details_wrapper.removeClass('loading');
|
||||||
|
|
||||||
|
|
|
@ -61,8 +61,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="route-summary">
|
<div id="route-summary">
|
||||||
<i class="icon material-icons">directions</i>
|
<i class="icon material-icons">directions</i>
|
||||||
<span>10min (100m)… sorry no routing yet</span>
|
<span></span>
|
||||||
<small><em>default options</em></small>
|
<small><em></em></small>
|
||||||
<button class="button-clear options material-icons">settings</button>
|
<button class="button-clear options material-icons">settings</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="buttons" id="route-search-buttons">
|
<div class="buttons" id="route-search-buttons">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue