{% extends "base.html" %}
{% load i18n %}
{% load url from future %}
{% load crispy_forms_tags %}

{% block breadcrumbs %}
<li><a href="{{ object.project.get_absolute_url }}">{{ object.project }}</a></li>
<li><a href="{{ object.get_absolute_url }}">{{ object.name }}</a></li>

<a class="pull-right flip" href="{{ object.get_widgets_url }}">
<img src="{% url 'widget-image' project=object.project.slug widget='shields' color='badge' extension='svg' %}" />
</a>
{% endblock %}

{% block content %}
{% include "show-lock.html" %}

<ul class="nav nav-pills">
  <li class="active"><a href="#overview" data-toggle="tab">{% trans "Overview" %}</a></li>
  <li><a href="#history" data-toggle="tab">{% trans "History" %}</a></li>
  <li><a href="#activity" data-toggle="tab" data-href="{% url 'view_activity_subproject' project=object.project.slug subproject=object.slug %}">{% trans "Activity" %}</a></li>
  <li class="dropdown">
    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
      {% trans "Tools" %} <span class="caret"></span>
    </a>
    <ul class="dropdown-menu">
      <li><a href="{% url 'data_project' project=object.project.slug  %}">{% trans "Data exports" %}</a></li>
      {% if perms.trans.commit_translation or perms.trans.update_translation %}
      <li><a href="#repository" data-toggle="tab" data-href="{% url 'git_status_subproject' project=object.project.slug subproject=object.slug %}">{% trans "Repository maintenance" %}</a></li>
      {% endif %}
      <li><a href="{% url 'show_source' project=object.project.slug subproject=object.slug %}">{% trans "Source strings review" %}</a></li>
    </ul>
  </li>
{% if enable_sharing %}
  <li class="dropdown">
    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
      {% trans "Share" %} <span class="caret"></span>
    </a>
    <ul class="dropdown-menu">
{% with object.get_share_url as share_url and object.get_widgets_url as widgets_url %}
      <li><a href="http://www.facebook.com/sharer.php?u={{ share_url }}">{% trans "Share on Facebook!" %}</a></li>
      <li><a href="https://twitter.com/share?text={% blocktrans %}Translate {{ object }} using %23Weblate at {{ share_url }}!{% endblocktrans %}">{% trans "Tweet this translation!" %}</a></li>
      <li><a href="{{ widgets_url }}">{% trans "Status widgets" %}</a></li>
{% endwith %}
    </ul>
  </li>
{% endif %}
</ul>



<div class="tab-content">
<div class="tab-pane active" id="overview">
<div class="row">

<div class="col-md-6">
<div class="panel panel-primary">
  <div class="panel-heading"><h4 class="panel-title">{% trans "Translations" %}</h4></div>
  <div class="panel-body">

{% include "list-translations.html" %}

</div>
</div>


</div>

<div class="col-md-6">

<div class="panel panel-primary">
  <div class="panel-heading"><h4 class="panel-title">{% trans "Project Information" %}</h4></div>
  <div class="panel-body">

<table class="table">
{% include "subproject_info.html" %}
</table>
</div>
</div>

{% if object.can_add_language and user.is_authenticated %}
<form action="{% url 'new-language' project=object.project.slug subproject=object.slug %}" method="post">
{% csrf_token %}
<div class="panel panel-primary">
  <div class="panel-heading"><h4 class="panel-title">{% trans "New translation" %}</h4></div>
  <div class="panel-body">
{% if object.new_lang == 'url' %}
<p>{% blocktrans with object.project.instructions as url %}Should your language be missing, please follow <a href="{{ url }}">translator instructions</a>.{% endblocktrans %}</p>
{% else %}
<p>{% trans "Please choose the language into which you would like to translate." %}</p>
{{ new_lang_form|crispy }}
<p class="help-block"><a href="{% url 'contact' %}?subject=New+language+request+for+{{ object }}">{% trans "Can not find your language in above list?" %}</a></p>
</div>
<div class="panel-footer">
<input class="btn btn-default" type="submit" value="{% trans "Start new translation" %}" />
{% endif %}
</div>
</div>
</form>
{% endif %}


</div>

</div>

</div>


<div class="tab-pane" id="history">
{% include "last-changes.html" %}
</div>

<div class="tab-pane" id="activity">
<div class="panel panel-primary">
<div class="panel-heading"><h4 class="panel-title">{% trans "Activity" %}</h4></div>
<div class="panel-body">
<p>{% trans "Loading…" %}</p>
</div>

</div>
</div>

{% if perms.trans.commit_translation or perms.trans.update_translation %}
<div class="tab-pane" id="repository">
<p>{% trans "Loading…" %}</p>
</div>
{% endif %}

</div>



</div>

{% endblock %}

