server/java/renkan-web/src/main/webapp/WEB-INF/templates/renkanIndex.html
changeset 316 242510015401
parent 309 0c3e6e66881f
child 350 0b6f2883a67b
equal deleted inserted replaced
315:8c85ab4cf3aa 316:242510015401
       
     1 <!DOCTYPE html>
       
     2 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" th:lang="${#ctx.getLocale().toLanguageTag()}" >
       
     3     <head>
       
     4         <title>Renkan</title>
       
     5 
       
     6         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
       
     7         <meta charset="utf-8"/>
       
     8         <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
       
     9 
       
    10         <link rel="shortcut icon" href="../../static/img/favicon.ico" th:href="@{/static/img/favicon.ico}" />
       
    11         
       
    12         <script th:remove="all" type="text/javascript" src="../../static/lib/jquery.min.js"></script>
       
    13         <script th:remove="all" type="text/javascript" src="../../static/js/thymol.js"></script> 
       
    14 
       
    15         <script src="../../lib/jquery.min.js" th:src="@{/static/lib/jquery.min.js}" ></script>
       
    16         <script src="../../lib/underscore-min.js" th:src="@{/static/lib/underscore-min.js}" ></script>
       
    17 
       
    18         <link href="../../static/css/style.css" rel="stylesheet" th:href="@{/static/css/style.css}"/>
       
    19         <link href="../../static/css/index.css" rel="stylesheet" th:href="@{/static/css/index.css}"/> 
       
    20     </head>
       
    21     <body>
       
    22       <div id="container">
       
    23         <div id="wrapper" th:with="headerTitle=#{renkanIndex.renkan_spaces}">
       
    24             <header id="header" th:include="fragment/pageFragment :: headerFragment">
       
    25                 <h1 th:text="#{renkanIndex.renkan_spaces}">Renkan Spaces</h1>
       
    26             </header>
       
    27             <div id="inner">
       
    28                 <div id="label" class="translate" th:text="#{renkanIndex.space_exp}">Create a Space</div>                
       
    29                 <form action="#" onsubmit="go2Title();return false;">
       
    30                     <fieldset id="form-fields">
       
    31                         <div id="title-field"><label th:text="#{renkanIndex.renkan_title}" for="renkantitle">title</label><input type="text" id="renkantitle" autofocus="autofocus" x-webkit-speech="x-webkit-speech"/></div>
       
    32                     </fieldset>
       
    33                     <div id="form-submit"><button type="submit">OK</button></div>
       
    34                 </form>
       
    35             </div>
       
    36             <h2 th:text="#{renkanIndex.space_list}">Space list</h2>
       
    37             <div th:include="fragment/paginationFragment :: paginationFragment" class="pagination-container">
       
    38                 <div>               
       
    39                     <a href="#?p.page=1">&lt;&lt;</a>
       
    40                     <a href="#?p.page=3">&lt;</a>
       
    41                     <span>...</span>
       
    42                     <a href="#?p.page=2">2</a>
       
    43                     <a href="#?p.page=3">3</a>
       
    44                     <span>4</span>
       
    45                     <a href="#?p.page=5">5</a>
       
    46                     <a href="#?p.page=6">6</a>
       
    47                     <span>...</span>
       
    48                     <a href="#?p.page=5">&gt;</a>
       
    49                     <a href="#?p.page=7">&gt;&gt;</a> 
       
    50                 </div>
       
    51             </div>
       
    52             <table>
       
    53               <thead>
       
    54                 <tr>
       
    55                     <th th:text="#{renkanIndex.space_name}">Name</th>
       
    56                     <th th:text="#{renkanIndex.space_creation}">Creation</th>
       
    57                     <th th:text="#{renkanIndex.space_proj_count}">Project count</th>
       
    58                     <th th:text="#{renkanIndex.space_open}">Open</th>
       
    59                 </tr>
       
    60               </thead>
       
    61               <tbody>
       
    62                 <tr th:each="space: ${page.content}">
       
    63                   <th th:text="${space.title}">title</th>
       
    64                   <td th:text="${#dates.format(space.created, #messages.msg('date.format'))}">date</td>
       
    65                   <td th:text="${#maps.containsKey(projectsCount, space.id)}? ${projectsCount[space.id]} : 0">nb. proj</td>
       
    66                   <td><a href="#" th:href="@{'/s/'+${space.id}}" th:text="#{renkanIndex.space_open_link}">Open space</a></td>
       
    67                 </tr>
       
    68               </tbody>
       
    69             </table>            
       
    70         </div>
       
    71         <footer id="footer" th:include="fragment/pageFragment :: footerFragment">
       
    72             <div id="version">© <span class="version-date">2014</span> <a href="http://www.iri.centrepompidou.fr" target="_blanck">IRI</a> - Version <span class="version-version">0.0</span></div>
       
    73         </footer>
       
    74       </div>
       
    75       <script th:inline="javascript" >
       
    76       /*<![CDATA[*/
       
    77     
       
    78           function go2Title()
       
    79           {
       
    80               var renkantitle = $("#renkantitle").val();
       
    81               if(renkantitle.length == 0) {
       
    82               	var alert_message = /*[[#{renkanIndex.js.empty_name_error}]]*/"Please enter a title"; 
       
    83               	alert(alert_message);
       
    84               	return false;
       
    85               }
       
    86               
       
    87               new_space = {
       
    88               	title: renkantitle,
       
    89               	description: "(empty description)",
       
    90               	uri: null
       
    91               };
       
    92               
       
    93               var post_url = /*[[@{/rest/spaces/}]]*/"/rest/spaces/"; 
       
    94               $.ajax(post_url, {
       
    95                   data:JSON.stringify(new_space),
       
    96                   type: "POST",
       
    97                   dataType: "json",
       
    98                   contentType: "application/json; charset=UTF-8"
       
    99               }).done(function(space){
       
   100               	var template_url = /*[[@{'/s/<%=space_id%>'}]]*/"s/<%=space_id%>";
       
   101               	window.location = _.template(template_url, {space_id: space.id});
       
   102               });
       
   103               
       
   104               //? window.location = "p/" + renkantitle : alert(/*[[#{renkanIndex.js.empty_name_error}]]*/"Please enter a name");
       
   105           }
       
   106 
       
   107       /*]]>*/
       
   108       </script>
       
   109     </body>
       
   110 </html>