{% extends "blogango/admin/base.html" %}
{% block title %}{{ _("Manage Comments") }}{% endblock %}
{% block extra_script %}
    {% include "blogango/admin/ajaxify.js" %}
{% endblock %}
{% block subnavbar %}
    <ul class="ctxnavbar">
      <li{% if 'blocked' not in request.GET %} class="active"{% endif %}>
          <a href="{{ request.path }}">Approved</a>
      </li>
      <li{% if 'blocked' in request.GET %} class="active"{% endif %}>
          <a href="{{ request.path }}?blocked">Blocked</a>
      </li>
    </ul>
{% endblock %}
{% block contents %}
<h1>{{ _("Manage Comments") }} {% if blog_entry %} for {{blog_entry.title}}{% endif %}</h1>
    <ul class="comments">
    {% if comments %}
	    {% for comment in comments %}
	      <li class="comment {% cycle 'odd' 'even' %}{% if comment.is_public == False %} 'blocked'{% endif %}">
	          <p class="meta"><strong>{{ comment.created_by }}</strong> |
		          <a href="mailto:{{ comment.email_id }}">{{ comment.email_id }}</a>
		          <a href="{{ comment.user_url }}">{{ comment.user_url }}</a> |
	          </p>
	          <div class="body">{{ comment.text }}</div>
	          <p>{{ comment.created_on }}
	          [
	          {% if comment.is_public %}
              <a href="#" value="{{comment.id}}" class="block_comment">{{ _("Block") }}</a> |
              {% else %}
              <a href="#" value="{{comment.id}}" class="approve_comment">{{ _("Approve") }}</a> |
	          {% endif %}
	            <a href="{{ comment.comment_for.get_edit_url }}">{{ comment.comment_for.title }}</a>
	          ]
	          </p>
	      </li>
	    {% endfor %}
    {% else %}
    	{{ _("No comments") }}
    {% endif %}
    </ul>
    {% if page_.has_next or page_.has_previous %}
    <div class="pagination"> 
        <div class="moreinfo">
            {% if page_.has_next %}
            <a href='{% url "blogango_admin_comments_manage" %}?page={{page_.next_page_number}}{% if 'blocked' in request.GET %}&blocked{% endif %}'>&laquo; Previous Entries</a>
            {% endif %}
            
            {% if page_.has_previous %}
            <span class='right'><a href='{% url "blogango_admin_comments_manage" %}?page={{page_.previous_page_number}}{% if 'blocked' in request.GET %}&blocked{% endif %}'>Next Entries &raquo;</a></span>
            {% endif %}
        </div> 
    </div>
    {% endif %}
{% endblock %}
