server/src/main/webapp/WEB-INF/templates/renkanIndex.html
changeset 97 f7d611f50e58
parent 87 6c810f746837
child 123 daa99448319d
equal deleted inserted replaced
96:445491106f5a 97:f7d611f50e58
    10         <link rel="shortcut icon" href="favicon.ico"/>
    10         <link rel="shortcut icon" href="favicon.ico"/>
    11         <script src="../../lib/jquery.min.js" th:src="@{/static/lib/jquery.min.js}" ></script>
    11         <script src="../../lib/jquery.min.js" th:src="@{/static/lib/jquery.min.js}" ></script>
    12         <script src="../../lib/underscore-min.js" th:src="@{/static/lib/underscore-min.js}" ></script>
    12         <script src="../../lib/underscore-min.js" th:src="@{/static/lib/underscore-min.js}" ></script>
    13         <script src="../../js/main.js" th:src="@{/static/js/main.js}" ></script>
    13         <script src="../../js/main.js" th:src="@{/static/js/main.js}" ></script>
    14 
    14 
       
    15         <link href="../../static/css/style.css" rel="stylesheet" th:href="@{/static/css/style.css}"/>
    15         <link href="../../static/css/index.css" rel="stylesheet" th:href="@{/static/css/index.css}"/> 
    16         <link href="../../static/css/index.css" rel="stylesheet" th:href="@{/static/css/index.css}"/> 
    16     </head>
    17     </head>
    17     <body>
    18     <body>
       
    19       <div id="container">
    18         <div id="wrapper">
    20         <div id="wrapper">
    19         	<h1 th:text="#{renkanIndex.renkan_spaces}">Renkan Spaces</h1>
    21         	<h1 th:text="#{renkanIndex.renkan_spaces}">Renkan Spaces</h1>
    20             <div id="inner">
    22             <div id="inner">
    21                 <div id="label" class="translate" th:text="#{renkanIndex.space_exp}">Create a Space</div> 
    23                 <div id="label" class="translate" th:text="#{renkanIndex.space_exp}">Create a Space</div> 
    22                 <form action="#" onsubmit="go2Title();return false;">
    24                 <form action="#" onsubmit="go2Title();return false;">
    57                   <td><a href="#" th:href="@{'/s/'+${space.id}}" th:text="#{renkanIndex.space_open_link}">Open space</a></td>
    59                   <td><a href="#" th:href="@{'/s/'+${space.id}}" th:text="#{renkanIndex.space_open_link}">Open space</a></td>
    58                 </tr>
    60                 </tr>
    59               </tbody>
    61               </tbody>
    60             </table>            
    62             </table>            
    61         </div>
    63         </div>
    62         <script th:inline="javascript" >
    64         <div id="footer" th:include="fragment/pageFragment :: footerFragment">
    63         /*<![CDATA[*/
    65             <div id="version">© <span class="version-date">2013</span> <a href="http://www.iri.centrepompidou.fr" target="_blanck">IRI</a> - Version <span class="version-version">0.0</span></div>
    64       
    66         </div>
    65             function go2Title()
    67       </div>
    66             {
    68       <script th:inline="javascript" >
    67                 var renkantitle = $("#renkantitle").val();
    69       /*<![CDATA[*/
    68                 if(renkantitle.length == 0) {
    70     
    69                 	var alert_message = /*[[#{renkanIndex.js.empty_name_error}]]*/"Please enter a title"; 
    71           function go2Title()
    70                 	alert(alert_message);
    72           {
    71                 	return false;
    73               var renkantitle = $("#renkantitle").val();
    72                 }
    74               if(renkantitle.length == 0) {
    73                 
    75               	var alert_message = /*[[#{renkanIndex.js.empty_name_error}]]*/"Please enter a title"; 
    74                 new_space = {
    76               	alert(alert_message);
    75                 	title: renkantitle,
    77               	return false;
    76                 	description: "(empty description)",
    78               }
    77                 	uri: null
    79               
    78                 };
    80               new_space = {
    79                 
    81               	title: renkantitle,
    80                 var post_url = /*[[@{/rest/spaces/}]]*/"/rest/spaces/"; 
    82               	description: "(empty description)",
    81                 $.ajax(post_url, {
    83               	uri: null
    82                     data:JSON.stringify(new_space),
    84               };
    83                     type: "POST",
    85               
    84                     dataType: "json",
    86               var post_url = /*[[@{/rest/spaces/}]]*/"/rest/spaces/"; 
    85                     contentType: "application/json; charset=UTF-8"                    
    87               $.ajax(post_url, {
    86                 }).done(function(space){
    88                   data:JSON.stringify(new_space),
    87                 	var template_url = /*[[@{'/s/<%=space_id%>'}]]*/"s/<%=space_id%>";
    89                   type: "POST",
    88                 	window.location = _.template(template_url, {space_id: space.id});
    90                   dataType: "json",
    89                 });
    91                   contentType: "application/json; charset=UTF-8"                    
    90                 
    92               }).done(function(space){
    91                 //? window.location = "p/" + renkantitle : alert(/*[[#{renkanIndex.js.empty_name_error}]]*/"Please enter a name");
    93               	var template_url = /*[[@{'/s/<%=space_id%>'}]]*/"s/<%=space_id%>";
    92             }
    94               	window.location = _.template(template_url, {space_id: space.id});
    93  
    95               });
    94         /*]]>*/
    96               
    95         </script>
    97               //? window.location = "p/" + renkantitle : alert(/*[[#{renkanIndex.js.empty_name_error}]]*/"Please enter a name");
       
    98           }
       
    99 
       
   100       /*]]>*/
       
   101       </script>
    96     </body>
   102     </body>
    97 </html>
   103 </html>