{% extends "base.html" %}

{% comment %}
Oh yeah, I know, this template code is horrible, and actually there are
two templates into one. For the future we have to take a different
approach for this.
{% endcomment %}

{% load i18n baseurl cleanhtml %}

{% get_current_language as LANGUAGE_CODE %}

{% block title %}
{{ block.super }}:
{% if directory.is_language %}
  {{ directory.language.name }}
{% else %}
  {% if directory.is_project %}
    {{ directory.project.fullname }}
  {% else %}
    {{ navitems.0.path.language.text }} » {{ navitems.0.path.project.text }} » {% trans "News" %}
  {% endif %}
{% endif %}
» {% trans "News" %}
{% endblock %}

{% block extra_head %}
<link rel="alternate" type="application/rss+xml" title="{{ title }}" href="{% url pootle_notifications.feeds.view path %}" />
{% endblock %}

{% block bodyclass %}
{% if directory.is_language %}languagenews{% else %}tpnews{% endif %}
{% endblock %}

{% block nav-secondary %}
{% if directory.is_language %}
<div id="breadcrumbs">
    <h2 class="title"><a href="{% filter l %}/{{ directory.language.code }}/{% endfilter %}">{{ directory.language.name }}</a></h2>
</div>
{% else %}
    {% if directory.is_project %}
    <div id="breadcrumbs">
        <h2 class="title"><a href="{% filter l %}/projects/{{ directory.project.code }}/{% endfilter %}">{{ directory.project.fullname }}</a></h2>
    </div>
    {% else %}
    {% block breadcrumbs %}
    <div id="breadcrumbs">
      <h2 class="title">{% include "language/item_title.html" %}</h2>
    </div>
    {% endblock %}
    {% endif %}
{% endif %}
{% endblock %}

{% block precontent %}
{% if directory.is_language %}
    {% include "language_menu.html" %}
{% else %}
    {% if directory.is_project %}
        {% include "project_menu.html" %}
    {% else %}
        {% include "tp_menu.html" %}
    {% endif %}
{% endif %}
{% endblock %}

{% block content %}
<div class="settings-container centered" lang="{{ LANGUAGE_CODE }}">
{% if form %}
    <h2>{{ title }}</h2>
    <p>{{ success }}</p>
    <form method="post" action="">
        {{ form.as_p }}
        <p class="common-buttons-block">
            <input type="submit" class="news-publish" value="{% trans "Publish" %}" />
        </p>
    </form>
{% endif %}

    <h2>{% trans "Latest News" %} {{ name }}</h2>
{% if notices %}
    {% for notice in notices %}
    <div class="datetime"><small>{{ notice.get_date }}</small></div>
    <div class="newsitem">{{ notice.message|safe|linebreaks|clean }}</div>
    <div class="newsitem-sep"></div>
    {% endfor %}
{% else %}
    <p>{% trans "No news yet." %}</p>
{% endif %}
</div>
{% endblock %}

{% block scripts_extra %}
<script type="text/javascript" src='{{ "js/jquery/jquery.bidi.js"|m }}'></script>
<script type="text/javascript">
 $(document).ready(function() {
 	$(".newsitem address, .newsitem blockcode, .newsitem blockquote, .newsitem :header, .newsitem p, .newsitem pre, .newsitem li, .newsitem dt, .newsitem dd, .newsitem ul, .newsitem ol, .newsitem dl").filter(":not([dir])").bidi();
 	});
</script>
{% endblock %}
