| author | rbernard |
| Fri, 12 Feb 2010 21:58:53 +0100 | |
| changeset 172 | 9a355903350d |
| parent 147 | 286863e6e2c1 |
| child 193 | e403cc287ea6 |
| permissions | -rw-r--r-- |
| 0 | 1 |
{% extends "site/layout/base_workspace.html" %} |
2 |
{% load com %} |
|
3 |
{% load i18n %} |
|
4 |
{% load local_perms %} |
|
5 |
{% load activity %} |
|
| 38 | 6 |
{% load tagging_tags %} |
| 0 | 7 |
|
8 |
{% block head %} |
|
9 |
{% endblock %} |
|
10 |
||
11 |
{% block title %} |
|
12 |
{% blocktrans %}Texts{% endblocktrans %} |
|
13 |
{% endblock %} |
|
14 |
||
15 |
{% block main %} |
|
16 |
||
17 |
{% get_local_perm request can_create_text as can_create_text %} |
|
18 |
{% get_local_perm request can_manage_workspace as can_manage_workspace %} |
|
19 |
||
20 |
<script type="text/javascript"> |
|
21 |
<!-- |
|
22 |
tb_conf['current_tab'] = 'text'; |
|
23 |
--> |
|
24 |
</script> |
|
25 |
||
26 |
<script type="text/javascript"> |
|
27 |
<!-- |
|
28 |
$(function() { |
|
29 |
$(".hidden-text-actions").css('visibility','hidden'); |
|
30 |
}) ; |
|
31 |
--> |
|
32 |
</script> |
|
33 |
||
34 |
<div id="text" class="tab-meta"> |
|
35 |
||
36 |
<ul class="sub_list"> |
|
37 |
<li class="active_sub">{% blocktrans %}Text list{% endblocktrans %}</li> |
|
38 |
{% if can_create_text %} |
|
39 |
<li> / </li> |
|
40 |
<li><a href="{% url text-create-content %}">{% blocktrans %}Write a text{% endblocktrans %}</a></li> |
|
41 |
<li> / </li> |
|
42 |
<li><a href="{% url text-create-upload %}">{% blocktrans %}Upload a text{% endblocktrans %}</a></li> |
|
43 |
{% endif %} |
|
44 |
</ul> |
|
45 |
||
| 38 | 46 |
<form id="filter_form" action="." method="get"> |
47 |
<table summary="{% blocktrans %}People' list{% endblocktrans %}" class="large_table"> |
|
48 |
<tr> |
|
49 |
<td> |
|
50 |
{% blocktrans %}Filter by tag:{% endblocktrans %} |
|
51 |
<select id="tag_selected" name="tag_selected"> |
|
52 |
<option {% if not tag_selected %}selected="selected"{% endif %} value="0">- {% blocktrans %}All{% endblocktrans %} -</option> |
|
53 |
||
54 |
{% for tag in tag_list %} |
|
55 |
<option {% ifequal tag_selected tag.name %}selected="selected"{% endifequal %} value="{{ tag.name }}">{{ tag.name }}</option> |
|
56 |
{% endfor %} |
|
57 |
</select> |
|
58 |
</td> |
|
59 |
||
60 |
</tr> |
|
61 |
</table> |
|
62 |
</form> |
|
63 |
||
64 |
<script type="text/javascript"> |
|
65 |
<!-- |
|
66 |
$(function() { |
|
67 |
$("#tag_selected").change(function () { |
|
68 |
$("#filter_form").submit(); |
|
69 |
}); |
|
70 |
}) ; |
|
71 |
--> |
|
72 |
</script> |
|
73 |
||
| 0 | 74 |
{% if object_list %} |
75 |
<form id="texts_form" action="." method="post"> |
|
76 |
||
77 |
{% if can_manage_workspace %} |
|
78 |
<select id="bulk_actions" name="action"> |
|
79 |
<option selected="selected" value="-1">{% blocktrans %}Bulk Actions{% endblocktrans %}</option> |
|
80 |
<option value="delete">{% blocktrans %}Delete{% endblocktrans %}</option> |
|
81 |
</select> |
|
82 |
||
83 |
<input name="apply" id="apply" type="button" value="{% blocktrans %}Apply{% endblocktrans %}" disabled="disabled"/> |
|
84 |
||
85 |
<script type="text/javascript"> |
|
86 |
<!-- |
|
87 |
function check_activate_apply() { |
|
88 |
if (($("input[name^=check-]:checked").length > 0) && ($("#bulk_actions").val() != -1)) { |
|
89 |
$('#apply').removeAttr('disabled'); |
|
90 |
} |
|
91 |
else { |
|
92 |
$('#apply').attr('disabled','disabled'); |
|
93 |
} |
|
94 |
}; |
|
95 |
||
96 |
$(function() { |
|
97 |
$("input[name^=check-]").click(function () { |
|
98 |
check_activate_apply(); |
|
99 |
}); |
|
100 |
$("#bulk_actions").change(function () { |
|
101 |
check_activate_apply(); |
|
102 |
}); |
|
103 |
$("#apply").click(function () { |
|
104 |
question = "{% blocktrans %}Are you sure?{% endblocktrans %}"; |
|
105 |
if (confirm(question)) { |
|
106 |
$("#texts_form").submit(); |
|
107 |
} |
|
108 |
}); |
|
109 |
}) ; |
|
110 |
--> |
|
111 |
</script> |
|
112 |
{% endif %} |
|
113 |
||
114 |
{% include "site/macros/paginator.html" %} |
|
115 |
||
116 |
<div style="clear:both;"></div> |
|
117 |
||
118 |
<table summary="text list" class="large_table"> |
|
119 |
<thead> |
|
120 |
<tr> |
|
121 |
{% if can_manage_workspace %} |
|
122 |
<th class="check-column"><input type="checkbox" id="all_check" name="checkall"/> |
|
123 |
<script type="text/javascript"> |
|
124 |
<!-- |
|
125 |
$(function() { |
|
126 |
$("#all_check").click(function () { |
|
127 |
checked = $("#all_check").attr('checked'); |
|
128 |
$(".text_check").attr('checked', checked); |
|
129 |
check_activate_apply(); |
|
130 |
}); |
|
131 |
}) ; |
|
132 |
--> |
|
133 |
</script> |
|
134 |
</th> |
|
135 |
{% endif %} |
|
136 |
<th>{% up_down title %}{% blocktrans %}Text{% endblocktrans %}{% endup_down %}</th> |
|
137 |
<th>{% blocktrans %}Author{% endblocktrans %}</th> |
|
|
121
fafac127deb4
change default sorting for dates columns in text/user lists
raph
parents:
79
diff
changeset
|
138 |
<th>{% up_down -modified %}{% blocktrans %}Modified{% endblocktrans %}{% endup_down %}</th> |
| 147 | 139 |
<th>{% blocktrans %}# comments{% endblocktrans %}</th> |
| 0 | 140 |
{% if can_manage_workspace %}<th>{% blocktrans %}Last week activity{% endblocktrans %}</th>{% endif %} |
141 |
</tr> |
|
142 |
</thead> |
|
143 |
<tbody> |
|
144 |
{% for text in object_list %} |
|
145 |
||
146 |
{% get_local_text_perm request text can_edit_text as can_edit_text %} |
|
147 |
{% get_local_text_perm request text can_delete_text as can_delete_text %} |
|
148 |
{% get_local_text_perm request text can_manage_text as can_manage_text %} |
|
149 |
||
150 |
<tr class="text-{{ text.key }} {% cycle 'odd' 'even' %}"> |
|
151 |
{% if can_manage_workspace %}<td><input type="checkbox" class="text_check" name="check-{{ text.key }}"/></td>{% endif %} |
|
152 |
<td> |
|
153 |
<a class="main_object_title" href="{% url text-view text.key %}">{{ text.title }}</a> |
|
| 38 | 154 |
|
155 |
{% tags_for_object text.last_text_version as tag_list %} |
|
156 |
{% if tag_list %}<div class="tag_list>">{% blocktrans %}tags:{% endblocktrans %} {% for tag in tag_list %}<a class="tag" title="{% blocktrans with tag.name as tag_name %}Filter by tag: {{ tag_name }}{% endblocktrans %}" href="?{% newparams 'tag_selected' tag.name %}"">{{ tag.name }}</a> {% endfor %}</div>{% endif %} |
|
157 |
||
| 0 | 158 |
<div class="hidden-text-actions text-actions-{{ text.key }}"> |
| 79 | 159 |
<a href="{% url text-view text.key %}">{% blocktrans %}View{% endblocktrans %}</a> |
160 |
{% if can_edit_text %} | <a href="{% url text-edit text.key %}">{% blocktrans %}Edit{% endblocktrans %}</a> | {% endif %} |
|
| 0 | 161 |
{% if can_delete_text %}<a id="text-delete-{{ text.key }}" href="#">{% blocktrans %}Delete{% endblocktrans %}</a> | |
162 |
<script type="text/javascript"> |
|
163 |
<!-- |
|
164 |
$(function() { |
|
165 |
$("#text-delete-{{ text.key }}").click(function(){ |
|
166 |
url = '{% url text-delete text.key %}'; |
|
167 |
question = "{% blocktrans %}Are you sure you want to delete this text?{% endblocktrans %}"; |
|
168 |
if (confirm(question)) { |
|
169 |
$.post(url, function(data){ |
|
170 |
window.location = '{% url index %}'; |
|
171 |
}); |
|
172 |
} |
|
173 |
}); |
|
174 |
|
|
175 |
}) ; |
|
176 |
--> |
|
177 |
</script> |
|
178 |
||
179 |
{% endif %} |
|
180 |
{% if can_manage_text %}<a href="{% url text-share text.key %}">{% blocktrans %}Users{% endblocktrans %}</a> | {% endif %} |
|
181 |
{% if can_manage_text %}<a href="{% url text-settings text.key %}">{% blocktrans %}Settings{% endblocktrans %}</a>{% endif %} |
|
182 |
</div> |
|
183 |
<script type="text/javascript"> |
|
184 |
<!-- |
|
185 |
$(function() { |
|
186 |
$(".text-{{ text.key }}").mouseover(function(){ |
|
187 |
$(".text-actions-{{ text.key }}").css('visibility','visible'); |
|
188 |
$(".text-{{ text.key }}").addClass('hover'); |
|
189 |
}); |
|
190 |
$(".text-{{ text.key }}").mouseout(function(){ |
|
191 |
$(".text-actions-{{ text.key }}").css('visibility','hidden'); |
|
192 |
$(".text-{{ text.key }}").removeClass('hover'); |
|
193 |
}); |
|
194 |
}) ; |
|
195 |
--> |
|
196 |
</script> |
|
197 |
</td> |
|
198 |
<td>{% if text.user and can_manage_workspace %}<a title="{% blocktrans %}Edit user{% endblocktrans %}" href="{% url user-edit text.user.get_profile.key %}">{{ text.get_name }}</a> |
|
199 |
{% else %} |
|
200 |
{{ text.get_name }} |
|
201 |
{% endif %} |
|
202 |
</td> |
|
203 |
<td>{{ text.modified|local_date }}</td> |
|
204 |
<td>{{ text|nb_comments:request }}</td> |
|
205 |
{% if can_manage_workspace %} |
|
206 |
<td><span id="ticker-{{ text.key }}">{% blocktrans %}Loading...{% endblocktrans %}</span> |
|
207 |
<script type="text/javascript"> |
|
208 |
$(function() { |
|
209 |
$('#ticker-{{ text.key }}').sparkline({% activity text all '1/4day' 28 'all' '' %}, {'width': '100px','height': '22px'}); |
|
210 |
}); |
|
211 |
</script> |
|
212 |
</td> |
|
213 |
{% endif %} |
|
214 |
</tr> |
|
215 |
{% endfor %} |
|
216 |
</tbody> |
|
217 |
</table> |
|
218 |
||
219 |
</form> |
|
220 |
{% else %} |
|
221 |
{% blocktrans %}No texts yet{% endblocktrans %} |
|
222 |
{% endif %} |
|
223 |
</div> |
|
224 |
||
225 |
{% endblock %} |