##// END OF EJS Templates
Moved moderation panel completely to javascript, which will use one menu for all posts instead of a new one for each loaded
neko259 -
r2039:d7fe8128 default
parent child Browse files
Show More
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -338,14 +338,6 b' msgstr "\xd0\x9e\xd1\x82\xd0\xb2\xd0\xb5\xd1\x82\xd0\xb8\xd1\x82\xd1\x8c"'
338 msgid " in "
338 msgid " in "
339 msgstr " Π² "
339 msgstr " Π² "
340
340
341 #: templates/boards/post.html:51
342 msgid "Edit"
343 msgstr "Π˜Π·ΠΌΠ΅Π½ΠΈΡ‚ΡŒ"
344
345 #: templates/boards/post.html:53
346 msgid "Edit thread"
347 msgstr "Π˜Π·ΠΌΠ΅Π½ΠΈΡ‚ΡŒ Ρ‚Π΅ΠΌΡƒ"
348
349 #: templates/boards/post.html:91
341 #: templates/boards/post.html:91
350 msgid "Replies"
342 msgid "Replies"
351 msgstr "ΠžΡ‚Π²Π΅Ρ‚Ρ‹"
343 msgstr "ΠžΡ‚Π²Π΅Ρ‚Ρ‹"
@@ -535,12 +527,6 b' msgstr "\xd0\xb8\xd0\xbd\xd1\x82\xd0\xb5\xd1\x80\xd0\xb5\xd1\x81\xd0\xbd\xd0\xbe\xd0\xb5"'
535 msgid "images"
527 msgid "images"
536 msgstr "изобраТСния"
528 msgstr "изобраТСния"
537
529
538 msgid "Delete post"
539 msgstr "Π£Π΄Π°Π»ΠΈΡ‚ΡŒ пост"
540
541 msgid "Delete thread"
542 msgstr "Π£Π΄Π°Π»ΠΈΡ‚ΡŒ Ρ‚Π΅ΠΌΡƒ"
543
544 msgid "Messages per day/week/month:"
530 msgid "Messages per day/week/month:"
545 msgstr "Π‘ΠΎΠΎΠ±Ρ‰Π΅Π½ΠΈΠΉ Π·Π° дСнь/нСдСлю/мСсяц:"
531 msgstr "Π‘ΠΎΠΎΠ±Ρ‰Π΅Π½ΠΈΠΉ Π·Π° дСнь/нСдСлю/мСсяц:"
546
532
@@ -578,15 +564,6 b' msgstr "\xd0\x9d\xd0\xb5\xd0\xba\xd0\xbe\xd1\x82\xd0\xbe\xd1\x80\xd1\x8b\xd0\xb5 \xd1\x84\xd0\xb0\xd0\xb9\xd0\xbb\xd1\x8b \xd1\x83\xd0\xb6\xd0\xb5 \xd0\xbf\xd1\x80\xd0\xb8\xd1\x81\xd1\x83\xd1\x82\xd1\x81\xd1\x82\xd0\xb2\xd1\x83\xd1\x8e\xd1\x82 \xd0\xbd\xd0\xb0 \xd0\xb1\xd0\xbe\xd1\x80\xd0\xb4\xd0\xb5."'
578 msgid "Do not download URLs"
564 msgid "Do not download URLs"
579 msgstr "НС Π·Π°Π³Ρ€ΡƒΠΆΠ°Ρ‚ΡŒ ссылки"
565 msgstr "НС Π·Π°Π³Ρ€ΡƒΠΆΠ°Ρ‚ΡŒ ссылки"
580
566
581 msgid "Ban and delete"
582 msgstr "Π—Π°Π±Π°Π½ΠΈΡ‚ΡŒ ΠΈ ΡƒΠ΄Π°Π»ΠΈΡ‚ΡŒ"
583
584 msgid "Are you sure?"
585 msgstr "Π’Ρ‹ ΡƒΠ²Π΅Ρ€Π΅Π½Ρ‹?"
586
587 msgid "Ban"
588 msgstr "Π—Π°Π±Π°Π½ΠΈΡ‚ΡŒ"
589
590 msgid "File process mode"
567 msgid "File process mode"
591 msgstr "Π Π΅ΠΆΠΈΠΌ ΠΎΠ±Ρ€Π°Π±ΠΎΡ‚ΠΊΠΈ Ρ„Π°ΠΉΠ»ΠΎΠ²"
568 msgstr "Π Π΅ΠΆΠΈΠΌ ΠΎΠ±Ρ€Π°Π±ΠΎΡ‚ΠΊΠΈ Ρ„Π°ΠΉΠ»ΠΎΠ²"
592
569
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -67,3 +67,24 b' msgstr "\xd0\x92\xd0\xb2\xd0\xb5\xd0\xb4\xd0\xb8\xd1\x82\xd0\xb5 \xd0\xbd\xd0\xb0\xd0\xb7\xd0\xb2\xd0\xb0\xd0\xbd\xd0\xb8\xd0\xb5 \xd1\x81\xd1\x82\xd0\xb8\xd0\xba\xd0\xb5\xd1\x80\xd0\xb0"'
67
67
68 msgid "Images posted: "
68 msgid "Images posted: "
69 msgstr "ВставлСнных ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠΉ: "
69 msgstr "ВставлСнных ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠΉ: "
70
71 msgid "Ban and delete"
72 msgstr "Π—Π°Π±Π°Π½ΠΈΡ‚ΡŒ ΠΈ ΡƒΠ΄Π°Π»ΠΈΡ‚ΡŒ"
73
74 msgid "Are you sure?"
75 msgstr "Π’Ρ‹ ΡƒΠ²Π΅Ρ€Π΅Π½Ρ‹?"
76
77 msgid "Ban"
78 msgstr "Π—Π°Π±Π°Π½ΠΈΡ‚ΡŒ"
79
80 msgid "Delete post"
81 msgstr "Π£Π΄Π°Π»ΠΈΡ‚ΡŒ пост"
82
83 msgid "Delete thread"
84 msgstr "Π£Π΄Π°Π»ΠΈΡ‚ΡŒ Ρ‚Π΅ΠΌΡƒ"
85
86 msgid "Edit"
87 msgstr "Π˜Π·ΠΌΠ΅Π½ΠΈΡ‚ΡŒ"
88
89 msgid "Edit thread"
90 msgstr "Π˜Π·ΠΌΠ΅Π½ΠΈΡ‚ΡŒ Ρ‚Π΅ΠΌΡƒ"
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -338,14 +338,6 b' msgstr "\xd0\x92\xd1\x96\xd0\xb4\xd0\xbf\xd0\xbe\xd0\xb2\xd1\x96\xd1\x81\xd1\x82\xd0\xb8"'
338 msgid " in "
338 msgid " in "
339 msgstr " Ρƒ "
339 msgstr " Ρƒ "
340
340
341 #: templates/boards/post.html:51
342 msgid "Edit"
343 msgstr "Π—ΠΌΡ–Π½ΠΈΡ‚ΠΈ"
344
345 #: templates/boards/post.html:53
346 msgid "Edit thread"
347 msgstr "Π—ΠΌΡ–Π½ΠΈΡ‚ΠΈ Π½ΠΈΡ‚ΠΊΡƒ"
348
349 #: templates/boards/post.html:91
341 #: templates/boards/post.html:91
350 msgid "Replies"
342 msgid "Replies"
351 msgstr "Π’Ρ–Π΄ΠΏΠΎΠ²Ρ–Π΄Ρ–"
343 msgstr "Π’Ρ–Π΄ΠΏΠΎΠ²Ρ–Π΄Ρ–"
@@ -535,12 +527,6 b' msgstr "\xd1\x86\xd1\x96\xd0\xba\xd0\xb0\xd0\xb2\xd0\xb5"'
535 msgid "images"
527 msgid "images"
536 msgstr "ΠΏΡ–Ρ‡ΠΊΡƒΡ€ΠΈ"
528 msgstr "ΠΏΡ–Ρ‡ΠΊΡƒΡ€ΠΈ"
537
529
538 msgid "Delete post"
539 msgstr "Π’ΠΈΠ΄Π°Π»ΠΈΡ‚ΠΈ повідомлСння"
540
541 msgid "Delete thread"
542 msgstr "Π’ΠΈΡ€Π²Π°Ρ‚ΠΈ Π½ΠΈΡ‚ΠΊΡƒ"
543
544 msgid "Messages per day/week/month:"
530 msgid "Messages per day/week/month:"
545 msgstr "ΠŸΠΎΠ²Ρ–Π΄ΠΎΠΌΠ»Π΅Π½ΡŒ Π·Π° дСнь/Ρ‚ΠΈΠΆΠ΄Π΅Π½ΡŒ/Ρ‚ΠΈΠΆΠΌΡ–ΡΡΡ†ΡŒ:"
531 msgstr "ΠŸΠΎΠ²Ρ–Π΄ΠΎΠΌΠ»Π΅Π½ΡŒ Π·Π° дСнь/Ρ‚ΠΈΠΆΠ΄Π΅Π½ΡŒ/Ρ‚ΠΈΠΆΠΌΡ–ΡΡΡ†ΡŒ:"
546
532
@@ -578,15 +564,6 b' msgstr "\xd0\x94\xd0\xb5\xd1\x8f\xd0\xba\xd1\x96 \xd1\x84\xd0\xb0\xd0\xb9\xd0\xbb\xd0\xb8 \xd0\xb2\xd0\xb6\xd0\xb5 \xd1\x94 \xd0\xbd\xd0\xb0 \xd0\xb4\xd0\xbe\xd1\x88\xd1\x86\xd1\x96."'
578 msgid "Do not download URLs"
564 msgid "Do not download URLs"
579 msgstr "НС Π·Π°Π²Π°Π½Ρ‚Π°ΠΆΡƒΠ²Π°Ρ‚ΠΈ посилання"
565 msgstr "НС Π·Π°Π²Π°Π½Ρ‚Π°ΠΆΡƒΠ²Π°Ρ‚ΠΈ посилання"
580
566
581 msgid "Ban and delete"
582 msgstr "Π—Π°Π±Π»ΠΎΠΊΡƒΠ²Π°Ρ‚ΠΈ ΠΉ Π²ΠΈΠ΄Π°Π»ΠΈΡ‚ΠΈ"
583
584 msgid "Are you sure?"
585 msgstr "Π§ΠΈ Π²ΠΈ ΠΏΠ΅Π²Π½Ρ–?"
586
587 msgid "Ban"
588 msgstr "Π—Π°Π±Π»ΠΎΠΊΡƒΠ²Π°Ρ‚ΠΈ"
589
590 msgid "File process mode"
567 msgid "File process mode"
591 msgstr "Π Π΅ΠΆΠΈΠΌ ΠΎΠ±Ρ€ΠΎΠ±ΠΊΠΈ Ρ„Π°ΠΉΠ»Ρ–Π²"
568 msgstr "Π Π΅ΠΆΠΈΠΌ ΠΎΠ±Ρ€ΠΎΠ±ΠΊΠΈ Ρ„Π°ΠΉΠ»Ρ–Π²"
592
569
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -67,3 +67,24 b' msgstr "\xd0\x92\xd0\xb2\xd0\xb5\xd0\xb4\xd1\x96\xd1\x82\xd1\x8c \xd0\xbd\xd0\xb0\xd0\xb7\xd0\xb2\xd1\x83 \xd1\x81\xd1\x82\xd1\x96\xd0\xba\xd0\xb5\xd1\x80\xd0\xb0"'
67
67
68 msgid "Images posted: "
68 msgid "Images posted: "
69 msgstr "ВставлСних Π·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΡŒ: "
69 msgstr "ВставлСних Π·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΡŒ: "
70
71 msgid "Ban and delete"
72 msgstr "Π—Π°Π±Π»ΠΎΠΊΡƒΠ²Π°Ρ‚ΠΈ ΠΉ Π²ΠΈΠ΄Π°Π»ΠΈΡ‚ΠΈ"
73
74 msgid "Are you sure?"
75 msgstr "Π§ΠΈ Π²ΠΈ ΠΏΠ΅Π²Π½Ρ–?"
76
77 msgid "Ban"
78 msgstr "Π—Π°Π±Π»ΠΎΠΊΡƒΠ²Π°Ρ‚ΠΈ"
79
80 msgid "Delete post"
81 msgstr "Π’ΠΈΠ΄Π°Π»ΠΈΡ‚ΠΈ повідомлСння"
82
83 msgid "Delete thread"
84 msgstr "Π’ΠΈΡ€Π²Π°Ρ‚ΠΈ Π½ΠΈΡ‚ΠΊΡƒ"
85
86 msgid "Edit"
87 msgstr "Π—ΠΌΡ–Π½ΠΈΡ‚ΠΈ"
88
89 msgid "Edit thread"
90 msgstr "Π—ΠΌΡ–Π½ΠΈΡ‚ΠΈ Π½ΠΈΡ‚ΠΊΡƒ"
@@ -362,3 +362,5 b' class Post(models.Model, Viewable):'
362 def has_ip(self):
362 def has_ip(self):
363 return self.poster_ip != NO_IP
363 return self.poster_ip != NO_IP
364
364
365 def has_global_id(self):
366 return self.global_id_id is not None
@@ -203,6 +203,93 b' function addContextMenu() {'
203 };
203 };
204 }
204 }
205 });
205 });
206
207 $.contextMenu({
208 selector: '.post .moderation-menu',
209 trigger: 'left',
210 build: function($trigger, e) {
211 var canEditPost = PERMS['change_post'];
212 var canDeletePost = PERMS['delete_post'];
213 var canEditThread = PERMS['change_thread'];
214 var canDeleteThread = PERMS['delete_thread'];
215
216 var post = $trigger.parents('.post');
217
218 var isOpening = post.data('opening') === 'True';
219 var threadId = post.data('thread-id');
220 var hasGlobalId = post.data('has-global-id') === 'True';
221
222 var posterIp = $trigger.siblings('.pub_time').attr('title');
223 var hasIp = posterIp != null;
224
225 var postId = post.attr('id');
226
227 return {
228 items: {
229 edit: {
230 name: gettext('Edit'),
231 callback: function(key, opt) {
232 window.location = '/admin/boards/post/' + postId + '/change/';
233 },
234 visible: canEditPost
235 },
236 deletePost: {
237 name: gettext('Delete post'),
238 callback: function(key, opt) {
239 window.location = '/admin/boards/post/' + postId + '/delete/';
240 },
241 visible: !isOpening && canDeletePost
242 },
243 editThread: {
244 name: gettext('Edit thread'),
245 callback: function(key, opt) {
246 window.location = '/admin/boards/thread/' + threadId + '/change/';
247 },
248 visible: isOpening && canEditThread
249 },
250 deleteThread: {
251 name: gettext('Delete thread'),
252 callback: function(key, opt) {
253 window.location = '/admin/boards/thread/' + threadId + '/delete/';
254 },
255 visible: isOpening && canDeleteThread
256 },
257 findByIp: {
258 name: 'IP = ' + posterIp,
259 callback: function(key, opt) {
260 window.location = '/feed/?ip=' + posterIp;
261 },
262 visible: hasIp
263 },
264 raw: {
265 name: 'RAW',
266 callback: function(key, opt) {
267 window.location = '/post_xml/' + postId;
268 },
269 visible: hasGlobalId
270 },
271 ban: {
272 name: gettext('Ban'),
273 callback: function(key, opt) {
274 if (confirm(gettext('Are you sure?'))) {
275 window.location = '/utils?method=ban&post_id=' + postId;
276 }
277 },
278 visible: hasIp
279 },
280 banAndDelete: {
281 name: gettext('Ban and delete'),
282 callback: function(key, opt) {
283 if (confirm(gettext('Are you sure?'))) {
284 window.location = '/utils?method=ban_and_delete&post_id=' + postId;
285 }
286 },
287 visible: hasIp && canDeletePost
288 }
289 }
290 };
291 }
292 });
206 }
293 }
207
294
208 $( document ).ready(function() {
295 $( document ).ready(function() {
@@ -4,7 +4,12 b''
4 {% get_current_language as LANGUAGE_CODE %}
4 {% get_current_language as LANGUAGE_CODE %}
5
5
6 {% autoescape off %}
6 {% autoescape off %}
7 <div class="{{ css_class }}" id="{{ post.id }}" data-uid="{{ post.uid }}" {% if tree_depth %}style="margin-left: {{ tree_depth }}em;"{% endif %}>
7 <div class="{{ css_class }}" id="{{ post.id }}"
8 data-uid="{{ post.uid }}"
9 data-has-global-id="{{ post.has_global_id }}"
10 data-thread-id="{{ thread.id }}"
11 data-opening="{{ is_opening }}"
12 {% if tree_depth %}style="margin-left: {{ tree_depth }}em;"{% endif %}>
8 <div class="post-info">
13 <div class="post-info">
9 <a class="post_id" href="{{ post.get_absolute_url }}">#{{ post.id }}</a>
14 <a class="post_id" href="{{ post.get_absolute_url }}">#{{ post.id }}</a>
10 {% if is_opening %}
15 {% if is_opening %}
@@ -53,86 +58,6 b''
53
58
54 {% if perms.boards.change_post or perms.boards.delete_post or perms.boards.change_thread or perms_boards.delete_thread %}
59 {% if perms.boards.change_post or perms.boards.delete_post or perms.boards.change_thread or perms_boards.delete_thread %}
55 <a class="moderation-menu" href="#">πŸ”’</a>
60 <a class="moderation-menu" href="#">πŸ”’</a>
56 <script>
57 $.contextMenu({
58 selector: '#{{ post.id }} .moderation-menu',
59 trigger: 'left',
60 build: function($trigger, e) {
61 var canEditPost = PERMS['change_post'];
62 var canDeletePost = PERMS['delete_post'];
63 var canEditThread = PERMS['change_thread'];
64 var canDeleteThread = PERMS['delete_thread'];
65
66 var isOpening = '{{ is_opening }}' === 'True';
67 var hasIp = '{{ post.has_ip }}' === 'True';
68
69 return {
70 items: {
71 edit: {
72 name: '{% trans "Edit" %}',
73 callback: function(key, opt) {
74 window.location = '{% url 'admin:boards_post_change' post.id %}';
75 },
76 visible: canEditPost
77 },
78 deletePost: {
79 name: '{% trans "Delete post" %}',
80 callback: function(key, opt) {
81 window.location = '{% url 'admin:boards_post_delete' post.id %}';
82 },
83 visible: !isOpening && canDeletePost
84 },
85 editThread: {
86 name: '{% trans "Edit thread" %}',
87 callback: function(key, opt) {
88 window.location = '{% url 'admin:boards_thread_change' thread.id %}';
89 },
90 visible: isOpening && canEditThread
91 },
92 deleteThread: {
93 name: '{% trans "Delete thread" %}',
94 callback: function(key, opt) {
95 window.location = '{% url 'admin:boards_thread_delete' thread.id %}';
96 },
97 visible: isOpening && canDeleteThread
98 },
99 findByIp: {
100 name: 'IP = {{ post.poster_ip }}',
101 callback: function(key, opt) {
102 window.location = '{% url "feed" %}?ip={{ post.poster_ip }}';
103 },
104 visible: hasIp
105 },
106 raw: {
107 name: 'RAW',
108 callback: function(key, opt) {
109 window.location = '{% url 'post_sync_data' post.id %}';
110 },
111 visible: {% if post.global_id_id %}true{% else %}false{% endif %}
112 },
113 ban: {
114 name: '{% trans "Ban" %}',
115 callback: function(key, opt) {
116 if (confirm('{% trans "Are you sure?" %}')) {
117 window.location = '{% url 'utils' %}?method=ban&post_id={{ post.id }}';
118 }
119 },
120 visible: hasIp
121 },
122 banAndDelete: {
123 name: '{% trans "Ban and delete" %}',
124 callback: function(key, opt) {
125 if (confirm('{% trans "Are you sure?" %}')) {
126 window.location = '{% url 'utils' %}?method=ban_and_delete&post_id={{ post.id }}';
127 }
128 },
129 visible: hasIp && canDeletePost
130 }
131 }
132 };
133 }
134 });
135 </script>
136 {% endif %}
61 {% endif %}
137 </div>
62 </div>
138 {% for file in post.attachments.all %}
63 {% for file in post.attachments.all %}
General Comments 0
You need to be logged in to leave comments. Login now