##This file is based on the template from the SimpleWiki source which carries the GPL license

<%inherit file="simplewiki_base.html"/>

<%block name="title"><title>Revision feed - MITx 6.002x Wiki</title></%block>

<%!
    from django.core.urlresolvers import reverse
%>

<%block name="wiki_page_title">
<h1>Revision Feed - Page ${wiki_page}</h1>
</%block>

<%block name="wiki_body">
<table id="wiki_history_table" class="wiki-history">
    <thead>
        <tr>
            <th id="revision">Revision</th>
            <th id="comment">Comment</th>
            <th id="diff">Diff</th>
            <th id="modified">Modified</th>
        </tr>
    </thead>
    <tbody>
      <% loopCount = 0 %>
      %for revision in wiki_history:
      %if revision.deleted < 2 or show_delete_revision:
      <% loopCount += 1 %>
      <tr style="border-top: 1px" class="${'dark ' if (loopCount % 2) == 0 else ''}${'deleted ' if (revision.deleted==2) else ''}" >
        <td width="15px">
        <a href="${reverse('wiki_view_revision',args=[revision.counter, revision.article.get_url()])}"> ${revision.article.title} - ${revision}</a>
        </td>
        <td>
          ${ revision.revision_text if revision.revision_text else "<i>None</i>" }</td>
        <td class="diff">
          %for x in revision.get_diff():
          ${x|h}<br/>
          %endfor </td>
        <td>${revision.get_user()}
          <br/>
          ${revision.revision_date.strftime("%b %d, %Y, %I:%M %p")}
        </td>
      </tr>
      %endif
        %endfor
    </tbody>
    %if wiki_prev_page or wiki_next_page:
        <tfoot>
            <tr>
                <td colspan="4">
                    %if wiki_prev_page:
                        <a href="${reverse("wiki_revision_feed", args=[wiki_prev_page])}">Previous page</a>
                    %endif
                    %if wiki_next_page:
                        <a href="${reverse("wiki_revision_feed", args=[wiki_next_page])}">Next page</a>
                    %endif
                </td>
            </tr>
        </tfoot>
    %endif
</table>
</%block>
