level change description for waytypes
This commit is contained in:
parent
addba014b9
commit
be485e0711
3 changed files with 29 additions and 0 deletions
|
@ -0,0 +1,21 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.11.7 on 2017-12-23 01:19
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import c3nav.mapdata.fields
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('mapdata', '0067_space_enter_description'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='waytype',
|
||||||
|
name='level_change_description',
|
||||||
|
field=c3nav.mapdata.fields.I18nField(verbose_name='level change description'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -45,6 +45,7 @@ class WayType(SerializableMixin, models.Model):
|
||||||
speed_up = models.DecimalField(_('speed upwards (m/s)'), max_digits=3, decimal_places=1, default=1,
|
speed_up = models.DecimalField(_('speed upwards (m/s)'), max_digits=3, decimal_places=1, default=1,
|
||||||
validators=[MinValueValidator(Decimal('0.1'))])
|
validators=[MinValueValidator(Decimal('0.1'))])
|
||||||
description_up = I18nField(_('description upwards'), fallback_any=True)
|
description_up = I18nField(_('description upwards'), fallback_any=True)
|
||||||
|
level_change_description = I18nField(_('level change description'), default='')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = _('Way Type')
|
verbose_name = _('Way Type')
|
||||||
|
|
|
@ -80,9 +80,16 @@ class Route:
|
||||||
if item.waytype.up_separate:
|
if item.waytype.up_separate:
|
||||||
icon += '-up' if item.edge.rise > 0 else '-down'
|
icon += '-up' if item.edge.rise > 0 else '-down'
|
||||||
icon += '.svg'
|
icon += '.svg'
|
||||||
|
description = item.waytype.description
|
||||||
if item.waytype.up_separate and item.edge.rise > 0:
|
if item.waytype.up_separate and item.edge.rise > 0:
|
||||||
|
description = item.waytype.description_up
|
||||||
|
if item.waytype.level_change_description:
|
||||||
|
description = (description % {
|
||||||
|
'level_change_description': ' '+item.waytype.level_change_description+' '
|
||||||
|
}).replace(' ', ' ').replace(' .', '.')
|
||||||
item.descriptions.append((icon, item.waytype.description_up))
|
item.descriptions.append((icon, item.waytype.description_up))
|
||||||
else:
|
else:
|
||||||
|
|
||||||
item.descriptions.append((icon, item.waytype.description))
|
item.descriptions.append((icon, item.waytype.description))
|
||||||
|
|
||||||
# add space transfer descriptions
|
# add space transfer descriptions
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue