<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <title>API version {{ content.0 }}</title>
        <link rel="stylesheet" href="http://blueprintcss.org/blueprint/screen.css" type="text/css" media="screen, projection">
		<link rel="stylesheet" href="http://blueprintcss.org/blueprint/print.css" type="text/css" media="print">    
		<!--[if lt IE 8]><link rel="stylesheet" href="http://blueprintcss.org/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]-->
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
        <script>
            $(function(){
                $('.uri_link-active').click(function(e){
                    $(this).parent().find('.uri_info').toggleClass('uri_info-show');
                });
            });
        </script>
        <style>
            .uri { margin-bottom: 1em; font-weight: bold }
            .uri_item { margin-left: .5em }
            .uri_methods { color: #999 }
            .uri_resource { color: #393 }
            .uri_name { color: #933 }
            .uri_link { font-size: 1.2em; color: #339 }
            .uri_link-active { border-bottom: 1px dashed; cursor: pointer; }
            .uri_auth { margin: 0; }
            .uri_info { display: none; font-weight: bold; margin-left: 1em; }
            .uri_info-show { display: block; }
            .uri_info_required { font-weight: bold; color: red; }
        </style>
    </head>
    <body>
        <div class="container">
            <h1>API v.{{ content.0 }} MAP</h1>
            <hr>

            {% for uri, info in content.1 %}
            <div class="uri">
                {% if info.fields %}<span class="uri_link uri_link-active">+ {{ uri }}</span>{% else %}<span class="uri_link">{{ uri }}</span>{% endif %}
                
                <span class="uri_item uri_name">[{{ info.name }}]</span>
                {% if info.resource %}<span class="uri_item uri_resource">[{{ info.resource }}]</span>{% endif %}
                <span class="uri_item uri_methods"> {% for m in info.methods %}{{ m }}&nbsp;{% endfor %}</span>
                <p class="uri_auth">{% for a in info.auth %} {{ a }} {% endfor %}</p>
                {% if info.fields %}<table class="uri_info info">
                    {% for f, v in info.fields %}
                        <tr>
                            <td {% if v.required %} class="uri_info_required" {% endif %}> {{ f }} </td>
                            <td> {{ v.label }}. {{ v.help }} </td>
                    {% endfor %}
                </table>{% endif %}
            </div>
            {% endfor %}
        </div>
    </body>
</html>
