fix some issues when c3nav is setup from ground up
This commit is contained in:
parent
417fd9514e
commit
27c833b3ef
3 changed files with 8 additions and 3 deletions
|
@ -97,8 +97,8 @@ class BoundsMixin(SerializableMixin, models.Model):
|
|||
return result
|
||||
result = cls.objects.all().aggregate(models.Min('left'), models.Min('bottom'),
|
||||
models.Max('right'), models.Max('top'))
|
||||
result = ((float(result['left__min']), float(result['bottom__min'])),
|
||||
(float(result['right__max']), float(result['top__max'])))
|
||||
result = ((float(result['left__min'] or 0), float(result['bottom__min'] or 0)),
|
||||
(float(result['right__max'] or 10), float(result['top__max'] or 10)))
|
||||
cache.set(cache_key, result, 900)
|
||||
return result
|
||||
|
||||
|
|
|
@ -1000,8 +1000,10 @@ c3nav = {
|
|||
|
||||
if ($map.is('[data-initial-level]')) {
|
||||
c3nav.initial_level = parseInt($map.attr('data-initial-level'));
|
||||
} else {
|
||||
} else if (c3nav.levels.length) {
|
||||
c3nav.initial_level = c3nav.levels[0][0];
|
||||
} else {
|
||||
c3nav.initial_level = 0
|
||||
}
|
||||
|
||||
c3nav.level_labels_by_id = {};
|
||||
|
|
|
@ -114,6 +114,9 @@ def map_index(request, mode=None, slug=None, slug2=None, details=None, options=N
|
|||
})
|
||||
|
||||
initial_bounds = settings.INITIAL_BOUNDS
|
||||
if not initial_bounds:
|
||||
initial_bounds = (0, 0, 10, 10)
|
||||
|
||||
ctx = {
|
||||
'bounds': json.dumps(Source.max_bounds(), separators=(',', ':')),
|
||||
'levels': json.dumps(tuple((level.pk, level.short_label) for level in levels.values()), separators=(',', ':')),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue