server/src/main/webapp/WEB-INF/templates/projectIndex.html
author veltr
Fri, 15 Mar 2013 12:54:36 +0100
changeset 81 555a094e2000
parent 80 5295e118320b
child 86 0fe9045d25b7
permissions -rw-r--r--
Changed CSS
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
71
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<!doctype html>
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" >
76
523f0647513e add the count of project by spaces, add pagination, update libraries and add some more unit tests.
ymh <ymh.work@gmail.com>
parents: 71
diff changeset
     3
    <head>
71
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
        <title>Renkan</title>
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
        <meta charset="utf-8"/>
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
        <link rel="shortcut icon" href="favicon.ico"/>
81
555a094e2000 Changed CSS
veltr
parents: 80
diff changeset
    11
        <script src="../../lib/jquery.min.js" th:src="@{/static/lib/jquery.min.js}" ></script>
555a094e2000 Changed CSS
veltr
parents: 80
diff changeset
    12
        <script src="../../lib/underscore-min.js" th:src="@{/static/lib/underscore-min.js}" ></script>
555a094e2000 Changed CSS
veltr
parents: 80
diff changeset
    13
        <script src="../../js/main.js" th:src="@{/static/js/main.js}" ></script>
71
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
81
555a094e2000 Changed CSS
veltr
parents: 80
diff changeset
    15
        <link href="../../static/css/index.css" rel="stylesheet" th:href="@{/static/css/index.css}"/> 
76
523f0647513e add the count of project by spaces, add pagination, update libraries and add some more unit tests.
ymh <ymh.work@gmail.com>
parents: 71
diff changeset
    16
    </head>
523f0647513e add the count of project by spaces, add pagination, update libraries and add some more unit tests.
ymh <ymh.work@gmail.com>
parents: 71
diff changeset
    17
    <body>
71
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
        <div id="wrapper">
81
555a094e2000 Changed CSS
veltr
parents: 80
diff changeset
    19
        	<h1><span th:text="#{renkanIndex.renkan_space}">Renkan Space</span>: <span th:text="${space.title}">Titre</span></h1>
71
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
            <div id="inner">
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
                <div id="button" onclick="go2Random()" class="translate" th:utext="#{renkanIndex.new_renkan}">New Renkan</div>
76
523f0647513e add the count of project by spaces, add pagination, update libraries and add some more unit tests.
ymh <ymh.work@gmail.com>
parents: 71
diff changeset
    22
                <div id="label" class="translate" th:text="#{renkanIndex.renkan_exp}">Create a Renkan with the title</div> 
71
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
                <form action="#" onsubmit="go2Title();return false;"> 
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
                    <input type="text" id="renkantitle" autofocus="autofocus" x-webkit-speech="x-webkit-speech"/> 
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
                    <button type="submit">OK</button>
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
                </form>
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
            </div>
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
            <h2 th:text="#{renkanIndex.project_list}">Project list</h2>
76
523f0647513e add the count of project by spaces, add pagination, update libraries and add some more unit tests.
ymh <ymh.work@gmail.com>
parents: 71
diff changeset
    29
            <div th:include="fragment/paginationFragment :: paginationFragment"></div>
71
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
            <table>
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
              <thead>
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
                <tr>
80
5295e118320b add link for publish
ymh <ymh.work@gmail.com>
parents: 76
diff changeset
    33
                    <th th:text="#{renkanIndex.project_name}">Name</th>
5295e118320b add link for publish
ymh <ymh.work@gmail.com>
parents: 76
diff changeset
    34
                    <th th:text="#{renkanIndex.project_creation}">Creation</th>
5295e118320b add link for publish
ymh <ymh.work@gmail.com>
parents: 76
diff changeset
    35
                    <th th:text="#{renkanIndex.project_edit}">Edit</th>
81
555a094e2000 Changed CSS
veltr
parents: 80
diff changeset
    36
                    <th th:text="#{renkanIndex.project_render}">View</th>
71
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
                </tr>
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
              </thead>
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    39
              <tbody>
76
523f0647513e add the count of project by spaces, add pagination, update libraries and add some more unit tests.
ymh <ymh.work@gmail.com>
parents: 71
diff changeset
    40
                <tr th:each="project: ${page}">
71
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
                  <th th:text="${project.title}">title</th>
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    42
                  <td th:text="${#dates.format(project.created, #messages.msg('date.format'))}">date</td>
81
555a094e2000 Changed CSS
veltr
parents: 80
diff changeset
    43
                  <td><a href="#" th:href="@{'/p/'+${project.id}(cowebkey=${project.getKey(2)})}" th:text="#{renkanIndex.project_edit_link}">Edit project</a></td>
555a094e2000 Changed CSS
veltr
parents: 80
diff changeset
    44
                  <td><a href="#" th:href="@{'/p/pub/'+${project.id}(cowebkey=${project.getKey(1)})}" th:text="#{renkanIndex.project_render_link}">View project</a></td>
71
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    45
                </tr>
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
              </tbody>
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
            </table>            
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
        </div>
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
        <script th:inline="javascript" >
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
        /*<![CDATA[*/
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    51
      
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
            function go2Title()
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
            {
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
                var renkantitle = $("#renkantitle").val();
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
                if(renkantitle.length == 0) {
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    56
                	var alert_message = /*[[#{renkanIndex.js.empty_name_error}]]*/"Please enter a title"; 
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
                	alert(alert_message);
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    58
                	return false;
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    59
                }
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
                
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    61
                new_renkan = {
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    62
                	title: renkantitle,
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    63
                	description: "(empty description)",                	
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    64
                	uri: null,
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    65
                	space_id: /*[[${space.id}]]*/"_",
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    66
                };
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    67
                
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    68
                var post_url = /*[[@{/rest/projects/}]]*/"/rest/projects/"; 
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    69
                $.ajax(post_url, {
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    70
                    data:JSON.stringify(new_renkan),
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    71
                    type: "POST",
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    72
                    dataType: "json",
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    73
                    contentType: "application/json; charset=UTF-8"                    
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    74
                }).done(function(project){
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    75
                	var template_url = /*[[@{'/p/<%=project_id%>'(cowebkey='')}]]*/"p/<%=project_id%>?cowebkey=<%=project_key%>";
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    76
                	window.location = _.template(template_url+'<%=project_key%>', {project_id: project.id, project_key: project.key});
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    77
                });
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    78
                
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    79
                //? window.location = "p/" + renkantitle : alert(/*[[#{renkanIndex.js.empty_name_error}]]*/"Please enter a name");
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    80
            }
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    81
 
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    82
        /*]]>*/
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    83
        </script>
76
523f0647513e add the count of project by spaces, add pagination, update libraries and add some more unit tests.
ymh <ymh.work@gmail.com>
parents: 71
diff changeset
    84
    </body>
71
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    85
</html>