##// END OF EJS Templates
Made normal and gallery view use the same super-template with the same...
neko259 -
r1042:603aff15 default
parent child Browse files
Show More
@@ -1,63 +1,63 b''
1 {% load staticfiles %}
1 {% load staticfiles %}
2 {% load i18n %}
2 {% load i18n %}
3 {% load l10n %}
3 {% load l10n %}
4 {% load static from staticfiles %}
4 {% load static from staticfiles %}
5
5
6 <!DOCTYPE html>
6 <!DOCTYPE html>
7 <html>
7 <html>
8 <head>
8 <head>
9 <link rel="stylesheet" type="text/css" href="{% static 'css/base.css' %}" media="all"/>
9 <link rel="stylesheet" type="text/css" href="{% static 'css/base.css' %}" media="all"/>
10 <link rel="stylesheet" type="text/css" href="{% static 'css/3party/highlight.css' %}" media="all"/>
10 <link rel="stylesheet" type="text/css" href="{% static 'css/3party/highlight.css' %}" media="all"/>
11 <link rel="stylesheet" type="text/css" href="{% static theme_css %}" media="all"/>
11 <link rel="stylesheet" type="text/css" href="{% static theme_css %}" media="all"/>
12
12
13 <link rel="alternate" type="application/rss+xml" href="rss/" title="{% trans 'Feed' %}"/>
13 <link rel="alternate" type="application/rss+xml" href="rss/" title="{% trans 'Feed' %}"/>
14
14
15 <link rel="icon" type="image/png"
15 <link rel="icon" type="image/png"
16 href="{% static 'favicon.png' %}">
16 href="{% static 'favicon.png' %}">
17
17
18 <meta name="viewport" content="width=device-width, initial-scale=1"/>
18 <meta name="viewport" content="width=device-width, initial-scale=1"/>
19 <meta charset="utf-8"/>
19 <meta charset="utf-8"/>
20
20
21 {% block head %}{% endblock %}
21 {% block head %}{% endblock %}
22 </head>
22 </head>
23 <body>
23 <body>
24 <script src="{% static 'js/jquery-2.0.1.min.js' %}"></script>
24 <script src="{% static 'js/jquery-2.0.1.min.js' %}"></script>
25 <script src="{% static 'js/jquery-ui-1.10.3.custom.min.js' %}"></script>
25 <script src="{% static 'js/jquery-ui-1.10.3.custom.min.js' %}"></script>
26 <script src="{% static 'js/jquery.mousewheel.js' %}"></script>
26 <script src="{% static 'js/jquery.mousewheel.js' %}"></script>
27 <script src="{% url 'js_info_dict' %}"></script>
27 <script src="{% url 'js_info_dict' %}"></script>
28
28
29 <div class="navigation_panel header">
29 <div class="navigation_panel header">
30 <a class="link" href="{% url 'index' %}">{% trans "All threads" %}</a>
30 <a class="link" href="{% url 'index' %}">{% trans "All threads" %}</a>
31 {% autoescape off %}
31 {% autoescape off %}
32 {{ tags_str }},
32 {{ tags_str }},
33 {% endautoescape %}
33 {% endautoescape %}
34 <a href="{% url 'tags' %}" title="{% trans 'Tag management' %}"
34 <a href="{% url 'tags' %}" title="{% trans 'Tag management' %}"
35 >[...]</a>,
35 >[...]</a>,
36 <a href="{% url 'search' %}" title="{% trans 'Search' %}">[S]</a>.
36 <a href="{% url 'search' %}" title="{% trans 'Search' %}">[S]</a>.
37
37
38 {% if username %}
38 {% if username %}
39 <a href="{% url 'notifications' username %}" title="{% trans 'Notifications' %}"><b>{{ new_notifications_count }}</b> {% trans 'notifications' %}</a>.
39 <a href="{% url 'notifications' username %}" title="{% trans 'Notifications' %}"><b>{{ new_notifications_count }}</b> {% trans 'notifications' %}</a>.
40 {% endif %}
40 {% endif %}
41
41
42 <a class="link" href="{% url 'settings' %}">{% trans 'Settings' %}</a>
42 <a class="link" href="{% url 'settings' %}">{% trans 'Settings' %}</a>
43 </div>
43 </div>
44
44
45 {% block content %}{% endblock %}
45 {% block content %}{% endblock %}
46
46
47 <script src="{% static 'js/3party/highlight.min.js' %}"></script>
47 <script src="{% static 'js/3party/highlight.min.js' %}"></script>
48 <script src="{% static 'js/popup.js' %}"></script>
48 <script src="{% static 'js/popup.js' %}"></script>
49 <script src="{% static 'js/image.js' %}"></script>
49 <script src="{% static 'js/image.js' %}"></script>
50 <script src="{% static 'js/refpopup.js' %}"></script>
50 <script src="{% static 'js/refpopup.js' %}"></script>
51 <script src="{% static 'js/main.js' %}"></script>
51 <script src="{% static 'js/main.js' %}"></script>
52
52
53 <div class="navigation_panel footer">
53 <div class="navigation_panel footer">
54 {% block metapanel %}{% endblock %}
54 {% block metapanel %}{% endblock %}
55 [<a href="{% url 'admin:index' %}">{% trans 'Admin' %}</a>]
55 [<a href="{% url 'admin:index' %}">{% trans 'Admin' %}</a>]
56 {% with ppd=posts_per_day|floatformat:2 %}
56 {% with ppd=posts_per_day|floatformat:2 %}
57 {% blocktrans %}Speed: {{ ppd }} posts per day{% endblocktrans %}
57 {% blocktrans %}Speed: {{ ppd }} posts per day{% endblocktrans %}
58 {% endwith %}
58 {% endwith %}
59 <a class="link" href="#top" id="up">{% trans 'Up' %}</a>
59 <a class="link" href="#top" id="up">{% trans 'Up' %}</a>
60 </div>
60 </div>
61
61
62 </body>
62 </body>
63 </html>
63 </html>
@@ -1,89 +1,35 b''
1 {% extends "boards/base.html" %}
1 {% extends "boards/base.html" %}
2
2
3 {% load i18n %}
3 {% load i18n %}
4 {% load cache %}
4 {% load cache %}
5 {% load static from staticfiles %}
5 {% load static from staticfiles %}
6 {% load board %}
6 {% load board %}
7
7
8 {% block head %}
8 {% block head %}
9 <title>{{ opening_post.get_title|striptags|truncatewords:10 }}
9 <title>{{ opening_post.get_title|striptags|truncatewords:10 }}
10 - {{ site_name }}</title>
10 - {{ site_name }}</title>
11 {% endblock %}
11 {% endblock %}
12
12
13 {% block content %}
14 {% get_current_language as LANGUAGE_CODE %}
15
16 {% cache 600 thread_view thread.id thread.last_edit_time moderator LANGUAGE_CODE %}
17
18 <div class="image-mode-tab">
19 <a class="current_mode" href="{% url 'thread' opening_post.id %}">{% trans 'Normal mode' %}</a>,
20 <a href="{% url 'thread_gallery' opening_post.id %}">{% trans 'Gallery mode' %}</a>
21 </div>
22
23 {% if bumpable %}
24 <div class="bar-bg">
25 <div class="bar-value" style="width:{{ bumplimit_progress }}%" id="bumplimit_progress">
26 </div>
27 <div class="bar-text">
28 <span id="left_to_limit">{{ posts_left }}</span> {% trans 'posts to bumplimit' %}
29 </div>
30 </div>
31 {% endif %}
32
33 <div class="thread">
34 {% for post in thread.get_replies %}
35 {% post_view post moderator=moderator %}
36 {% endfor %}
37 </div>
38
39 {% if not thread.archived %}
40 <div class="post-form-w">
41 <script src="{% static 'js/panel.js' %}"></script>
42 <div class="form-title">{% trans "Reply to thread" %} #{{ opening_post.id }}</div>
43 <div class="post-form" id="compact-form">
44 <div class="swappable-form-full">
45 <form enctype="multipart/form-data" method="post" id="form">{% csrf_token %}
46 <div class="compact-form-text"></div>
47 {{ form.as_div }}
48 <div class="form-submit">
49 <input type="submit" value="{% trans "Post" %}"/>
50 </div>
51 (ctrl-enter)
52 </form>
53 </div>
54 <div><a href="{% url "staticpage" name="help" %}">
55 {% trans 'Text syntax' %}</a></div>
56 </div>
57 </div>
58
59 <script src="{% static 'js/jquery.form.min.js' %}"></script>
60 {% endif %}
61
62 <script src="{% static 'js/form.js' %}"></script>
63 <script src="{% static 'js/thread.js' %}"></script>
64 <script src="{% static 'js/thread_update.js' %}"></script>
65 <script src="{% static 'js/3party/centrifuge.js' %}"></script>
66
67 {% endcache %}
68 {% endblock %}
69
70 {% block metapanel %}
13 {% block metapanel %}
71
14
72 {% get_current_language as LANGUAGE_CODE %}
15 {% get_current_language as LANGUAGE_CODE %}
73
16
74 <span class="metapanel"
17 <span class="metapanel"
75 data-last-update="{{ last_update }}"
18 data-last-update="{{ last_update }}"
76 data-ws-token="{{ ws_token }}"
19 data-ws-token="{{ ws_token }}"
77 data-ws-project="{{ ws_project }}"
20 data-ws-project="{{ ws_project }}"
78 data-ws-host="{{ ws_host }}"
21 data-ws-host="{{ ws_host }}"
79 data-ws-port="{{ ws_port }}">
22 data-ws-port="{{ ws_port }}">
23
24 {% block thread_meta_panel %}
25 {% endblock %}
26
80 {% cache 600 thread_meta thread.last_edit_time moderator LANGUAGE_CODE %}
27 {% cache 600 thread_meta thread.last_edit_time moderator LANGUAGE_CODE %}
81 <button id="autoupdate">{% trans 'Update' %}</button>
82 <span id="reply-count">{{ thread.get_reply_count }}</span>/{{ max_replies }} {% trans 'messages' %},
28 <span id="reply-count">{{ thread.get_reply_count }}</span>/{{ max_replies }} {% trans 'messages' %},
83 <span id="image-count">{{ thread.get_images_count }}</span> {% trans 'images' %}.
29 <span id="image-count">{{ thread.get_images_count }}</span> {% trans 'images' %}.
84 {% trans 'Last update: ' %}<span id="last-update"><time datetime="{{ thread.last_edit_time|date:'c' }}">{{ thread.last_edit_time|date:'r' }}</time></span>
30 {% trans 'Last update: ' %}<span id="last-update"><time datetime="{{ thread.last_edit_time|date:'c' }}">{{ thread.last_edit_time|date:'r' }}</time></span>
85 [<a href="rss/">RSS</a>]
31 [<a href="rss/">RSS</a>]
86 {% endcache %}
32 {% endcache %}
87 </span>
33 </span>
88
34
89 {% endblock %}
35 {% endblock %}
@@ -1,69 +1,53 b''
1 {% extends "boards/base.html" %}
1 {% extends "boards/thread.html" %}
2
2
3 {% load i18n %}
3 {% load i18n %}
4 {% load cache %}
4 {% load cache %}
5 {% load static from staticfiles %}
5 {% load static from staticfiles %}
6 {% load board %}
6 {% load board %}
7
7
8 {% block head %}
8 {% block head %}
9 <meta name="robots" content="noindex">
9 <meta name="robots" content="noindex">
10 <title>{{ thread.get_opening_post.get_title|striptags|truncatewords:10 }}
10 <title>{{ thread.get_opening_post.get_title|striptags|truncatewords:10 }}
11 - {{ site_name }}</title>
11 - {{ site_name }}</title>
12 {% endblock %}
12 {% endblock %}
13
13
14 {% block content %}
14 {% block content %}
15 {% spaceless %}
15 {% spaceless %}
16 {% get_current_language as LANGUAGE_CODE %}
16 {% get_current_language as LANGUAGE_CODE %}
17
17
18 {% cache 600 thread_gallery_view thread.id thread.last_edit_time LANGUAGE_CODE request.get_host %}
18 {% cache 600 thread_gallery_view thread.id thread.last_edit_time LANGUAGE_CODE request.get_host %}
19 <div class="image-mode-tab">
19 <div class="image-mode-tab">
20 <a href="{% url 'thread' thread.get_opening_post.id %}">{% trans 'Normal mode' %}</a>,
20 <a href="{% url 'thread' thread.get_opening_post.id %}">{% trans 'Normal mode' %}</a>,
21 <a class="current_mode" href="{% url 'thread_gallery' thread.get_opening_post.id %}">{% trans 'Gallery mode' %}</a>
21 <a class="current_mode" href="{% url 'thread_gallery' thread.get_opening_post.id %}">{% trans 'Gallery mode' %}</a>
22 </div>
22 </div>
23
23
24 <div id="posts-table">
24 <div id="posts-table">
25 {% for post in posts %}
25 {% for post in posts %}
26 <div class="gallery_image">
26 <div class="gallery_image">
27 {% with post.get_first_image as image %}
27 {% with post.get_first_image as image %}
28 <div>
28 <div>
29 <a
29 <a
30 class="thumb"
30 class="thumb"
31 href="{{ image.image.url }}"><img
31 href="{{ image.image.url }}"><img
32 src="{{ image.image.url_200x150 }}"
32 src="{{ image.image.url_200x150 }}"
33 alt="{{ post.id }}"
33 alt="{{ post.id }}"
34 width="{{ image.pre_width }}"
34 width="{{ image.pre_width }}"
35 height="{{ image.pre_height }}"
35 height="{{ image.pre_height }}"
36 data-width="{{ image.width }}"
36 data-width="{{ image.width }}"
37 data-height="{{ image.height }}"/>
37 data-height="{{ image.height }}"/>
38 </a>
38 </a>
39 </div>
39 </div>
40 <div class="gallery_image_metadata">
40 <div class="gallery_image_metadata">
41 {{ image.width }}x{{ image.height }}
41 {{ image.width }}x{{ image.height }}
42 {% image_actions image.image.url request.get_host %}
42 {% image_actions image.image.url request.get_host %}
43 <br />
43 <br />
44 <a href="{{ post.get_url }}">>>{{ post.id }}</a>
44 <a href="{{ post.get_url }}">>>{{ post.id }}</a>
45 </div>
45 </div>
46 {% endwith %}
46 {% endwith %}
47 </div>
47 </div>
48 {% endfor %}
48 {% endfor %}
49 </div>
49 </div>
50 {% endcache %}
50 {% endcache %}
51
51
52 {% endspaceless %}
52 {% endspaceless %}
53 {% endblock %}
53 {% endblock %}
54
55 {% block metapanel %}
56
57 {% get_current_language as LANGUAGE_CODE %}
58
59 <span class="metapanel" data-last-update="{{ last_update }}">
60 {% cache 600 thread_gallery_meta thread.last_edit_time moderator LANGUAGE_CODE %}
61 <span id="reply-count">{{ thread.get_reply_count }}</span>/{{ max_replies }}
62 {% trans 'messages' %},
63 <span id="image-count">{{ thread.get_images_count }}</span> {% trans 'images' %}.
64 {% trans 'Last update: ' %}<time datetime="{{ thread.last_edit_time|date:'c' }}">{{ thread.last_edit_time|date:'r' }}</time>
65 [<a href="rss/">RSS</a>]
66 {% endcache %}
67 </span>
68
69 {% endblock %}
@@ -1,38 +1,38 b''
1 from boards import settings
1 from boards import settings
2 from boards.views.thread import ThreadView
2 from boards.views.thread import ThreadView
3
3
4 TEMPLATE_NORMAL = 'boards/thread.html'
4 TEMPLATE_NORMAL = 'boards/thread_normal.html'
5
5
6 CONTEXT_OP = 'opening_post'
6 CONTEXT_OP = 'opening_post'
7 CONTEXT_BUMPLIMIT_PRG = 'bumplimit_progress'
7 CONTEXT_BUMPLIMIT_PRG = 'bumplimit_progress'
8 CONTEXT_POSTS_LEFT = 'posts_left'
8 CONTEXT_POSTS_LEFT = 'posts_left'
9 CONTEXT_BUMPABLE = 'bumpable'
9 CONTEXT_BUMPABLE = 'bumpable'
10
10
11 FORM_TITLE = 'title'
11 FORM_TITLE = 'title'
12 FORM_TEXT = 'text'
12 FORM_TEXT = 'text'
13 FORM_IMAGE = 'image'
13 FORM_IMAGE = 'image'
14
14
15 MODE_GALLERY = 'gallery'
15 MODE_GALLERY = 'gallery'
16 MODE_NORMAL = 'normal'
16 MODE_NORMAL = 'normal'
17
17
18
18
19 class NormalThreadView(ThreadView):
19 class NormalThreadView(ThreadView):
20
20
21 def get_template(self):
21 def get_template(self):
22 return TEMPLATE_NORMAL
22 return TEMPLATE_NORMAL
23
23
24 def get_data(self, thread):
24 def get_data(self, thread):
25 params = dict()
25 params = dict()
26
26
27 bumpable = thread.can_bump()
27 bumpable = thread.can_bump()
28 params[CONTEXT_BUMPABLE] = bumpable
28 params[CONTEXT_BUMPABLE] = bumpable
29 if bumpable:
29 if bumpable:
30 left_posts = settings.MAX_POSTS_PER_THREAD \
30 left_posts = settings.MAX_POSTS_PER_THREAD \
31 - thread.get_reply_count()
31 - thread.get_reply_count()
32 params[CONTEXT_POSTS_LEFT] = left_posts
32 params[CONTEXT_POSTS_LEFT] = left_posts
33 params[CONTEXT_BUMPLIMIT_PRG] = str(
33 params[CONTEXT_BUMPLIMIT_PRG] = str(
34 float(left_posts) / settings.MAX_POSTS_PER_THREAD * 100)
34 float(left_posts) / settings.MAX_POSTS_PER_THREAD * 100)
35
35
36 params[CONTEXT_OP] = thread.get_opening_post()
36 params[CONTEXT_OP] = thread.get_opening_post()
37
37
38 return params
38 return params
General Comments 0
You need to be logged in to leave comments. Login now