{% extends 'forgewiki:templates/wiki/master.html' %}
{% from 'allura:templates/jinja_master/lib.html' import abbr_date with context %}

{% block title %}{{c.project.name}} / {{c.app.config.options.mount_label}} / Browse Pages{% endblock %}

{% block header %}Browse Pages{% endblock %}

{% block wiki_content %}
<div class="nested-grid-container">
  <div class="grid-10">{{c.page_size.display(limit=limit,count=count,page=page)}}</div>
  <div class="grid-10 tright">View: <a id="sort_recent" href="?sort=recent">Recently Updated</a> | <a id="sort_alpha" href="?sort=alpha">Alphabetical</a>&nbsp;</div>
</div>
<div style="clear:both"></div>
<table id="forge_wiki_browse">
  <thead>
    <tr>
      <th>Title</th>
      <th>Last Update By</th>
      <th>Last Updated</th>
    </tr>
  </thead>
  <tbody>
    {% for page in pages %}
      <tr class="{{'deleted ' if page.deleted else ''}}{{loop.cycle('', 'even')}}">
        <td><a href="{{page.url|safe}}">{{page['title']}}</a></td>
      
        {% if 'user_label' in page %}
          <td>{{page['user_label']}}</td>
        {% else %}
          <td></td>
        {% endif %}
        {% if 'updated' in page %}
          <td>{{abbr_date(page['updated'])}}</td>
        {% else %}
          <td></td>
        {% endif %}
      </tr>
    {% endfor %}
  </tbody>
</table>  
{% if can_delete %}
  <p><a id="toggle_deleted" href="#" style="display:none"><span></span> deleted pages</a></p>
{% endif %}
{{c.page_list.display(limit=limit, page=page, count=count)}}
{% endblock %}

{% block wiki_extra_css %}
<style type="text/css">
    tr.deleted a { color:red; }
</style>
{% endblock %}
{% block wiki_extra_js %}
<script type="text/javascript">
  var show_deleted = {{'true' if show_deleted else 'false'}},
      can_delete = {{'true' if can_delete else 'false'}};
</script>
<script type="text/javascript" src="{{g.app_static('js/browse.js')}}"></script>
{% endblock %}
