## mako
<%! import json %>
<%!
from django.utils.translation import ugettext as _
from openedx.core.djangolib.js_utils import (
    dump_js_escaped_json, js_escaped_string
)
%>
<%namespace name='static' file='/static_content.html'/>
<%inherit file="/main.html" />

<%block name="bodyclass">view-teams view-in-course course js</%block>
<%block name="pagetitle">${_("Acclaim")}</%block>

<%block name="headextra">
<%static:css group='style-course-vendor'/>
<%static:css group='style-course'/>
<%include file="../discussion/_js_head_dependencies.html" />
</%block>

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

<link rel="stylesheet" type="text/css" href="/static/acclaim_badges/css/acclaim.css"> 

<div class="container">
  <div class="acclaim-wrapper">
      <a class="acclaim-buttons" href="${ reverse('badge-courses') }">Badge Courses</a>
      <img class="acclaim-logo" src="/static/acclaim_badges/img/acclaim_logo.gif" height="39" width="160">

      <div class="wrapper-test">
          % if len(object_list) == 0:

            <div class="wrapper-inner">
              <h3 class="acclaim-page-title">Edit Auth Token</h3>
              <div class="acclaim-button">
                <a class="acclaim-button-text" href="${ reverse('acclaim-token-add') }">Add New</a>
              </div>
            </div>

          % else:

            <div class="wrapper-inner">
              <h3 class="acclaim-page-title">Edit Auth Token</h3>
                <div class="acclaim-button">
                <a class="acclaim-button-text" href="${ reverse('acclaim-token-add') }">Add New</a>
              </div>
            </div>
              <table class="acclaim">
                <tr>
                  <th>Token</th>
                  <th>Organization ID</th>
                  <th>Environment</th>
                  <th></th>
                </tr>
                 % for token in object_list:
                 <tr>
                    <td> ${ token.auth_token[-4:].rjust(len(token.auth_token), "*") } </td>
                    <td> ${ token.organization_id } </td>
                    <td> ${ token.url } </td>
                    <td>
                      <a href="${ reverse('acclaim-token-update', args=[str(token.id)]) }">edit</a>
                      <a href="${ reverse('acclaim-token-delete', args=[str(token.id)]) }">delete</a>
                    </td>
                 </tr>
                 % endfor
              </table>

          % endif
        </div>
  </div>
</div>
