##// END OF EJS Templates
Don't show random image for tag that does not have images
neko259 -
r1266:0c448cb2 default
parent child Browse files
Show More
@@ -1,181 +1,183 b''
1 {% extends "boards/base.html" %}
1 {% extends "boards/base.html" %}
2
2
3 {% load i18n %}
3 {% load i18n %}
4 {% load board %}
4 {% load board %}
5 {% load static %}
5 {% load static %}
6 {% load tz %}
6 {% load tz %}
7
7
8 {% block head %}
8 {% block head %}
9 <meta name="robots" content="noindex">
9 <meta name="robots" content="noindex">
10
10
11 {% if tag %}
11 {% if tag %}
12 <title>{{ tag.name }} - {{ site_name }}</title>
12 <title>{{ tag.name }} - {{ site_name }}</title>
13 {% else %}
13 {% else %}
14 <title>{{ site_name }}</title>
14 <title>{{ site_name }}</title>
15 {% endif %}
15 {% endif %}
16
16
17 {% if prev_page_link %}
17 {% if prev_page_link %}
18 <link rel="prev" href="{{ prev_page_link }}" />
18 <link rel="prev" href="{{ prev_page_link }}" />
19 {% endif %}
19 {% endif %}
20 {% if next_page_link %}
20 {% if next_page_link %}
21 <link rel="next" href="{{ next_page_link }}" />
21 <link rel="next" href="{{ next_page_link }}" />
22 {% endif %}
22 {% endif %}
23
23
24 {% endblock %}
24 {% endblock %}
25
25
26 {% block content %}
26 {% block content %}
27
27
28 {% get_current_language as LANGUAGE_CODE %}
28 {% get_current_language as LANGUAGE_CODE %}
29 {% get_current_timezone as TIME_ZONE %}
29 {% get_current_timezone as TIME_ZONE %}
30
30
31 {% for banner in banners %}
31 {% for banner in banners %}
32 <div class="post">
32 <div class="post">
33 <div class="title">{{ banner.title }}</div>
33 <div class="title">{{ banner.title }}</div>
34 <div>{{ banner.text }}</div>
34 <div>{{ banner.text }}</div>
35 <div>{% trans 'Related message' %}: <a href="{{ banner.post.get_absolute_url }}">>>{{ banner.post.id }}</a></div>
35 <div>{% trans 'Related message' %}: <a href="{{ banner.post.get_absolute_url }}">>>{{ banner.post.id }}</a></div>
36 </div>
36 </div>
37 {% endfor %}
37 {% endfor %}
38
38
39 {% if tag %}
39 {% if tag %}
40 <div class="tag_info">
40 <div class="tag_info">
41 <div class="tag-image">
41 {% if random_image_post %}
42 {% with image=random_image_post.images.first %}
42 <div class="tag-image">
43 <a href="{{ random_image_post.get_absolute_url }}"><img
43 {% with image=random_image_post.images.first %}
44 src="{{ image.image.url_200x150 }}"
44 <a href="{{ random_image_post.get_absolute_url }}"><img
45 width="{{ image.pre_width }}"
45 src="{{ image.image.url_200x150 }}"
46 height="{{ image.pre_height }}"/></a>
46 width="{{ image.pre_width }}"
47 {% endwith %}
47 height="{{ image.pre_height }}"/></a>
48 </div>
48 {% endwith %}
49 </div>
50 {% endif %}
49 <div class="tag-text-data">
51 <div class="tag-text-data">
50 <h2>
52 <h2>
51 <form action="{% url 'tag' tag.name %}" method="post" class="post-button-form">
53 <form action="{% url 'tag' tag.name %}" method="post" class="post-button-form">
52 {% if is_favorite %}
54 {% if is_favorite %}
53 <button name="method" value="unsubscribe" class="fav"></button>
55 <button name="method" value="unsubscribe" class="fav"></button>
54 {% else %}
56 {% else %}
55 <button name="method" value="subscribe" class="not_fav"></button>
57 <button name="method" value="subscribe" class="not_fav"></button>
56 {% endif %}
58 {% endif %}
57 </form>
59 </form>
58 <form action="{% url 'tag' tag.name %}" method="post" class="post-button-form">
60 <form action="{% url 'tag' tag.name %}" method="post" class="post-button-form">
59 {% if is_hidden %}
61 {% if is_hidden %}
60 <button name="method" value="unhide" class="fav">H</button>
62 <button name="method" value="unhide" class="fav">H</button>
61 {% else %}
63 {% else %}
62 <button name="method" value="hide" class="not_fav">H</button>
64 <button name="method" value="hide" class="not_fav">H</button>
63 {% endif %}
65 {% endif %}
64 </form>
66 </form>
65 {% autoescape off %}
67 {% autoescape off %}
66 {{ tag.get_view }}
68 {{ tag.get_view }}
67 {% endautoescape %}
69 {% endautoescape %}
68 {% if moderator %}
70 {% if moderator %}
69 <span class="moderator_info">| <a href="{% url 'admin:boards_tag_change' tag.id %}">{% trans 'Edit tag' %}</a></span>
71 <span class="moderator_info">| <a href="{% url 'admin:boards_tag_change' tag.id %}">{% trans 'Edit tag' %}</a></span>
70 {% endif %}
72 {% endif %}
71 </h2>
73 </h2>
72 {% if tag.get_description %}
74 {% if tag.get_description %}
73 {% autoescape off %}
75 {% autoescape off %}
74 <p>{{ tag.get_description }}</p>
76 <p>{{ tag.get_description }}</p>
75 {% endautoescape %}
77 {% endautoescape %}
76 {% endif %}
78 {% endif %}
77 <p>{% blocktrans with active_thread_count=tag.get_active_thread_count thread_count=tag.get_thread_count post_count=tag.get_post_count %}This tag has {{ active_thread_count}}/{{ thread_count }} threads and {{ post_count }} posts.{% endblocktrans %}</p>
79 <p>{% blocktrans with active_thread_count=tag.get_active_thread_count thread_count=tag.get_thread_count post_count=tag.get_post_count %}This tag has {{ active_thread_count}}/{{ thread_count }} threads and {{ post_count }} posts.{% endblocktrans %}</p>
78 </div>
80 </div>
79 </div>
81 </div>
80 {% endif %}
82 {% endif %}
81
83
82 {% if threads %}
84 {% if threads %}
83 {% if prev_page_link %}
85 {% if prev_page_link %}
84 <div class="page_link">
86 <div class="page_link">
85 <a href="{{ prev_page_link }}">{% trans "Previous page" %}</a>
87 <a href="{{ prev_page_link }}">{% trans "Previous page" %}</a>
86 </div>
88 </div>
87 {% endif %}
89 {% endif %}
88
90
89 {% for thread in threads %}
91 {% for thread in threads %}
90 <div class="thread">
92 <div class="thread">
91 {% post_view thread.get_opening_post moderator=moderator is_opening=True thread=thread truncated=True need_open_link=True %}
93 {% post_view thread.get_opening_post moderator=moderator is_opening=True thread=thread truncated=True need_open_link=True %}
92 {% if not thread.archived %}
94 {% if not thread.archived %}
93 {% with last_replies=thread.get_last_replies %}
95 {% with last_replies=thread.get_last_replies %}
94 {% if last_replies %}
96 {% if last_replies %}
95 {% with skipped_replies_count=thread.get_skipped_replies_count %}
97 {% with skipped_replies_count=thread.get_skipped_replies_count %}
96 {% if skipped_replies_count %}
98 {% if skipped_replies_count %}
97 <div class="skipped_replies">
99 <div class="skipped_replies">
98 <a href="{% url 'thread' thread.get_opening_post_id %}">
100 <a href="{% url 'thread' thread.get_opening_post_id %}">
99 {% blocktrans with count=skipped_replies_count %}Skipped {{ count }} replies. Open thread to see all replies.{% endblocktrans %}
101 {% blocktrans with count=skipped_replies_count %}Skipped {{ count }} replies. Open thread to see all replies.{% endblocktrans %}
100 </a>
102 </a>
101 </div>
103 </div>
102 {% endif %}
104 {% endif %}
103 {% endwith %}
105 {% endwith %}
104 <div class="last-replies">
106 <div class="last-replies">
105 {% for post in last_replies %}
107 {% for post in last_replies %}
106 {% post_view post is_opening=False moderator=moderator truncated=True %}
108 {% post_view post is_opening=False moderator=moderator truncated=True %}
107 {% endfor %}
109 {% endfor %}
108 </div>
110 </div>
109 {% endif %}
111 {% endif %}
110 {% endwith %}
112 {% endwith %}
111 {% endif %}
113 {% endif %}
112 </div>
114 </div>
113 {% endfor %}
115 {% endfor %}
114
116
115 {% if next_page_link %}
117 {% if next_page_link %}
116 <div class="page_link">
118 <div class="page_link">
117 <a href="{{ next_page_link }}">{% trans "Next page" %}</a>
119 <a href="{{ next_page_link }}">{% trans "Next page" %}</a>
118 </div>
120 </div>
119 {% endif %}
121 {% endif %}
120 {% else %}
122 {% else %}
121 <div class="post">
123 <div class="post">
122 {% trans 'No threads exist. Create the first one!' %}</div>
124 {% trans 'No threads exist. Create the first one!' %}</div>
123 {% endif %}
125 {% endif %}
124
126
125 <div class="post-form-w">
127 <div class="post-form-w">
126 <script src="{% static 'js/panel.js' %}"></script>
128 <script src="{% static 'js/panel.js' %}"></script>
127 <div class="post-form">
129 <div class="post-form">
128 <div class="form-title">{% trans "Create new thread" %}</div>
130 <div class="form-title">{% trans "Create new thread" %}</div>
129 <div class="swappable-form-full">
131 <div class="swappable-form-full">
130 <form enctype="multipart/form-data" method="post" id="form">{% csrf_token %}
132 <form enctype="multipart/form-data" method="post" id="form">{% csrf_token %}
131 {{ form.as_div }}
133 {{ form.as_div }}
132 <div class="form-submit">
134 <div class="form-submit">
133 <input type="submit" value="{% trans "Post" %}"/>
135 <input type="submit" value="{% trans "Post" %}"/>
134 </div>
136 </div>
135 </form>
137 </form>
136 </div>
138 </div>
137 <div>
139 <div>
138 {% trans 'Tags must be delimited by spaces. Text or image is required.' %}
140 {% trans 'Tags must be delimited by spaces. Text or image is required.' %}
139 </div>
141 </div>
140 <div><button id="preview-button">{% trans 'Preview' %}</button></div>
142 <div><button id="preview-button">{% trans 'Preview' %}</button></div>
141 <div id="preview-text"></div>
143 <div id="preview-text"></div>
142 <div><a href="{% url "staticpage" name="help" %}">{% trans 'Text syntax' %}</a></div>
144 <div><a href="{% url "staticpage" name="help" %}">{% trans 'Text syntax' %}</a></div>
143 <div><a href="{% url "tags" "required" %}">{% trans 'Tags' %}</a></div>
145 <div><a href="{% url "tags" "required" %}">{% trans 'Tags' %}</a></div>
144 </div>
146 </div>
145 </div>
147 </div>
146
148
147 <script src="{% static 'js/form.js' %}"></script>
149 <script src="{% static 'js/form.js' %}"></script>
148 <script src="{% static 'js/thread_create.js' %}"></script>
150 <script src="{% static 'js/thread_create.js' %}"></script>
149
151
150 {% endblock %}
152 {% endblock %}
151
153
152 {% block metapanel %}
154 {% block metapanel %}
153
155
154 <span class="metapanel">
156 <span class="metapanel">
155 <b><a href="{% url "authors" %}">{{ site_name }}</a> {{ version }}</b>
157 <b><a href="{% url "authors" %}">{{ site_name }}</a> {{ version }}</b>
156 {% trans "Pages:" %}
158 {% trans "Pages:" %}
157 [
159 [
158 {% with dividers=paginator.get_dividers %}
160 {% with dividers=paginator.get_dividers %}
159 {% for page in paginator.get_divided_range %}
161 {% for page in paginator.get_divided_range %}
160 {% if page in dividers %}
162 {% if page in dividers %}
161 …,
163 …,
162 {% endif %}
164 {% endif %}
163 <a
165 <a
164 {% ifequal page current_page.number %}
166 {% ifequal page current_page.number %}
165 class="current_page"
167 class="current_page"
166 {% endifequal %}
168 {% endifequal %}
167 href="
169 href="
168 {% if tag %}
170 {% if tag %}
169 {% url "tag" tag_name=tag.name %}?page={{ page }}
171 {% url "tag" tag_name=tag.name %}?page={{ page }}
170 {% else %}
172 {% else %}
171 {% url "index" %}?page={{ page }}
173 {% url "index" %}?page={{ page }}
172 {% endif %}
174 {% endif %}
173 ">{{ page }}</a>
175 ">{{ page }}</a>
174 {% if not forloop.last %},{% endif %}
176 {% if not forloop.last %},{% endif %}
175 {% endfor %}
177 {% endfor %}
176 {% endwith %}
178 {% endwith %}
177 ]
179 ]
178 [<a href="rss/">RSS</a>]
180 [<a href="rss/">RSS</a>]
179 </span>
181 </span>
180
182
181 {% endblock %}
183 {% endblock %}
General Comments 0
You need to be logged in to leave comments. Login now