<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" th:lang="${#ctx.getLocale().toLanguageTag()}" >
  <head>
    <title>Renkan Admin - Spaces</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>

    <link rel="shortcut icon" href="../../../static/img/favicon.ico" th:href="@{/static/img/favicon.ico}"/>

    <link href="../../../static/css/style.css" rel="stylesheet" th:href="@{/static/css/style.css}"/>
    <link href="../../../static/css/index.css" rel="stylesheet" th:href="@{/static/css/index.css}"/>
    
    <script th:remove="all" type="text/javascript" src="../../../static/lib/jquery.min.js"></script>
    <script th:remove="all" type="text/javascript" src="../../../static/js/thymol.js"></script>
  </head>
  <body>
    <div id="container">
      <div id="wrapper">
        <header id="header">
            <h1><a href="renkanIndex.html" th:href="@{/admin}" th:text="#{renkanAdmin.renkan_admin}" id="home-link">Renkan administration</a></h1>
            <div id="headerNav" th:include="fragment/pageFragment :: headerNavFragment"></div>
        </header>
        <h2 th:text="#{renkanAdmin.object_list(#{renkanAdmin.space_objects_name})}">List of objects</h2>
        <div th:include="fragment/paginationFragment :: paginationFragment" class="pagination-container">
          <div>               
            <a href="#?p.page=1">&lt;&lt;</a>
            <a href="#?p.page=3">&lt;</a>
            <span>...</span>
            <a href="#?p.page=2">2</a>
            <a href="#?p.page=3">3</a>
            <span>4</span>
            <a href="#?p.page=5">5</a>
            <a href="#?p.page=6">6</a>
            <span>...</span>
            <a href="#?p.page=5">&gt;</a>
            <a href="#?p.page=7">&gt;&gt;</a> 
          </div>
        </div>
        <div id="objects-content">
          <ul class="object-tools">
            <li><a href="spaceAdd.html" th:href="@{/admin/spaces/edit/}" th:text="#{renkanAdmin.space_add}">Add space</a></li>
          </ul>
          <table>
            <thead>
              <tr>
                <th th:text="#{renkanAdmin.object_name}" class="object-table-title">Name</th>
                <th th:text="#{renkanAdmin.object_created}" class="object-table-created">Created</th>
                <th th:text="#{renkanAdmin.space_proj_count}" class="object-proj-count">Project count</th>
                <th th:text="#{renkanIndex.space_url}" class="object-url">url</th>
                <th th:text="#{renkanAdmin.object_edit}" class="object-table-actions">Edit</th>
                <th th:text="#{renkanAdmin.object_delete}" class="object-table-actions">Delete</th>
              </tr>
            </thead>
            <tbody>
              <tr th:each="object: ${page.content}" th:with="spaceProjCount=${#maps.containsKey(projectsCount, object.id)}? ${projectsCount[object.id]} : 0">
                <td th:text="${object.title}" class="object-table-title" >title</td>
                <td th:text="${object.created}?${#dates.format(object.created, #messages.msg('date.format'))}:'n/a'" class="object-table-created">created</td>
                <td th:text="${spaceProjCount}" class="object-proj-count">nb. proj</td>
                <td class="object-url"><a href="../renkanIndex.html" th:href="@{'/s/'+${object.id}}" th:text="#{renkanIndex.space_url}" >url</a></td>
                <td><a href="spaceEdit.html" th:href="@{'/admin/spaces/edit/'+${object.id}}" th:text="#{renkanAdmin.object_edit_link}" class="object-table-actions">Edit</a></td>
                <td><a href="#" th:if="${spaceProjCount==0}" th:href="@{'/admin/spaces/delete/'+${object.id}}" th:text="#{renkanAdmin.object_delete_link}" class="object-table-actions">Delete</a><span th:if="${spaceProjCount>0}" class="object-table-actions object-table-actions-disabled" th:text="#{renkanAdmin.object_delete_link}">Delete</span></td>
              </tr>
            </tbody>
          </table>
        </div>
        
      </div>
      <footer id="footer" th:substituteby="fragment/pageFragment::footerFragment">
        <div id="version">© <span class="version-date">2013</span> <a href="http://www.iri.centrepompidou.fr" target="_blank">IRI</a> - Version <span class="version-version">0.0</span></div>
      </footer>
    </div>
  </body>
</html>