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