| author | gibus |
| Tue, 11 Feb 2014 12:33:25 +0100 | |
| changeset 572 | 93383e54e042 |
| parent 565 | 95a5c06c4008 |
| child 631 | 150db5b6711d |
| 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> |
|
| 237 | 40 |
<li><a href="{% url text-create-content %}">{% blocktrans %}Create a text{% endblocktrans %}</a></li> |
| 0 | 41 |
<li> / </li> |
42 |
<li><a href="{% url text-create-upload %}">{% blocktrans %}Upload a text{% endblocktrans %}</a></li> |
|
|
460
2fdb7d095d5c
Added import from XML file, including text, comments and attachments.
gibus
parents:
439
diff
changeset
|
43 |
<li> / </li> |
|
2fdb7d095d5c
Added import from XML file, including text, comments and attachments.
gibus
parents:
439
diff
changeset
|
44 |
<li><a href="{% url text-create-import %}">{% blocktrans %}Import a co-mented text{% endblocktrans %}</a></li> |
| 0 | 45 |
{% endif %} |
46 |
</ul> |
|
47 |
||
| 315 | 48 |
{% if tag_list %} |
| 38 | 49 |
<form id="filter_form" action="." method="get"> |
| 315 | 50 |
<table class="large_table"> |
| 38 | 51 |
<tr> |
52 |
<td> |
|
53 |
{% blocktrans %}Filter by tag:{% endblocktrans %} |
|
54 |
<select id="tag_selected" name="tag_selected"> |
|
55 |
<option {% if not tag_selected %}selected="selected"{% endif %} value="0">- {% blocktrans %}All{% endblocktrans %} -</option> |
|
56 |
||
57 |
{% for tag in tag_list %} |
|
58 |
<option {% ifequal tag_selected tag.name %}selected="selected"{% endifequal %} value="{{ tag.name }}">{{ tag.name }}</option> |
|
59 |
{% endfor %} |
|
60 |
</select> |
|
61 |
</td> |
|
62 |
||
63 |
</tr> |
|
64 |
</table> |
|
65 |
</form> |
|
| 315 | 66 |
{% endif %} |
| 38 | 67 |
|
68 |
<script type="text/javascript"> |
|
69 |
<!-- |
|
70 |
$(function() { |
|
71 |
$("#tag_selected").change(function () { |
|
72 |
$("#filter_form").submit(); |
|
73 |
}); |
|
74 |
}) ; |
|
75 |
--> |
|
76 |
</script> |
|
77 |
||
| 0 | 78 |
{% if object_list %} |
|
439
8994d24e4b2f
Reverts to changeset 435, and just add {% csrf_token %} to template forgot_pw.html, since CSRF protection seems to be only here (surely because of django.contrib.auth.views).
gibus
parents:
438
diff
changeset
|
79 |
<form id="texts_form" action="." method="post"> |
| 0 | 80 |
|
81 |
{% if can_manage_workspace %} |
|
82 |
<select id="bulk_actions" name="action"> |
|
83 |
<option selected="selected" value="-1">{% blocktrans %}Bulk Actions{% endblocktrans %}</option> |
|
84 |
<option value="delete">{% blocktrans %}Delete{% endblocktrans %}</option> |
|
85 |
</select> |
|
86 |
||
87 |
<input name="apply" id="apply" type="button" value="{% blocktrans %}Apply{% endblocktrans %}" disabled="disabled"/> |
|
88 |
||
89 |
<script type="text/javascript"> |
|
90 |
<!-- |
|
91 |
function check_activate_apply() { |
|
92 |
if (($("input[name^=check-]:checked").length > 0) && ($("#bulk_actions").val() != -1)) { |
|
|
565
95a5c06c4008
With JQuery > 1.6 replace .attr() by .prop() or .val(), see http://api.jquery.com/prop/
gibus
parents:
460
diff
changeset
|
93 |
$('#apply').prop('disabled',false); |
| 0 | 94 |
} |
95 |
else { |
|
|
565
95a5c06c4008
With JQuery > 1.6 replace .attr() by .prop() or .val(), see http://api.jquery.com/prop/
gibus
parents:
460
diff
changeset
|
96 |
$('#apply').prop('disabled',true); |
| 0 | 97 |
} |
98 |
}; |
|
99 |
||
100 |
$(function() { |
|
101 |
$("input[name^=check-]").click(function () { |
|
102 |
check_activate_apply(); |
|
103 |
}); |
|
104 |
$("#bulk_actions").change(function () { |
|
105 |
check_activate_apply(); |
|
106 |
}); |
|
107 |
$("#apply").click(function () { |
|
108 |
question = "{% blocktrans %}Are you sure?{% endblocktrans %}"; |
|
109 |
if (confirm(question)) { |
|
110 |
$("#texts_form").submit(); |
|
111 |
} |
|
112 |
}); |
|
113 |
}) ; |
|
114 |
--> |
|
115 |
</script> |
|
116 |
{% endif %} |
|
117 |
||
118 |
{% include "site/macros/paginator.html" %} |
|
119 |
||
120 |
<div style="clear:both;"></div> |
|
121 |
||
122 |
<table summary="text list" class="large_table"> |
|
123 |
<thead> |
|
124 |
<tr> |
|
125 |
{% if can_manage_workspace %} |
|
126 |
<th class="check-column"><input type="checkbox" id="all_check" name="checkall"/> |
|
127 |
<script type="text/javascript"> |
|
128 |
<!-- |
|
129 |
$(function() { |
|
130 |
$("#all_check").click(function () { |
|
|
565
95a5c06c4008
With JQuery > 1.6 replace .attr() by .prop() or .val(), see http://api.jquery.com/prop/
gibus
parents:
460
diff
changeset
|
131 |
checked = $("#all_check").prop('checked'); |
|
95a5c06c4008
With JQuery > 1.6 replace .attr() by .prop() or .val(), see http://api.jquery.com/prop/
gibus
parents:
460
diff
changeset
|
132 |
$(".text_check").prop('checked', checked); |
| 0 | 133 |
check_activate_apply(); |
134 |
}); |
|
135 |
}) ; |
|
136 |
--> |
|
137 |
</script> |
|
138 |
</th> |
|
139 |
{% endif %} |
|
140 |
<th>{% up_down title %}{% blocktrans %}Text{% endblocktrans %}{% endup_down %}</th> |
|
141 |
<th>{% blocktrans %}Author{% endblocktrans %}</th> |
|
|
121
fafac127deb4
change default sorting for dates columns in text/user lists
raph
parents:
79
diff
changeset
|
142 |
<th>{% up_down -modified %}{% blocktrans %}Modified{% endblocktrans %}{% endup_down %}</th> |
| 147 | 143 |
<th>{% blocktrans %}# comments{% endblocktrans %}</th> |
| 0 | 144 |
{% if can_manage_workspace %}<th>{% blocktrans %}Last week activity{% endblocktrans %}</th>{% endif %} |
145 |
</tr> |
|
146 |
</thead> |
|
147 |
<tbody> |
|
148 |
{% for text in object_list %} |
|
149 |
||
150 |
{% get_local_text_perm request text can_edit_text as can_edit_text %} |
|
151 |
{% get_local_text_perm request text can_delete_text as can_delete_text %} |
|
152 |
{% get_local_text_perm request text can_manage_text as can_manage_text %} |
|
153 |
||
154 |
<tr class="text-{{ text.key }} {% cycle 'odd' 'even' %}"> |
|
155 |
{% if can_manage_workspace %}<td><input type="checkbox" class="text_check" name="check-{{ text.key }}"/></td>{% endif %} |
|
156 |
<td> |
|
157 |
<a class="main_object_title" href="{% url text-view text.key %}">{{ text.title }}</a> |
|
| 38 | 158 |
|
159 |
{% tags_for_object text.last_text_version as tag_list %} |
|
160 |
{% 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 %} |
|
161 |
||
| 0 | 162 |
<div class="hidden-text-actions text-actions-{{ text.key }}"> |
| 79 | 163 |
<a href="{% url text-view text.key %}">{% blocktrans %}View{% endblocktrans %}</a> |
164 |
{% if can_edit_text %} | <a href="{% url text-edit text.key %}">{% blocktrans %}Edit{% endblocktrans %}</a> | {% endif %} |
|
| 0 | 165 |
{% if can_delete_text %}<a id="text-delete-{{ text.key }}" href="#">{% blocktrans %}Delete{% endblocktrans %}</a> | |
166 |
<script type="text/javascript"> |
|
167 |
<!-- |
|
168 |
$(function() { |
|
169 |
$("#text-delete-{{ text.key }}").click(function(){ |
|
170 |
url = '{% url text-delete text.key %}'; |
|
171 |
question = "{% blocktrans %}Are you sure you want to delete this text?{% endblocktrans %}"; |
|
172 |
if (confirm(question)) { |
|
173 |
$.post(url, function(data){ |
|
| 193 | 174 |
window.location = '{% url text %}'; |
| 0 | 175 |
}); |
176 |
} |
|
177 |
}); |
|
178 |
|
|
179 |
}) ; |
|
180 |
--> |
|
181 |
</script> |
|
182 |
||
183 |
{% endif %} |
|
184 |
{% if can_manage_text %}<a href="{% url text-share text.key %}">{% blocktrans %}Users{% endblocktrans %}</a> | {% endif %} |
|
185 |
{% if can_manage_text %}<a href="{% url text-settings text.key %}">{% blocktrans %}Settings{% endblocktrans %}</a>{% endif %} |
|
186 |
</div> |
|
187 |
<script type="text/javascript"> |
|
188 |
<!-- |
|
189 |
$(function() { |
|
190 |
$(".text-{{ text.key }}").mouseover(function(){ |
|
191 |
$(".text-actions-{{ text.key }}").css('visibility','visible'); |
|
192 |
$(".text-{{ text.key }}").addClass('hover'); |
|
193 |
}); |
|
194 |
$(".text-{{ text.key }}").mouseout(function(){ |
|
195 |
$(".text-actions-{{ text.key }}").css('visibility','hidden'); |
|
196 |
$(".text-{{ text.key }}").removeClass('hover'); |
|
197 |
}); |
|
198 |
}) ; |
|
199 |
--> |
|
200 |
</script> |
|
201 |
</td> |
|
202 |
<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> |
|
203 |
{% else %} |
|
204 |
{{ text.get_name }} |
|
205 |
{% endif %} |
|
206 |
</td> |
|
207 |
<td>{{ text.modified|local_date }}</td> |
|
208 |
<td>{{ text|nb_comments:request }}</td> |
|
209 |
{% if can_manage_workspace %} |
|
210 |
<td><span id="ticker-{{ text.key }}">{% blocktrans %}Loading...{% endblocktrans %}</span> |
|
211 |
<script type="text/javascript"> |
|
212 |
$(function() { |
|
213 |
$('#ticker-{{ text.key }}').sparkline({% activity text all '1/4day' 28 'all' '' %}, {'width': '100px','height': '22px'}); |
|
214 |
}); |
|
215 |
</script> |
|
216 |
</td> |
|
217 |
{% endif %} |
|
218 |
</tr> |
|
219 |
{% endfor %} |
|
220 |
</tbody> |
|
221 |
</table> |
|
222 |
||
223 |
</form> |
|
224 |
{% else %} |
|
225 |
{% blocktrans %}No texts yet{% endblocktrans %} |
|
226 |
{% endif %} |
|
227 |
</div> |
|
228 |
||
|
438
fcc5e2f0befd
Fix side effects with csrf token, add csrf_token to every post form + add ajax (see http://stackoverflow.com/questions/5100539/django-csrf-check-failing-with-an-ajax-post-request), remove django.middleware.csrf.CsrfViewMiddleware ?!
Production Moz <dev@sopinspace.com>
parents:
315
diff
changeset
|
229 |
{% endblock %} |