{% extends "layout_maps.html" %}

{% block open_graph %}
<meta property="og:title" content="{{ topic_map.name }}" />
<meta property="og:url" content="{{ request.url }}" />
<meta property="og:type" content="website" />
<meta property="og:description" content="{{ topic_map.description|safe }}" />
<meta property="og:image"
    content="{{ request.url_root }}static/resources/{{ topic_map.identifier }}/{{ topic_map.image_path }}" />
<meta property="og:site_name" content="Contextualise" />
{% endblock %}

{% block title %}
<title>{{ topic_map.name }} | Contextualise</title>
{% endblock %}

{% block maps_menu %}
<a class="nav-link" href="{{ url_for('map.published') }}">Published maps</a>
{% endblock %}

{% block javascript %}{% endblock %}

{% block menu %}
{% if topic_map.owner %}
<ul class="nav nav-tabs">
    <li class="nav-item dropdown">
        <a aria-expanded="false" aria-haspopup="true" class="nav-link dropdown-toggle active" data-toggle="dropdown"
            href="#" role="button">Map</a>
        <div class="dropdown-menu">
            <a aria-disabled="true" class="dropdown-item disabled" href="#" tabindex="-1">View</a>
            <div class="dropdown-divider"></div>
            <a class="dropdown-item" href="{{ url_for('map.edit', map_identifier=topic_map.identifier) }}">Edit map</a>
            <a class="dropdown-item" href="{{ url_for('map.delete', map_identifier=topic_map.identifier) }}">Delete
                map</a>
            <div class="dropdown-divider"></div>
            <a class="dropdown-item"
                href="{{ url_for('topic.view', map_identifier=topic_map['identifier'], topic_identifier='home') }}">View
                map</a>
            <a class="dropdown-item" href="{{ url_for('note.index', map_identifier=topic_map['identifier']) }}">View
                notes</a>
        </div>
    </li>
    <li class="nav-item">
        <a class="nav-link"
            href="{{ url_for('map.collaborators', map_identifier=topic_map.identifier) }}">Collaborators</a>
    </li>
</ul>
{% endif %}
{% endblock %}

{% block content %}
<h1>
    {{ topic_map.name }}
    <small class="text-muted">View map details</small>
</h1>
<hr />
<div class="row">
    <div class="col-md-12">
        <div class="form-group">
            <label><strong>Name</strong></label><br />
            <a href="{{ url_for('topic.view', map_identifier=topic_map['identifier'], topic_identifier='home') }}">{{
                topic_map.name }}</a>
        </div>
        <div class="form-group">
            <label><strong>Description</strong></label><br />
            {{ topic_map.description|safe }}
        </div>
        <div class="form-group">
            <label><strong>Image</strong></label>
            <br />
            <img alt="{{ map_name }}" class="map-image img-thumbnail" class="img-thumbnail"
                src="/static/resources/{{ topic_map.identifier }}/{{ topic_map.image_path }}">
        </div>
        <div class="form-group">
            <label><strong>Access</strong></label>
            <br />
            {% if topic_map.published %}
            <span class="badge badge-success">Published</span>
            {% else %}
            <span class="badge badge-warning">Private</span>
            {% endif %}
        </div>
        <hr />
    </div>
</div>
{% if current_user.is_authenticated %}
<a class="btn btn-secondary" href="{{ url_for('map.index', map_identifier=topic_map.identifier) }}"
    role="button">Return</a>
{% else %}
<a class="btn btn-secondary" href="{{ url_for('map.published') }}" role="button">Return</a>
{% endif %}
<a class="btn btn-primary"
    href="{{ url_for('topic.view', map_identifier=topic_map['identifier'], topic_identifier='home') }}"
    role="button">View map</a>
<br />
<br />
{% endblock %}