server/src/main/webapp/WEB-INF/templates/renkanIndex.html
changeset 51 3247fccfbd3f
child 71 9af0874ce43f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/main/webapp/WEB-INF/templates/renkanIndex.html	Mon Jan 14 16:00:07 2013 +0100
@@ -0,0 +1,187 @@
+<!doctype html>
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" >
+        <title>Renkan</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="favicon.ico"/>
+        <script src="lib/jquery.min.js" th:src="@{/static/lib/jquery.min.js}" ></script>
+        <script src="lib/underscore-min.js" th:src="@{/static/lib/underscore-min.js}" ></script>
+        <script src="js/main.js" th:src="@{/static/js/main.js}" ></script>
+
+        <style>
+        /*<![CDATA[*/
+            body {
+              margin: 0;
+              height: 100%;
+              color: #333;
+              font: 14px helvetica, sans-serif;
+              background: #ddd;
+              background: -webkit-radial-gradient(circle,#aaa,#eee 60%) center fixed;
+              background: -moz-radial-gradient(circle,#aaa,#eee 60%) center fixed;
+              background: -ms-radial-gradient(circle,#aaa,#eee 60%) center fixed;
+              background: -o-radial-gradient(circle,#aaa,#eee 60%) center fixed;
+              border-top: 8px solid rgba(51,51,51,.8);
+            }
+            #wrapper {
+              border-top: 1px solid #999;
+              margin-top: 160px;
+              padding: 15px;
+              background: #eee;
+              background: -webkit-linear-gradient(#fff,#ccc);
+              background: -moz-linear-gradient(#fff,#ccc);
+              background: -ms-linear-gradient(#fff,#ccc);
+              background: -o-linear-gradient(#fff,#ccc);
+              opacity: .9;
+              box-shadow: 0px 1px 8px rgba(0,0,0,0.3);
+            }
+            #inner {
+              width: 350px;
+              margin: 0 auto;
+            }
+            #button {
+              margin: 0 auto;
+              border-radius: 3px;
+              text-align: center;
+              font: 36px verdana,arial,sans-serif;
+              color: white;
+              text-shadow: 0 -1px 0 rgba(0,0,0,.8);
+              height: 70px;
+              line-height: 70px;
+              background: #555;
+              background: -webkit-linear-gradient(#5F5F5F,#565656 50%,#4C4C4C 51%,#373737);
+              background: -moz-linear-gradient(#5F5F5F,#565656 50%,#4C4C4C 51%,#373737);
+              background: -ms-linear-gradient(#5F5F5F,#565656 50%,#4C4C4C 51%,#373737);
+              background: -o-linear-gradient(#5F5F5F,#565656 50%,#4C4C4C 51%,#373737);
+              box-shadow: inset 0 1px 3px rgba(0,0,0,0.9);
+            }
+            #button:hover {
+              cursor: pointer;
+              background: #666;
+              background: -webkit-linear-gradient(#707070,#666666 50%,#5B5B5B 51%,#474747);
+              background: -moz-linear-gradient(#707070,#666666 50%,#5B5B5B 51%,#474747);
+              background: -ms-linear-gradient(#707070,#666666 50%,#5B5B5B 51%,#474747);
+              background: -o-linear-gradient(#707070,#666666 50%,#5B5B5B 51%,#474747);
+            }
+            #button:active {
+              box-shadow: inset 0 1px 12px rgba(0,0,0,0.9);
+              background: #444;
+            }
+            #label {
+              text-align: left;
+              text-shadow: 0 1px 1px #fff;
+              margin: 16px auto 0;
+            }
+            form {
+              height: 38px;
+              background: #fff;
+              border: 1px solid #bbb;
+              border-radius: 3px;
+              position: relative;
+            }
+            button, input {
+              font-weight: bold;
+              font-size: 15px;
+            }
+            input[type="text"] {
+              border-radius: 3px;
+              box-sizing: border-box;
+              -moz-box-sizing: border-box;   
+              padding: 0 45px 0 10px;
+              *padding: 0; /* IE7 hack */
+              width: 100%;
+              height: 100%;
+              outline: none;
+              border: none;
+              position: absolute;
+            }
+            button[type="submit"] {
+              position: absolute;
+              right: 0;
+              width: 45px;
+              height: 38px;
+            }
+            @media only screen and (min-device-width: 320px) and (max-device-width: 720px) {
+              body {
+                background: #bbb;
+                background: -webkit-linear-gradient(#aaa,#eee 60%) center fixed;
+                background: -moz-linear-gradient(#aaa,#eee 60%) center fixed;
+                background: -ms-linear-gradient(#aaa,#eee 60%) center fixed;
+              }
+              #wrapper {
+                margin-top: 0;
+              }
+              #inner {
+                width: 95%;        
+              }
+              #label {
+                text-align: center;
+              }
+            }
+        /*]]>*/
+        </style>
+        <link href="static/css/index.css" rel="stylesheet" th:href="@{/static/css/index.css}"/> 
+        
+        <div id="wrapper">
+            <div id="inner">
+                <div id="button" onclick="go2Random()" class="translate" th:utext="#{renkanIndex.new_renkan}">New Renkan</div>
+                <div id="label" class="translate" th:text="#{renkanIndex.renkan_title}">Create a Renkan with the title</div> 
+                <form action="#" onsubmit="go2Title();return false;"> 
+                    <input type="text" id="renkantitle" autofocus="autofocus" x-webkit-speech="x-webkit-speech"/> 
+                    <button type="submit">OK</button>
+                </form>
+            </div>
+            <h2 th:text="#{renkanIndex.project_list}">Project list</h2>
+            <table>
+              <thead>
+                <tr>
+                    <th th:text="#{renkanIndex.project_name}">Name</th><th th:text="#{renkanIndex.project_creation}">Creation</th><th th:text="#{renkanIndex.project_edit}">Edit</th>
+                </tr>
+              </thead>
+              <tbody>
+                <tr th:each="project: ${projects}">
+                  <th th:text="${project.title}">title</th>
+                  <td th:text="${#dates.format(project.created, #messages.msg('date.format'))}">date</td>
+                  <td><a href="#" th:href="@{'/p/'+${project.id}(cowebkey=${project.key})}" th:text="#{renkanIndex.project_edit_link}">Edit projet</a></td>
+                </tr>
+              </tbody>
+            </table>            
+        </div>
+        <script th:inline="javascript" >
+        /*<![CDATA[*/
+      
+            function go2Title()
+            {
+                var renkantitle = $("#renkantitle").val();
+                if(renkantitle.length == 0) {
+                	var alert_message = /*[[#{renkanIndex.js.empty_name_error}]]*/"Please enter a title"; 
+                	alert(alert_message);
+                	return false;
+                }
+                
+                new_renkan = {
+                	title: renkantitle,
+                	description: "(empty description)",
+                	uri: null
+                };
+                
+                var post_url = /*[[@{/rest/projects/}]]*/"/rest/projects/"; 
+                $.ajax(post_url, {
+                    data:JSON.stringify(new_renkan),
+                    type: "POST",
+                    dataType: "json",
+                    contentType: "application/json; charset=UTF-8"                    
+                }).done(function(project){
+                	var template_url = /*[[@{'/p/<%=project_id%>'(cowebkey='')}]]*/"p/<%=project_id%>?cowebkey=<%=project_key%>";
+                	window.location = _.template(template_url+'<%=project_key%>', {project_id: project.id, project_key: project.key});
+                });
+                
+                //? window.location = "p/" + renkantitle : alert(/*[[#{renkanIndex.js.empty_name_error}]]*/"Please enter a name");
+            }
+ 
+        /*]]>*/
+        </script>
+
+</html>