only link to locations that can be searched
This commit is contained in:
parent
06b7ef84a2
commit
cd27a6a099
5 changed files with 39 additions and 15 deletions
|
@ -50,9 +50,15 @@ class LevelGeometryMixin(GeometryMixin):
|
|||
|
||||
def details_display(self):
|
||||
result = super().details_display()
|
||||
result['display'].insert(3, (str(_('Level')), {'id': self.level_id,
|
||||
'slug': self.level.get_slug(),
|
||||
'title': self.level.title}))
|
||||
result['display'].insert(3, (
|
||||
str(_('Level')),
|
||||
{
|
||||
'id': self.level_id,
|
||||
'slug': self.level.get_slug(),
|
||||
'title': self.level.title,
|
||||
'can_search': self.level.can_search,
|
||||
},
|
||||
))
|
||||
return result
|
||||
|
||||
@property
|
||||
|
|
|
@ -55,9 +55,15 @@ class SpaceGeometryMixin(GeometryMixin):
|
|||
|
||||
def details_display(self):
|
||||
result = super().details_display()
|
||||
result['display'].insert(3, (str(_('Space')), {'id': self.space_id,
|
||||
'slug': self.space.get_slug(),
|
||||
'title': self.space.title}))
|
||||
result['display'].insert(3, (
|
||||
str(_('Space')),
|
||||
{
|
||||
'id': self.space_id,
|
||||
'slug': self.space.get_slug(),
|
||||
'title': self.space.title,
|
||||
'can_search': self.space.can_search,
|
||||
},
|
||||
))
|
||||
return result
|
||||
|
||||
def register_delete(self):
|
||||
|
|
|
@ -162,10 +162,15 @@ class SpecificLocation(Location, models.Model):
|
|||
groupcategories.setdefault(group.category, []).append(group)
|
||||
|
||||
for category, groups in sorted(groupcategories.items(), key=lambda item: item[0].priority):
|
||||
result['display'].insert(3, (category.title, tuple(
|
||||
{'id': group.pk, 'slug': group.get_slug(), 'title': group.title}
|
||||
for group in sorted(groups, key=attrgetter('priority'), reverse=True)
|
||||
)))
|
||||
result['display'].insert(3, (
|
||||
category.title,
|
||||
tuple({
|
||||
'id': group.pk,
|
||||
'slug': group.get_slug(),
|
||||
'title': group.title,
|
||||
'can_search': group.can_search,
|
||||
} for group in sorted(groups, key=attrgetter('priority'), reverse=True))
|
||||
))
|
||||
|
||||
return result
|
||||
|
||||
|
|
|
@ -218,6 +218,9 @@ section.details {
|
|||
margin: 0 0 0.7rem;
|
||||
padding: 0 0 0 1rem;
|
||||
}
|
||||
#location-details dd > * {
|
||||
display:block;
|
||||
}
|
||||
|
||||
main:not([data-view$=search]) #autocomplete,
|
||||
main:not([data-view=location]) #location-details,
|
||||
|
|
|
@ -146,11 +146,15 @@ c3nav = {
|
|||
console.log(sublocations);
|
||||
for (var j = 0; j < sublocations.length; j++) {
|
||||
loc = sublocations[j];
|
||||
loclist.append($('<a>').attr('href', '/l/' + loc.slug + '/details/').attr('data-id', loc.id).click(function (e) {
|
||||
e.preventDefault();
|
||||
c3nav._locationinput_set($('#destination-input'), c3nav.locations_by_id[parseInt($(this).attr('data-id'))]);
|
||||
c3nav.update_state(false, false, true);
|
||||
}).text(loc.title));
|
||||
if (loc.can_searc) {
|
||||
loclist.append($('<a>').attr('href', '/l/' + loc.slug + '/details/').attr('data-id', loc.id).click(function (e) {
|
||||
e.preventDefault();
|
||||
c3nav._locationinput_set($('#destination-input'), c3nav.locations_by_id[parseInt($(this).attr('data-id'))]);
|
||||
c3nav.update_state(false, false, true);
|
||||
}).text(loc.title));
|
||||
} else {
|
||||
loclist.append($('<span>').text(loc.title));
|
||||
}
|
||||
}
|
||||
elem.append(loclist);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue