{% extends "multigtfs/base.html" %}
{% load staticfiles %}
{% block head_title %}{{ block.super }} - Route {{object}}{% endblock %}

{% block head_extra %}
{% if object.geometry %}
<script src="http://openlayers.org/api/OpenLayers.js"></script>
<script src="{% static 'js/explore.js' %}"></script>
{% endif %}
{% endblock %}

{% block page_title %}Route {{object}}{% endblock %}

{% block page_top_content_elem %}
A <strong>Route</strong> is a named route in the schedule
{% endblock %}

{% block page_middle_content %}
{% if object.geometry %}
<div class="row" style="height:300px" id="map"></div>
{% else %}
<h2>Map</h2>
<p><em>
    This route does not have a populated geometry.  A route must have at least
    one related Trip, and update_geometry() must be run on the Route.
</em></p>
{% endif %}
<h2>Attributes</h2>
<dl>
    <dt>feed</dt><dd><a href="{% url 'feed_detail' pk=object.feed_id %}">Feed {{object.feed}}</a></dd>
    <dt>id</dt><dd>{{object.id}}</dd>
    <dt>route_id</dt><dd>{{object.route_id}}</dd>
    <dt>agency</dt><dd>{% if object.agency_id %}<a href="{% url 'agency_detail' feed_id=object.feed_id pk=object.agency_id %}">Agency {{object.agency}}</a>{% else %}<em>Not set</em>{% endif %}</dd>
    <dt>short_name</dt><dd>{{object.short_name}}</dd>
    <dt>long_name</dt><dd>{{object.long_name}}</dd>
    <dt>desc</dt><dd>{{object.desc|default:'<em>Not set</em>'}}</dd>
    <dt>rtype</dt>{{object.get_rtype_display|default:'<em>Not set</em>'}}</dd>
    <dt>url</dt><dd>{% if object.url %}<a href="{{object.url}}">{{object.url}}</a>{% else %}<em>Not set</em>{% endif %}</dd>
    <dt>color</dt><dd>{{object.color|default:'<em>Not set</em>'}}</dd>
    <dt>text_color</dt><dd>{{object.text_color|default:'<em>Not set</em>'}}</dd>
    {% if object.color and object.text_color %}<dt><em>(Sample Coloring)</em></dt><dd><span style="color:#{{object.text_color}}; background-color:#{{object.color}};">{{object.short_name}} {{object.long_name}}</span></dd>{% endif %}
</dl>
{% include "multigtfs/extra_data.html" %}
<h2>Related Objects</h2>
<ul>
    <li><a href="{% url 'farerule_by_route_list' feed_id=object.id route_id=object.id %}">{{object.farerule_set.count}} FareRule{{ object.FareRule_set.count|pluralize }}</a></li>
    <li><a href="{% url 'trip_by_route_list' feed_id=object.id route_id=object.id %}">{{object.trip_set.count}} Trip{{ object.trip_set.count|pluralize }}</a></li>
</ul>
{% endblock %}

{% block body_script %}
{% if object.geometry %}
<script defer="defer" type="text/javascript">
explore.mapLine('map', '{{object.geometry.wkt}}');
</script>
{% endif %}
{% endblock %}
