team-3/src/c3nav/site/templates/site/fragment_location.html
2016-12-28 13:46:04 +01:00

104 lines
5.9 KiB
HTML

{% load i18n %}
<div class="col-md-{% if name == 'location' %}12{% else %}6{% endif %} location-group {{ name }}-select{% if location %} selected{% endif %}{% if active_field == name and map_level %} map{% endif %}" data-name="{{ name }}">
<div class="form-group{% if search == name and not search_results %} has-error{% endif %}">
<label for="{{ name }}_input">{{ heading }}</label>
{% if name == 'destination' %}
{% if origin %}
{% if destination %}
{% url 'site.route' origin=destination.location_id destination=origin.location_id as swap_url %}
{% else %}
{% url 'site.destination' destination=origin.location_id as swap_url %}
{% endif %}
{% elif destination %}
{% url 'site.origin' destination=destination.location_id as swap_url %}
{% endif %}
<a class="swap pull-right" href="{{ swap_url }}">{% trans 'swap' %}</a>
{% endif %}
<div class="locationselect">
<div class="locationselect-input">
{% if search == name and search_results %}
<span class="twitter-typeahead" style="position: relative; display: inline-block;">
{% endif %}
<input type="text" class="form-control input-lg" id="{{ name }}_input"
name="{{ name }}_search" placeholder="{% trans 'Search any Location…' %}"
{% if search and not location %} value="{% if search == name %}{{ search_query }}{% endif %}"{% endif %}>
{% if search == name and search_results %}
<div class="tt-menu tt-open noscript" style="display: block;">
<div class="tt-dataset tt-dataset-0">
{% for result in search_results %}
<a href="{{ result.url }}" class="location tt-suggestion">
<span class="title">{{ result.title }}</span>
<small class="subtitle">{{ result.subtitle }}</small>
</a>
{% endfor %}
</div>
</div>
</span>
{% endif %}
<div class="icons">
<a href="" class="locate app-only"></a>
<a href="?map-level={{ levels.0 }}" class="map"></a>
</div>
</div>
<div class="locationselect-map">
<div class="map-container">
<div class="dummy" style="width:{{ svg_width }}px;height:{{ svg_height }}px;"></div>
{% if map_level %}
{% for area in visible_areas %}
<input type="image" src="{% url 'site.level_image' level=map_level area=area %}" width="{{ svg_width }}" height="{{ svg_height }}">
{% endfor %}
<p class="scroll-hint">{% trans 'Javascript is disabled. Please scroll in this direction ⇘' %}</p>
{% endif %}
</div>
<div class="map-buttons">
<div class="btn-group level-selector" role="group">
{% for level in levels %}
<a href="?map-level={{ level }}" data-level="{{ level }}" class="btn btn-sm btn-default{% if level == map_level %} active{% endif %}">{{ level }}</a>
{% endfor %}
</div><a href="?" class="btn btn-sm btn-default close-map">{% trans 'close' %}</a>
</div>
<span class="help-block">{% trans 'Click or tap the desired location on the map.' %}</span>
</div>
<div class="locationselect-selected">
<div class="location form-control input-lg">
<span class="title">{{ location.title }}</span>
<small class="subtitle">{{ location.subtitle }}</small>
</div>
<div class="icons">
<a href="{% if location %}{% url 'site.location' location=location.location_id %}{% endif %}" class="link"></a>
<a href="{{ reset_url }}" class="reset"></a>
</div>
<input type="hidden" name="{{ name }}" value="{{ location.location_id }}" class="id-field">
</div>
<div class="locationselect-error">
<div class="location form-control input-lg">
<span class="title">{% trans 'Sorry, we could not detect your position.' %}</span>
<small class="subtitle">{% trans 'Wifi mapping may not yet be available in the entire building.' %}</small>
</div>
<div class="icons">
<a href="{{ reset_url }}" class="errorreset"></a>
</div>
</div>
</div>
{% if search == name and not search_results %}
<span class="help-block">{% trans 'No location matched your search query.' %}</span>
{% endif %}
</div>
{% if name == 'location' %}
<div class="row only-if-selected">
<div class="col-xs-6">
<a class="btn btn-primary btn-block" id="route-to-here" href="{% if location %}{% url 'site.destination' destination=location.location_id %}{% endif %}">{% trans 'Route to here' %}</a>
</div>
<div class="col-xs-6">
<a class="btn btn-default btn-block" id="route-from-here" href="{% if location %}{% url 'site.origin' origin=location.location_id %}{% endif %}">{% trans 'Route from here' %}</a>
</div>
</div>
{% endif %}
{% if not location and not map_level %}
<noscript>
<button type="submit" class="btn btn-primary btn-block">{% trans 'Search' %}</button>
</noscript>
{% endif %}
</div>