##// END OF EJS Templates
Don't query for body in moderation menu
neko259 -
r2037:2120750d default
parent child Browse files
Show More
@@ -1,175 +1,173
1 {% load i18n %}
1 {% load i18n %}
2 {% load board %}
2 {% load board %}
3
3
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 }}" data-uid="{{ post.uid }}" {% if tree_depth %}style="margin-left: {{ tree_depth }}em;"{% endif %}>
8 <div class="post-info">
8 <div class="post-info">
9 <a class="post_id" href="{{ post.get_absolute_url }}">#{{ post.id }}</a>
9 <a class="post_id" href="{{ post.get_absolute_url }}">#{{ post.id }}</a>
10 {% if is_opening %}
10 {% if is_opening %}
11 {% if thread.is_stickerpack %}
11 {% if thread.is_stickerpack %}
12 <span title="{% trans "Sticker Pack" %}">&#128247;</span>
12 <span title="{% trans "Sticker Pack" %}">&#128247;</span>
13 {% elif thread.is_monochrome %}
13 {% elif thread.is_monochrome %}
14 <span title="{% trans "Monochrome" %}">&#9775;</span>
14 <span title="{% trans "Monochrome" %}">&#9775;</span>
15 {% endif %}
15 {% endif %}
16 {% endif %}
16 {% endif %}
17 <span class="title">{{ post.title|escape }}</span>
17 <span class="title">{{ post.title|escape }}</span>
18 {% if perms.boards.change_post and post.has_ip %}
18 {% if perms.boards.change_post and post.has_ip %}
19 <span class="pub_time" style="border-bottom: solid 2px #{{ post.get_ip_color }};" title="{{ post.poster_ip }}">
19 <span class="pub_time" style="border-bottom: solid 2px #{{ post.get_ip_color }};" title="{{ post.poster_ip }}">
20 {% else %}
20 {% else %}
21 <span class="pub_time">
21 <span class="pub_time">
22 {% endif %}
22 {% endif %}
23 <time datetime="{{ post.pub_time|date:'c' }}">{{ post.pub_time }}</time></span>
23 <time datetime="{{ post.pub_time|date:'c' }}">{{ post.pub_time }}</time></span>
24 {% if post.tripcode %}
24 {% if post.tripcode %}
25 / {{ post.get_tripcode.get_view|safe }}
25 / {{ post.get_tripcode.get_view|safe }}
26 {% endif %}
26 {% endif %}
27 {% comment %}
27 {% comment %}
28 Thread death time needs to be shown only if the thread is alredy archived
28 Thread death time needs to be shown only if the thread is alredy archived
29 and this is an opening post (thread death time) or a post for popup
29 and this is an opening post (thread death time) or a post for popup
30 (we don't see OP here so we show the death time in the post itself).
30 (we don't see OP here so we show the death time in the post itself).
31 {% endcomment %}
31 {% endcomment %}
32 {% if is_opening and thread.is_archived %}
32 {% if is_opening and thread.is_archived %}
33 <time datetime="{{ thread.bump_time|date:'c' }}">{{ thread.bump_time }}</time>
33 <time datetime="{{ thread.bump_time|date:'c' }}">{{ thread.bump_time }}</time>
34 {% endif %}
34 {% endif %}
35 {% if is_opening %}
35 {% if is_opening %}
36 {% if need_open_link %}
36 {% if need_open_link %}
37 {% if thread.is_archived %}
37 {% if thread.is_archived %}
38 <a class="link" href="{% url 'thread' post.id %}">{% trans "Open" %}</a>
38 <a class="link" href="{% url 'thread' post.id %}">{% trans "Open" %}</a>
39 {% else %}
39 {% else %}
40 <a class="link" href="{% url 'thread' post.id %}#form">{% trans "Reply" %}</a>
40 <a class="link" href="{% url 'thread' post.id %}#form">{% trans "Reply" %}</a>
41 {% endif %}
41 {% endif %}
42 {% endif %}
42 {% endif %}
43 {% else %}
43 {% else %}
44 {% if need_op_data %}
44 {% if need_op_data %}
45 {% with thread.get_opening_post as op %}
45 {% with thread.get_opening_post as op %}
46 {% trans " in " %}{{ op.get_link_view|safe }} <span class="title">{{ op.get_title_or_text }}</span>
46 {% trans " in " %}{{ op.get_link_view|safe }} <span class="title">{{ op.get_title_or_text }}</span>
47 {% endwith %}
47 {% endwith %}
48 {% endif %}
48 {% endif %}
49 {% endif %}
49 {% endif %}
50 {% if reply_link and not thread.is_archived %}
50 {% if reply_link and not thread.is_archived %}
51 <a href="#form" onclick="addQuickReply('{{ post.id }}'); return false;">{% trans 'Reply' %}</a>
51 <a href="#form" onclick="addQuickReply('{{ post.id }}'); return false;">{% trans 'Reply' %}</a>
52 {% endif %}
52 {% endif %}
53
53
54 {% if perms.boards.change_post or perms.boards.delete_post or perms.boards.change_thread or perms_boards.delete_thread %}
54 {% 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>
55 <a class="moderation-menu" href="#">🔒</a>
56 <script>
56 <script>
57 $.contextMenu({
57 $.contextMenu({
58 selector: '#{{ post.id }} .moderation-menu',
58 selector: '#{{ post.id }} .moderation-menu',
59 trigger: 'left',
59 trigger: 'left',
60 build: function($trigger, e) {
60 build: function($trigger, e) {
61 var body = $('body');
62
63 var canEditPost = PERMS['change_post'];
61 var canEditPost = PERMS['change_post'];
64 var canDeletePost = PERMS['delete_post'];
62 var canDeletePost = PERMS['delete_post'];
65 var canEditThread = PERMS['change_thread'];
63 var canEditThread = PERMS['change_thread'];
66 var canDeleteThread = PERMS['delete_thread'];
64 var canDeleteThread = PERMS['delete_thread'];
67
65
68 var isOpening = '{{ is_opening }}' === 'True';
66 var isOpening = '{{ is_opening }}' === 'True';
69 var hasIp = '{{ post.has_ip }}' === 'True';
67 var hasIp = '{{ post.has_ip }}' === 'True';
70
68
71 return {
69 return {
72 items: {
70 items: {
73 edit: {
71 edit: {
74 name: '{% trans "Edit" %}',
72 name: '{% trans "Edit" %}',
75 callback: function(key, opt) {
73 callback: function(key, opt) {
76 window.location = '{% url 'admin:boards_post_change' post.id %}';
74 window.location = '{% url 'admin:boards_post_change' post.id %}';
77 },
75 },
78 visible: canEditPost
76 visible: canEditPost
79 },
77 },
80 deletePost: {
78 deletePost: {
81 name: '{% trans "Delete post" %}',
79 name: '{% trans "Delete post" %}',
82 callback: function(key, opt) {
80 callback: function(key, opt) {
83 window.location = '{% url 'admin:boards_post_delete' post.id %}';
81 window.location = '{% url 'admin:boards_post_delete' post.id %}';
84 },
82 },
85 visible: !isOpening && canDeletePost
83 visible: !isOpening && canDeletePost
86 },
84 },
87 editThread: {
85 editThread: {
88 name: '{% trans "Edit thread" %}',
86 name: '{% trans "Edit thread" %}',
89 callback: function(key, opt) {
87 callback: function(key, opt) {
90 window.location = '{% url 'admin:boards_thread_change' thread.id %}';
88 window.location = '{% url 'admin:boards_thread_change' thread.id %}';
91 },
89 },
92 visible: isOpening && canEditThread
90 visible: isOpening && canEditThread
93 },
91 },
94 deleteThread: {
92 deleteThread: {
95 name: '{% trans "Delete thread" %}',
93 name: '{% trans "Delete thread" %}',
96 callback: function(key, opt) {
94 callback: function(key, opt) {
97 window.location = '{% url 'admin:boards_thread_delete' thread.id %}';
95 window.location = '{% url 'admin:boards_thread_delete' thread.id %}';
98 },
96 },
99 visible: isOpening && canDeleteThread
97 visible: isOpening && canDeleteThread
100 },
98 },
101 findByIp: {
99 findByIp: {
102 name: 'IP = {{ post.poster_ip }}',
100 name: 'IP = {{ post.poster_ip }}',
103 callback: function(key, opt) {
101 callback: function(key, opt) {
104 window.location = '{% url "feed" %}?ip={{ post.poster_ip }}';
102 window.location = '{% url "feed" %}?ip={{ post.poster_ip }}';
105 },
103 },
106 visible: hasIp
104 visible: hasIp
107 },
105 },
108 raw: {
106 raw: {
109 name: 'RAW',
107 name: 'RAW',
110 callback: function(key, opt) {
108 callback: function(key, opt) {
111 window.location = '{% url 'post_sync_data' post.id %}';
109 window.location = '{% url 'post_sync_data' post.id %}';
112 },
110 },
113 visible: {% if post.global_id_id %}true{% else %}false{% endif %}
111 visible: {% if post.global_id_id %}true{% else %}false{% endif %}
114 },
112 },
115 ban: {
113 ban: {
116 name: '{% trans "Ban" %}',
114 name: '{% trans "Ban" %}',
117 callback: function(key, opt) {
115 callback: function(key, opt) {
118 if (confirm('{% trans "Are you sure?" %}')) {
116 if (confirm('{% trans "Are you sure?" %}')) {
119 window.location = '{% url 'utils' %}?method=ban&post_id={{ post.id }}';
117 window.location = '{% url 'utils' %}?method=ban&post_id={{ post.id }}';
120 }
118 }
121 },
119 },
122 visible: hasIp
120 visible: hasIp
123 },
121 },
124 banAndDelete: {
122 banAndDelete: {
125 name: '{% trans "Ban and delete" %}',
123 name: '{% trans "Ban and delete" %}',
126 callback: function(key, opt) {
124 callback: function(key, opt) {
127 if (confirm('{% trans "Are you sure?" %}')) {
125 if (confirm('{% trans "Are you sure?" %}')) {
128 window.location = '{% url 'utils' %}?method=ban_and_delete&post_id={{ post.id }}';
126 window.location = '{% url 'utils' %}?method=ban_and_delete&post_id={{ post.id }}';
129 }
127 }
130 },
128 },
131 visible: hasIp && canDeletePost
129 visible: hasIp && canDeletePost
132 }
130 }
133 }
131 }
134 };
132 };
135 }
133 }
136 });
134 });
137 </script>
135 </script>
138 {% endif %}
136 {% endif %}
139 </div>
137 </div>
140 {% for file in post.attachments.all %}
138 {% for file in post.attachments.all %}
141 {{ file.get_view|safe }}
139 {{ file.get_view|safe }}
142 {% endfor %}
140 {% endfor %}
143 {% comment %}
141 {% comment %}
144 Post message (text)
142 Post message (text)
145 {% endcomment %}
143 {% endcomment %}
146 <div class="message">
144 <div class="message">
147 {% if truncated %}
145 {% if truncated %}
148 {{ post.get_text|truncatewords_html:50|truncatenewlines_html:3|safe }}
146 {{ post.get_text|truncatewords_html:50|truncatenewlines_html:3|safe }}
149 {% else %}
147 {% else %}
150 {{ post.get_text|safe }}
148 {{ post.get_text|safe }}
151 {% endif %}
149 {% endif %}
152 </div>
150 </div>
153 {% if post.is_referenced and not mode_tree %}
151 {% if post.is_referenced and not mode_tree %}
154 <div class="refmap">
152 <div class="refmap">
155 {% trans "Replies" %}: {{ post.refmap|safe }}
153 {% trans "Replies" %}: {{ post.refmap|safe }}
156 </div>
154 </div>
157 {% endif %}
155 {% endif %}
158 {% comment %}
156 {% comment %}
159 Thread metadata: counters, tags etc
157 Thread metadata: counters, tags etc
160 {% endcomment %}
158 {% endcomment %}
161 {% if is_opening %}
159 {% if is_opening %}
162 <div class="metadata">
160 <div class="metadata">
163 {% if need_open_link %}
161 {% if need_open_link %}
164 ♥ {{ thread.get_reply_count }}
162 ♥ {{ thread.get_reply_count }}
165 ❄ {{ thread.get_attachment_count }}
163 ❄ {{ thread.get_attachment_count }}
166 <a href="{% url 'thread_gallery' post.id %}">G</a>
164 <a href="{% url 'thread_gallery' post.id %}">G</a>
167 <a href="{% url 'thread_tree' post.id %}">T</a>
165 <a href="{% url 'thread_tree' post.id %}">T</a>
168 {% endif %}
166 {% endif %}
169 <span class="tags">
167 <span class="tags">
170 {{ thread.get_tag_url_list|safe }}
168 {{ thread.get_tag_url_list|safe }}
171 </span>
169 </span>
172 </div>
170 </div>
173 {% endif %}
171 {% endif %}
174 </div>
172 </div>
175 {% endautoescape %}
173 {% endautoescape %}
General Comments 0
You need to be logged in to leave comments. Login now