{#
# GNU MediaGoblin -- federated, autonomous media hosting
# Copyright (C) 2011, 2012 MediaGoblin contributors.  See AUTHORS.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#}
{%- extends "mediagoblin/base.html" %}
{%- import "/mediagoblin/utils/wtforms.html" as wtforms_util %}
{%- block mediagoblin_content -%}
{% trans %}<h2>File a Report</h2>{% endtrans %}
<form action="" method=POST >
    {% if comment is defined %}
        <h3>{% trans %}Reporting this Comment{% endtrans %}</h3>
        {% set comment_object = comment.comment() %}
        {% set comment_author = comment_object.get_actor %}
        <div id="comment-{{ comment.id }}"
            class="comment_wrapper">
          <div class="comment_author">
            <img src="{{ request.staticdirect('/images/icon_comment.png') }}" />
            <a href="{{ request.urlgen('mediagoblin.user_pages.user_home',
                            user=comment_author.username) }}"
               class="comment_authorlink">
              {{- comment_author.username -}}
            </a>
            <a href="{{ request.urlgen('mediagoblin.user_pages.media_home.view_comment',
                            comment=comment.id,
                            user=media.get_actor.username,
                            media=media.slug_or_id) }}#comment"
               class="comment_whenlink">
              <span title='{{- comment_object.created.strftime("%I:%M%p %Y-%m-%d") -}}'>
                {%- trans formatted_time=timesince(comment_object.created) -%}
                  {{ formatted_time }} ago
                {%- endtrans -%}
              </span></a>:
          </div>
          <div class="comment_content">
            {% autoescape False -%}
              {{ comment_object.content_html }}
            {%- endautoescape %}
          </div>
        </div>
    {% elif media is defined %}
        <h3>{% trans %}Reporting this Media Entry{% endtrans %}</h3>
          <div class="media_thumbnail">
            <a href="{{ request.urlgen('mediagoblin.user_pages.media_home',
                            user=media.get_actor.username,
                            media=media.slug_or_id) }}">
              <img src="{{ media.thumb_url }}"/></a>
            <a href="{{ request.urlgen('mediagoblin.user_pages.media_home',
                            user=media.get_actor.username,
                            media=media.slug_or_id) }}"
               class=thumb_entry_title>{{ media.title }}</a>
          </div>
          <div class=clear></div>
      {%- trans user_url = request.urlgen('mediagoblin.user_pages.user_home', user=media.get_actor.username),
            username = media.get_actor.username %}
            ❖ Published by <a href="{{ user_url }}"
                          class="comment_authorlink">{{ username }}</a>
      {% endtrans %}
    {%- endif %}

    {{- wtforms_util.render_divs(form) }}
	{{ csrf_token }}
    <input type=submit class="button_action" value="{% trans %}File Report {% endtrans %}" />
</form>
{% endblock %}
