| author | ymh <ymh.work@gmail.com> |
| Sat, 16 Mar 2013 04:36:50 +0100 | |
| changeset 90 | fa7d68b9d8b0 |
| parent 87 | 6c810f746837 |
| child 97 | f7d611f50e58 |
| permissions | -rw-r--r-- |
| 71 | 1 |
<!doctype html> |
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 | 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="favicon.ico"/> |
|
| 81 | 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> |
|
13 |
<script src="../../js/main.js" th:src="@{/static/js/main.js}" ></script> |
|
| 71 | 14 |
|
| 81 | 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 | 18 |
<div id="wrapper"> |
| 81 | 19 |
<h1><span th:text="#{renkanIndex.renkan_space}">Renkan Space</span>: <span th:text="${space.title}">Titre</span></h1> |
| 71 | 20 |
<div id="inner"> |
| 87 | 21 |
<div id="label" class="translate" th:text="#{renkanIndex.renkan_exp}">Create a Renkan</div> |
| 71 | 22 |
<form action="#" onsubmit="go2Title();return false;"> |
23 |
<input type="text" id="renkantitle" autofocus="autofocus" x-webkit-speech="x-webkit-speech"/> |
|
24 |
<button type="submit">OK</button> |
|
25 |
</form> |
|
26 |
</div> |
|
27 |
<h2 th:text="#{renkanIndex.project_list}">Project list</h2> |
|
| 87 | 28 |
<div th:include="fragment/paginationFragment :: paginationFragment" class="pagination-container"> |
29 |
<div> |
|
30 |
<a href="#?p.page=1"><<</a> |
|
31 |
<a href="#?p.page=3"><</a> |
|
32 |
<span>...</span> |
|
33 |
<a href="#?p.page=2">2</a> |
|
34 |
<a href="#?p.page=3">3</a> |
|
35 |
<span>4</span> |
|
36 |
<a href="#?p.page=5">5</a> |
|
37 |
<a href="#?p.page=6">6</a> |
|
38 |
<span>...</span> |
|
39 |
<a href="#?p.page=5">></a> |
|
40 |
<a href="#?p.page=7">>></a> |
|
41 |
</div> |
|
42 |
</div> |
|
| 71 | 43 |
<table> |
44 |
<thead> |
|
45 |
<tr> |
|
| 80 | 46 |
<th th:text="#{renkanIndex.project_name}">Name</th> |
47 |
<th th:text="#{renkanIndex.project_creation}">Creation</th> |
|
48 |
<th th:text="#{renkanIndex.project_edit}">Edit</th> |
|
| 86 | 49 |
<th th:text="#{renkanIndex.project_copy}">Copy</th> |
50 |
<th th:text="#{renkanIndex.project_delete}">Del.</th> |
|
| 81 | 51 |
<th th:text="#{renkanIndex.project_render}">View</th> |
| 71 | 52 |
</tr> |
53 |
</thead> |
|
54 |
<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
|
55 |
<tr th:each="project: ${page}"> |
| 71 | 56 |
<th th:text="${project.title}">title</th> |
57 |
<td th:text="${#dates.format(project.created, #messages.msg('date.format'))}">date</td> |
|
| 81 | 58 |
<td><a href="#" th:href="@{'/p/'+${project.id}(cowebkey=${project.getKey(2)})}" th:text="#{renkanIndex.project_edit_link}">Edit project</a></td> |
| 86 | 59 |
<td><a href="#" th:text="#{renkanIndex.project_copy_link}" th:attr="data-project_id=${project.id}" class="copy_project">Copy project</a></td> |
60 |
<td><a href="#" th:text="#{renkanIndex.project_delete_link}" th:attr="data-project_id=${project.id},data-project_title=${project.title}" class="delete_project">Delete project</a></td> |
|
| 81 | 61 |
<td><a href="#" th:href="@{'/p/pub/'+${project.id}(cowebkey=${project.getKey(1)})}" th:text="#{renkanIndex.project_render_link}">View project</a></td> |
| 71 | 62 |
</tr> |
63 |
</tbody> |
|
64 |
</table> |
|
65 |
</div> |
|
66 |
<script th:inline="javascript" > |
|
67 |
/*<![CDATA[*/ |
|
68 |
|
|
69 |
function go2Title() |
|
70 |
{ |
|
71 |
var renkantitle = $("#renkantitle").val(); |
|
72 |
if(renkantitle.length == 0) { |
|
73 |
var alert_message = /*[[#{renkanIndex.js.empty_name_error}]]*/"Please enter a title"; |
|
74 |
alert(alert_message); |
|
75 |
return false; |
|
76 |
} |
|
77 |
|
|
78 |
new_renkan = { |
|
79 |
title: renkantitle, |
|
80 |
description: "(empty description)", |
|
81 |
uri: null, |
|
82 |
space_id: /*[[${space.id}]]*/"_", |
|
83 |
}; |
|
84 |
|
|
85 |
var post_url = /*[[@{/rest/projects/}]]*/"/rest/projects/"; |
|
86 |
$.ajax(post_url, { |
|
87 |
data:JSON.stringify(new_renkan), |
|
88 |
type: "POST", |
|
89 |
dataType: "json", |
|
90 |
contentType: "application/json; charset=UTF-8" |
|
91 |
}).done(function(project){ |
|
| 90 | 92 |
window.location.reload(); |
| 71 | 93 |
}); |
94 |
|
|
95 |
} |
|
| 86 | 96 |
|
97 |
function copyProject(project_id) |
|
98 |
{ |
|
99 |
var post_url = /*[[@{/p/copy}]]*/"#"; |
|
100 |
$.post(post_url, {"project_id": project_id}) |
|
101 |
.done(function(p){ |
|
102 |
window.location.reload(); |
|
103 |
}); |
|
104 |
} |
|
105 |
|
|
106 |
function deleteProject(project_id, project_title) |
|
107 |
{ |
|
108 |
var message = /*[[#{renkanIndex.project_delete_confirm}]]*/"Delete project \"<%= title %>\""; |
|
109 |
if(confirm(_.template(message, {title: project_title}))) { |
|
110 |
var delete_url = /*[[@{/rest/projects}]]*/"#"; |
|
111 |
$.ajax(delete_url+"/"+project_id, { |
|
112 |
type: "DELETE" |
|
113 |
}).done(function(){ |
|
114 |
window.location.reload(); |
|
115 |
}); |
|
116 |
} |
|
117 |
} |
|
118 |
|
|
119 |
$(function(){ |
|
120 |
$(".copy_project").click(function(event) { |
|
121 |
copyProject($(event.target).data("project_id")); |
|
122 |
}); |
|
123 |
$(".delete_project").click(function(event) { |
|
124 |
deleteProject($(event.target).data("project_id"), $(event.target).data("project_title")); |
|
125 |
}); |
|
126 |
}); |
|
| 71 | 127 |
|
128 |
/*]]>*/ |
|
129 |
</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
|
130 |
</body> |
| 71 | 131 |
</html> |