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