<html xmlns:py="http://genshi.edgewall.org/"
  xmlns:xi="http://www.w3.org/2001/XInclude"
  xmlns:i18n="http://genshi.edgewall.org/i18n"
  py:strip=""
  >
  <xi:include href="../_util.html" />
  <div id="dataset" class="dataset">
    <!-- About dataset -->
    <div class="notes" py:if="str(c.pkg_notes_formatted).strip()">
      ${c.pkg_notes_formatted}
    </div>
    
    <!-- Resources -->
    <div class="resources subsection">
      <h3>Resources</h3>
      <table class="resource-table-view">
        <thead>
            <th>Resource</th>
            <th>Format</th>
            <th>Actions</th>
        </thead>
        <py:for each="res in c.pkg_dict.get('resources', [])">
          <tr rel="dcat:distribution" resource="_:res${res.id}"
            typeof="dcat:Distribution">
            <td>
              <a class="resource-url-analytics" href="${res.get('url', '')}" rel="dcat:accessURL" target="_blank">
                <py:if test="res.get('name') or res.get('description')">
                  <span property="rdfs:label">${res.get('description') or res.get('name')}</span>
                </py:if>
                <py:if test="not(res.get('name') or res.get('description'))">
                  <em>(none)</em>
                </py:if>
              </a>
            </td>
            <td property="dc:format">${res.get('format', '')}</td>
            <td></td>
          </tr>
        </py:for>
        <py:if test="not len(c.pkg_dict.get('resources', []))">
          <tr class="table-empty"><td colspan="2">(none)</td></tr>
        </py:if>
      </table>
    </div>

    <hr class="cleared" />

    <py:def function="details_item(label, value)">
        <tr>
          <td class="dataset-label">
            ${label}
          </td>
          <td class="dataset-details">
            ${value}
          </td>
        </tr>
    </py:def>

    <div class="details subsection">
    <h3>Additional Information</h3>
    <table>
      <thead>
        <tr>
          <th>Field</th>
          <th>Value</th>
        </tr>
      </thead>
      <tbody>
        <tr py:for="i, (key, value) in enumerate(c.pkg_extras)"
          rel="dc:relation" resource="_:extra${i}">
          <td class="dataset-label" property="rdfs:label">${_(key)}</td>
          <td class="dataset-details" property="rdf:value">${value}</td>
        </tr>
        <py:if test="not len(c.pkg_extras)">
          <tr class="table-empty"><td colspan="2">(none)</td></tr>
        </py:if>
      </tbody>
    </table>
    </div>
    
  </div> <!-- /dataset -->

</html>
