## mako
<%page expression_filter="h"/>
<%inherit file="../../main.html"/>
<%!
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
%>

<%namespace name='static' file='/static_content.html'/>

<%block name="pagetitle">${_("Edit {catalog_name}").format(catalog_name=catalog.name)}</%block>

<%block name="js_extra">
<%static:require_module module_name="js/api_admin/catalog_preview_factory" class_name="CatalogPreviewFactory">
  CatalogPreviewFactory({
    previewUrl: "${preview_url}",
    catalogApiUrl: "${catalog_api_url}",
  });
</%static:require_module>
</%block>

<%block name="content">
<div id="api-access-wrapper">
  <h1 id="api-header">${catalog.name}</h1>

  <p>
    <a href="${'{root}/{id}/csv/'.format(root=catalog_api_catalog_endpoint, id=catalog.id)}" target="_blank">
      ${_("Download CSV")}
    </a>
  </p>

  <div class="catalog-body">
    <div class="api-form-container">
      <form class="api-form" id="catalog-update" action="${reverse('api_admin:catalog-edit', args=(catalog.id,))}" method="post">
        <input type="hidden" id="csrf_token" name="csrfmiddlewaretoken" value="${csrf_token}">
        <p>
          <input type="checkbox" id="delete-catalog" name="delete-catalog" />
          <label class="api-checkbox-label" for="delete-catalog">${_("Delete this catalog")}</label>
        </p>
        ${form.as_p() | n}
        <input id="catalog-create-submit" type="submit" value="${_('Update Catalog')}"/>
      </form>
    </div>
    <div class="preview-results"></div>
  </div>
</div>
</%block>
