| author | ymh <ymh.work@gmail.com> |
| Sun, 25 May 2014 13:45:24 +0900 | |
| changeset 298 | 2f35c2ae7de8 |
| parent 257 | 6bf1126c5add |
| child 304 | 8ad1734d9d8a |
| permissions | -rw-r--r-- |
|
150
5b62100b8562
- replace simple http authentication by form auth
ymh <ymh.work@gmail.com>
parents:
137
diff
changeset
|
1 |
<!DOCTYPE html> |
|
224
0167b777ad15
remove deprecated warnings + fix date picker default langauge
ymh <ymh.work@gmail.com>
parents:
150
diff
changeset
|
2 |
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" th:lang="${#ctx.getLocale().toLanguageTag()}" > |
|
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 |
||
| 127 | 10 |
<link rel="shortcut icon" href="../../static/img/favicon.ico" th:href="@{/static/img/favicon.ico}"/> |
| 123 | 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 |
||
| 81 | 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> |
|
| 298 | 17 |
<script src="../../lib/URI.js" th:src="@{/static/lib/URI.js}" ></script> |
| 71 | 18 |
|
|
97
f7d611f50e58
add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents:
90
diff
changeset
|
19 |
<link href="../../static/css/style.css" rel="stylesheet" th:href="@{/static/css/style.css}"/> |
| 81 | 20 |
<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
|
21 |
</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
|
22 |
<body> |
|
97
f7d611f50e58
add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents:
90
diff
changeset
|
23 |
<div id="container"> |
| 71 | 24 |
<div id="wrapper"> |
|
150
5b62100b8562
- replace simple http authentication by form auth
ymh <ymh.work@gmail.com>
parents:
137
diff
changeset
|
25 |
<header id="header"> |
|
5b62100b8562
- replace simple http authentication by form auth
ymh <ymh.work@gmail.com>
parents:
137
diff
changeset
|
26 |
<h1><a href="renkanIndex.html" th:href="@{'/'}" id="home-link" th:text="#{renkanIndex.renkan_space}">Renkan Space</a>: <span th:text="${space.title}">Titre</span></h1> |
|
5b62100b8562
- replace simple http authentication by form auth
ymh <ymh.work@gmail.com>
parents:
137
diff
changeset
|
27 |
<div id="headerNav" th:include="fragment/pageFragment :: headerNavFragment"></div> |
|
5b62100b8562
- replace simple http authentication by form auth
ymh <ymh.work@gmail.com>
parents:
137
diff
changeset
|
28 |
</header> |
| 71 | 29 |
<div id="inner"> |
| 87 | 30 |
<div id="label" class="translate" th:text="#{renkanIndex.renkan_exp}">Create a Renkan</div> |
| 298 | 31 |
<form action="#" id="new-renkan-form"> |
32 |
<fieldset id="form-fields"> |
|
33 |
<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> |
|
34 |
<div id="file-field"><label th:text="#{renkanIndex.renkan_file}" for="renkanfile">file</label><input type="file" id="renkanfile"/></div> |
|
35 |
</fieldset> |
|
36 |
<div id="form-submit"><button type="submit">OK</button></div> |
|
| 71 | 37 |
</form> |
38 |
</div> |
|
| 137 | 39 |
<div id="project-list-container"> |
40 |
<h2 th:text="#{renkanIndex.project_list}">Project list</h2> |
|
41 |
<div id="project-filter-container"> |
|
42 |
<form method="get"> |
|
43 |
<input type="text" id="project-filter" name="filter" placeholder="filter title" th:placeholder="#{renkanIndex.project_filter}" th:value="${param['filter']}?${param['filter'][0]}:''" /> |
|
44 |
<button type="submit">OK</button> |
|
| 298 | 45 |
</form> |
| 137 | 46 |
</div> |
47 |
<div th:include="fragment/paginationFragment :: paginationFragment" class="pagination-container"> |
|
| 298 | 48 |
<div> |
49 |
<a href="#?p.page=1"><<</a> |
|
| 137 | 50 |
<a href="#?p.page=3"><</a> |
51 |
<span>...</span> |
|
52 |
<a href="#?p.page=2">2</a> |
|
53 |
<a href="#?p.page=3">3</a> |
|
54 |
<span>4</span> |
|
55 |
<a href="#?p.page=5">5</a> |
|
56 |
<a href="#?p.page=6">6</a> |
|
57 |
<span>...</span> |
|
58 |
<a href="#?p.page=5">></a> |
|
59 |
<a href="#?p.page=7">>></a> |
|
60 |
</div> |
|
61 |
</div> |
|
62 |
<table th:with="columnSort=${param['p.sort']}?${param['p.sort'][0]}:'updated',sortDir=${param['p.sort.dir']}?${param['p.sort.dir'][0]}:'desc'"> |
|
63 |
<thead th:with="sortDirInv=${sortDir}=='desc'?'asc':'desc'"> |
|
64 |
<tr> |
|
65 |
<th th:with="sorted=(${columnSort}=='title')"><span th:text="#{renkanIndex.project_name}">Name</span><form method="get" class="proj-sort-form"><input type="hidden" name="p.sort" value="title"/><input type="hidden" name="p.sort.dir" th:value="${sorted}?${sortDirInv}:'desc'"/><input th:if="${param['filter']}" name="filter" type="hidden" th:value="${param['filter'][0]}"/><input type="submit" class="proj-sortable-col" th:class="${sorted}?'proj-sort-'+${sortDir}+'-col':'proj-sortable-col'" value=""/></form></th> |
|
66 |
<th th:with="sorted=(${columnSort}=='updated')"><span th:text="#{renkanIndex.project_updated}">Updated</span><form method="get" class="proj-sort-form"><input type="hidden" name="p.sort" value="updated"/><input type="hidden" name="p.sort.dir" th:value="(${sorted})?${sortDirInv}:'desc'"/><input th:if="${param['filter']}" name="filter" type="hidden" th:value="${param['filter'][0]}"/><input type="submit" class="proj-sort-desc-col" th:class="${sorted}?'proj-sort-'+${sortDir}+'-col':'proj-sortable-col'" value=""/></form></th> |
|
67 |
<th th:with="sorted=(${columnSort}=='created')"><span th:text="#{renkanIndex.project_creation}" >Creation</span><form method="get" class="proj-sort-form"><input type="hidden" name="p.sort" value="created"/><input type="hidden" name="p.sort.dir" th:value="${sorted}?${sortDirInv}:'desc'"/><input th:if="${param['filter']}" name="filter" type="hidden" th:value="${param['filter'][0]}"/><input type="submit" class="proj-sort-asc-col" th:class="${sorted}?'proj-sort-'+${sortDir}+'-col':'proj-sortable-col'" value=""/></form></th> |
|
68 |
<th th:text="#{renkanIndex.project_edit}">Edit</th> |
|
69 |
<th th:text="#{renkanIndex.project_copy}">Copy</th> |
|
70 |
<th th:text="#{renkanIndex.project_delete}">Del.</th> |
|
71 |
<th th:text="#{renkanIndex.project_render}">View</th> |
|
72 |
</tr> |
|
73 |
</thead> |
|
74 |
<tbody> |
|
75 |
<tr th:each="project: ${page}"> |
|
76 |
<th th:text="${project.title}">title</th> |
|
77 |
<td th:text="${project.updated}?${#dates.format(project.updated, #messages.msg('date.format'))}:''">update</td> |
|
78 |
<td th:text="${#dates.format(project.created, #messages.msg('date.format'))}">date</td> |
|
79 |
<td><a href="#" th:href="@{'/p/'+${project.id}(cowebkey=${project.getKey(2)})}" th:text="#{renkanIndex.project_edit_link}">Edit project</a></td> |
|
| 298 | 80 |
<td><a href="#" th:text="#{renkanIndex.project_copy_link}" th:attr="data-project_id=${project.id}" class="copy-project">Copy project</a></td> |
81 |
<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> |
|
| 137 | 82 |
<td><a href="#" th:href="@{'/p/pub/'+${project.id}(cowebkey=${project.getKey(1)})}" th:text="#{renkanIndex.project_render_link}">View project</a></td> |
83 |
</tr> |
|
84 |
</tbody> |
|
85 |
</table> |
|
| 298 | 86 |
</div> |
| 71 | 87 |
</div> |
| 127 | 88 |
<footer id="footer" th:include="fragment/pageFragment :: footerFragment"> |
| 257 | 89 |
<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> |
| 127 | 90 |
</footer> |
|
97
f7d611f50e58
add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents:
90
diff
changeset
|
91 |
</div> |
|
f7d611f50e58
add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents:
90
diff
changeset
|
92 |
<script th:inline="javascript" > |
|
f7d611f50e58
add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents:
90
diff
changeset
|
93 |
/*<![CDATA[*/ |
|
f7d611f50e58
add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents:
90
diff
changeset
|
94 |
|
|
f7d611f50e58
add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents:
90
diff
changeset
|
95 |
function go2Title() |
|
f7d611f50e58
add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents:
90
diff
changeset
|
96 |
{ |
| 298 | 97 |
var renkantitle = $("#renkantitle").val(), |
98 |
renkanfiles = $("#renkanfile").prop("files"); |
|
99 |
|
|
100 |
if(renkantitle.length == 0 && renkanfiles.length == 0) { |
|
101 |
var alert_message = /*[[#{renkanIndex.js.empty_form_error}]]*/"Please enter a title or a file"; |
|
|
97
f7d611f50e58
add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents:
90
diff
changeset
|
102 |
alert(alert_message); |
|
f7d611f50e58
add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents:
90
diff
changeset
|
103 |
return false; |
|
f7d611f50e58
add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents:
90
diff
changeset
|
104 |
} |
| 298 | 105 |
var post_url = /*[[@{/rest/projects/}]]*/"/rest/projects/", |
106 |
deferred = $.Deferred(); |
|
|
97
f7d611f50e58
add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents:
90
diff
changeset
|
107 |
|
| 298 | 108 |
deferred.done(function(new_renkan) { |
109 |
new_renkan.space_id = /*[[${space.id}]]*/"_"; |
|
110 |
$.ajax(post_url, { |
|
111 |
data:JSON.stringify(new_renkan), |
|
112 |
type: "POST", |
|
113 |
dataType: "json", |
|
114 |
contentType: "application/json; charset=UTF-8" |
|
115 |
}).done(function(project){ |
|
116 |
var uri = new URI(window.location); |
|
117 |
window.location = uri.setSearch("p.sort","created").setSearch("p.sort.dir", "desc").href(); |
|
118 |
}); |
|
|
97
f7d611f50e58
add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents:
90
diff
changeset
|
119 |
}); |
| 298 | 120 |
|
121 |
if(renkanfiles.length == 0) { |
|
122 |
deferred.resolve({ |
|
123 |
title: renkantitle, |
|
124 |
description: "", |
|
125 |
uri: null, |
|
126 |
}); |
|
127 |
} |
|
128 |
else { |
|
129 |
fr = new FileReader(); |
|
130 |
fr.onload = function() { |
|
131 |
var new_renkan = JSON.parse(fr.result); |
|
132 |
if(renkantitle.length > 0) { |
|
133 |
new_renkan.title = renkantitle; |
|
134 |
} |
|
135 |
if(typeof new_renkan.created !== "undefined") { |
|
136 |
delete new_renkan.created; |
|
137 |
} |
|
138 |
if(typeof new_renkan.updated !== "undefined") { |
|
139 |
delete new_renkan.updated; |
|
140 |
} |
|
141 |
deferred.resolve(new_renkan); |
|
142 |
}; |
|
143 |
fr.readAsText(renkanfiles[0]); |
|
144 |
} |
|
145 |
} |
|
146 |
||
147 |
function copyProject(project_id) |
|
148 |
{ |
|
149 |
var post_url = /*[[@{/p/copy}]]*/"#"; |
|
150 |
$.post(post_url, {"project_id": project_id}) |
|
151 |
.done(function(p){ |
|
152 |
window.location.reload(); |
|
153 |
}); |
|
|
97
f7d611f50e58
add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents:
90
diff
changeset
|
154 |
} |
| 71 | 155 |
|
| 298 | 156 |
function deleteProject(project_id, project_title) |
157 |
{ |
|
158 |
var message = /*[[#{renkanIndex.project_delete_confirm}]]*/"Delete project \"<%= title %>\""; |
|
159 |
if(confirm(_.template(message, {title: project_title}))) { |
|
160 |
var delete_url = /*[[@{/rest/projects}]]*/"#"; |
|
161 |
$.ajax(delete_url+"/"+project_id, { |
|
162 |
type: "DELETE" |
|
163 |
}).done(function(){ |
|
164 |
window.location.reload(); |
|
165 |
}); |
|
166 |
} |
|
167 |
} |
|
168 |
|
|
169 |
$(function(){ |
|
170 |
|
|
171 |
$(".copy-project").click(function(event) { |
|
172 |
copyProject($(event.target).data("project_id")); |
|
173 |
}); |
|
174 |
||
175 |
$(".delete-project").click(function(event) { |
|
176 |
deleteProject($(event.target).data("project_id"), $(event.target).data("project_title")); |
|
177 |
}); |
|
178 |
||
179 |
|
|
180 |
$("#new-renkan-form").submit(function(e) { |
|
181 |
e.preventDefault(); |
|
182 |
go2Title(); |
|
183 |
return false; |
|
184 |
}); |
|
185 |
|
|
186 |
$("#import-renkan-form").submit(function(e) { |
|
187 |
e.preventDefault(); |
|
188 |
console.log("import form event :", e); |
|
189 |
}); |
|
|
97
f7d611f50e58
add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents:
90
diff
changeset
|
190 |
}); |
|
f7d611f50e58
add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents:
90
diff
changeset
|
191 |
|
|
f7d611f50e58
add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents:
90
diff
changeset
|
192 |
/*]]>*/ |
|
f7d611f50e58
add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents:
90
diff
changeset
|
193 |
</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
|
194 |
</body> |
| 71 | 195 |
</html> |