front-end ui to launch location randomizer
This commit is contained in:
parent
0adf48147f
commit
c9df2828b0
5 changed files with 24 additions and 2 deletions
|
@ -66,6 +66,10 @@ PUBLIC_EDITOR = config.getboolean('c3nav', 'editor', fallback=True)
|
||||||
PUBLIC_BASE_MAPDATA = config.getboolean('c3nav', 'public_base_mapdata', fallback=False)
|
PUBLIC_BASE_MAPDATA = config.getboolean('c3nav', 'public_base_mapdata', fallback=False)
|
||||||
AUTO_PROCESS_UPDATES = config.getboolean('c3nav', 'auto_process_updates', fallback=True)
|
AUTO_PROCESS_UPDATES = config.getboolean('c3nav', 'auto_process_updates', fallback=True)
|
||||||
|
|
||||||
|
RANDOM_LOCATION_GROUPS = config.get('c3nav', 'random_location_groups', fallback=None)
|
||||||
|
if RANDOM_LOCATION_GROUPS:
|
||||||
|
RANDOM_LOCATION_GROUPS = tuple(int(i) for i in RANDOM_LOCATION_GROUPS.split(','))
|
||||||
|
|
||||||
if config.has_option('django', 'secret'):
|
if config.has_option('django', 'secret'):
|
||||||
SECRET_KEY = config.get('django', 'secret')
|
SECRET_KEY = config.get('django', 'secret')
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -671,7 +671,18 @@ main.show-options #resultswrapper #route-options {
|
||||||
font-size: 35px;
|
font-size: 35px;
|
||||||
top: 5px;
|
top: 5px;
|
||||||
}
|
}
|
||||||
.locationinput:not(.empty) button.locate, .locationinput.empty button.clear {
|
main:not([data-random-location-groups]) button.random {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#search button.random {
|
||||||
|
right: 45px;
|
||||||
|
color: lighten($color-icon-light, 18%);
|
||||||
|
&:hover {
|
||||||
|
color: lighten($color-icon-light, 8%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.locationinput:not(.empty) button.locate, .locationinput.empty button.clear,
|
||||||
|
main[data-view^=route] button.random, .locationinput:not(.empty) button.random {
|
||||||
-webkit-transform: scale(0.7);
|
-webkit-transform: scale(0.7);
|
||||||
-ms-transform: scale(0.7);
|
-ms-transform: scale(0.7);
|
||||||
transform: scale(0.7);
|
transform: scale(0.7);
|
||||||
|
|
|
@ -155,6 +155,8 @@ c3nav = {
|
||||||
|
|
||||||
c3nav.ssids = $main.is('[data-ssids]') ? JSON.parse($main.attr('data-ssids')) : null;
|
c3nav.ssids = $main.is('[data-ssids]') ? JSON.parse($main.attr('data-ssids')) : null;
|
||||||
|
|
||||||
|
c3nav.random_location_groups = $main.is('[data-random-location-groups]') ? $main.attr('data-random-location-groups').split(',') : null;
|
||||||
|
|
||||||
history.replaceState(state, window.location.path);
|
history.replaceState(state, window.location.path);
|
||||||
c3nav.load_state(state, true);
|
c3nav.load_state(state, true);
|
||||||
c3nav.update_map_locations();
|
c3nav.update_map_locations();
|
||||||
|
@ -865,6 +867,7 @@ c3nav = {
|
||||||
.on('keydown', c3nav._locationinput_keydown);
|
.on('keydown', c3nav._locationinput_keydown);
|
||||||
$('.locationinput .clear').on('click', c3nav._locationinput_clear);
|
$('.locationinput .clear').on('click', c3nav._locationinput_clear);
|
||||||
$('.locationinput .locate').on('click', c3nav._locationinput_locate);
|
$('.locationinput .locate').on('click', c3nav._locationinput_locate);
|
||||||
|
$('.locationinput .random').on('click', c3nav._modal_link_click);
|
||||||
$('.leaflet-control-user-location a').on('click', c3nav._goto_user_location_click).dblclick(function(e) { e.stopPropagation(); });
|
$('.leaflet-control-user-location a').on('click', c3nav._goto_user_location_click).dblclick(function(e) { e.stopPropagation(); });
|
||||||
$('#autocomplete').on('mouseover', '.location', c3nav._locationinput_hover_suggestion)
|
$('#autocomplete').on('mouseover', '.location', c3nav._locationinput_hover_suggestion)
|
||||||
.on('click', '.location', c3nav._locationinput_click_suggestion);
|
.on('click', '.location', c3nav._locationinput_click_suggestion);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<main class="map" data-state="{{ state }}"{% if embed %} data-embed{% endif %} data-last-site-update="{{ last_site_update }}"{% if ssids %} data-ssids="{{ ssids }}"{% endif %} data-primary-color="{{ primary_color }}">
|
<main class="map" data-state="{{ state }}"{% if embed %} data-embed{% endif %} data-last-site-update="{{ last_site_update }}"{% if ssids %} data-ssids="{{ ssids }}"{% endif %} data-primary-color="{{ primary_color }}"{% if random_location_groups %} data-random-location-groups="{{ random_location_groups }}"{% endif %}>
|
||||||
{% if not request.mobileclient %}
|
{% if not request.mobileclient %}
|
||||||
<section id="attributions">
|
<section id="attributions">
|
||||||
{% if not embed %}
|
{% if not embed %}
|
||||||
|
@ -108,6 +108,7 @@
|
||||||
<i class="icon material-icons">place</i>
|
<i class="icon material-icons">place</i>
|
||||||
<input type="text" autocomplete="off" spellcheck="false" placeholder="{% trans 'Search any location…' %}">
|
<input type="text" autocomplete="off" spellcheck="false" placeholder="{% trans 'Search any location…' %}">
|
||||||
<small></small>
|
<small></small>
|
||||||
|
<button class="button-clear random material-icons" href="/random/">casino</button>
|
||||||
<button class="button-clear locate material-icons">location_disabled</button>
|
<button class="button-clear locate material-icons">location_disabled</button>
|
||||||
<button class="button-clear clear material-icons">clear</button>
|
<button class="button-clear clear material-icons">clear</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -136,6 +136,9 @@ def map_index(request, mode=None, slug=None, slug2=None, details=None, options=N
|
||||||
'initial_bounds': json.dumps(initial_bounds, separators=(',', ':')) if initial_bounds else None,
|
'initial_bounds': json.dumps(initial_bounds, separators=(',', ':')) if initial_bounds else None,
|
||||||
'last_site_update': json.dumps(SiteUpdate.last_update()),
|
'last_site_update': json.dumps(SiteUpdate.last_update()),
|
||||||
'ssids': json.dumps(settings.WIFI_SSIDS, separators=(',', ':')) if settings.WIFI_SSIDS else None,
|
'ssids': json.dumps(settings.WIFI_SSIDS, separators=(',', ':')) if settings.WIFI_SSIDS else None,
|
||||||
|
'random_location_groups': (
|
||||||
|
','.join(str(i) for i in settings.RANDOM_LOCATION_GROUPS) if settings.RANDOM_LOCATION_GROUPS else None
|
||||||
|
),
|
||||||
'editor': can_access_editor(request),
|
'editor': can_access_editor(request),
|
||||||
'embed': bool(embed),
|
'embed': bool(embed),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue