Show More
1 | NO CONTENT: file renamed from boards/templates/base.html to boards/templates/boards/base.html |
|
NO CONTENT: file renamed from boards/templates/base.html to boards/templates/boards/base.html |
1 | NO CONTENT: file renamed from boards/templates/login.html to boards/templates/boards/login.html |
|
NO CONTENT: file renamed from boards/templates/login.html to boards/templates/boards/login.html |
@@ -1,164 +1,164 b'' | |||||
1 | {% extends "base.html" %} |
|
1 | {% extends "boards/base.html" %} | |
2 |
|
2 | |||
3 | {% load i18n %} |
|
3 | {% load i18n %} | |
4 | {% load markup %} |
|
4 | {% load markup %} | |
5 |
|
5 | |||
6 | {% block head %} |
|
6 | {% block head %} | |
7 | {% if tag %} |
|
7 | {% if tag %} | |
8 | <title>Neboard - {{ tag }}</title> |
|
8 | <title>Neboard - {{ tag }}</title> | |
9 | {% else %} |
|
9 | {% else %} | |
10 | <title>Neboard</title> |
|
10 | <title>Neboard</title> | |
11 | {% endif %} |
|
11 | {% endif %} | |
12 | {% endblock %} |
|
12 | {% endblock %} | |
13 |
|
13 | |||
14 | {% block content %} |
|
14 | {% block content %} | |
15 |
|
15 | |||
16 | {% if tag %} |
|
16 | {% if tag %} | |
17 | <div class="tag_info"> |
|
17 | <div class="tag_info"> | |
18 | <h2>{% trans 'Tag: ' %}{{ tag }}</h2> |
|
18 | <h2>{% trans 'Tag: ' %}{{ tag }}</h2> | |
19 | </div> |
|
19 | </div> | |
20 | {% endif %} |
|
20 | {% endif %} | |
21 |
|
21 | |||
22 | {% if threads %} |
|
22 | {% if threads %} | |
23 | {% for thread in threads %} |
|
23 | {% for thread in threads %} | |
24 | <div class="thread"> |
|
24 | <div class="thread"> | |
25 | {% if thread.can_bump %} |
|
25 | {% if thread.can_bump %} | |
26 | <div class="post"> |
|
26 | <div class="post"> | |
27 | {% else %} |
|
27 | {% else %} | |
28 | <div class="post dead_post"> |
|
28 | <div class="post dead_post"> | |
29 | {% endif %} |
|
29 | {% endif %} | |
30 | {% if thread.image %} |
|
30 | {% if thread.image %} | |
31 | <div class="image"> |
|
31 | <div class="image"> | |
32 | <a class="fancy" |
|
32 | <a class="fancy" | |
33 | href="{{ thread.image.url }}"><img |
|
33 | href="{{ thread.image.url }}"><img | |
34 | src="{{ thread.image.url_200x150 }}" |
|
34 | src="{{ thread.image.url_200x150 }}" | |
35 | alt="{% trans 'Post image' %}" /> |
|
35 | alt="{% trans 'Post image' %}" /> | |
36 | </a> |
|
36 | </a> | |
37 | </div> |
|
37 | </div> | |
38 | {% endif %} |
|
38 | {% endif %} | |
39 | <div class="message"> |
|
39 | <div class="message"> | |
40 | <div class="post-info"> |
|
40 | <div class="post-info"> | |
41 | <span class="title">{{ thread.title }}</span> |
|
41 | <span class="title">{{ thread.title }}</span> | |
42 | <a class="post_id" href="{% url 'thread' thread.id %}"> |
|
42 | <a class="post_id" href="{% url 'thread' thread.id %}"> | |
43 | (#{{ thread.id }})</a> |
|
43 | (#{{ thread.id }})</a> | |
44 | [{{ thread.pub_time }}] |
|
44 | [{{ thread.pub_time }}] | |
45 | [<a class="link" href="{% url 'thread' thread.id %}#form" |
|
45 | [<a class="link" href="{% url 'thread' thread.id %}#form" | |
46 | >{% trans "Reply" %}</a>] |
|
46 | >{% trans "Reply" %}</a>] | |
47 | </div> |
|
47 | </div> | |
48 | {% autoescape off %} |
|
48 | {% autoescape off %} | |
49 | {{ thread.text.rendered|truncatewords_html:50 }} |
|
49 | {{ thread.text.rendered|truncatewords_html:50 }} | |
50 | {% endautoescape %} |
|
50 | {% endautoescape %} | |
51 | </div> |
|
51 | </div> | |
52 | <div class="metadata"> |
|
52 | <div class="metadata"> | |
53 | {{ thread.get_reply_count }} {% trans 'replies' %}, |
|
53 | {{ thread.get_reply_count }} {% trans 'replies' %}, | |
54 | {{ thread.get_images_count }} {% trans 'images' %}. |
|
54 | {{ thread.get_images_count }} {% trans 'images' %}. | |
55 | {% if thread.tags.all %} |
|
55 | {% if thread.tags.all %} | |
56 | <span class="tags">{% trans 'Tags' %}: |
|
56 | <span class="tags">{% trans 'Tags' %}: | |
57 | {% for tag in thread.tags.all %} |
|
57 | {% for tag in thread.tags.all %} | |
58 | <a class="tag" href=" |
|
58 | <a class="tag" href=" | |
59 | {% url 'tag' tag_name=tag.name %}"> |
|
59 | {% url 'tag' tag_name=tag.name %}"> | |
60 | {{ tag.name }}</a> |
|
60 | {{ tag.name }}</a> | |
61 | {% endfor %} |
|
61 | {% endfor %} | |
62 | </span> |
|
62 | </span> | |
63 | {% endif %} |
|
63 | {% endif %} | |
64 | </div> |
|
64 | </div> | |
65 | </div> |
|
65 | </div> | |
66 | {% if thread.get_last_replies %} |
|
66 | {% if thread.get_last_replies %} | |
67 | <div class="last-replies"> |
|
67 | <div class="last-replies"> | |
68 | {% for post in thread.get_last_replies %} |
|
68 | {% for post in thread.get_last_replies %} | |
69 | {% if thread.can_bump %} |
|
69 | {% if thread.can_bump %} | |
70 | <div class="post"> |
|
70 | <div class="post"> | |
71 | {% else %} |
|
71 | {% else %} | |
72 | <div class="post dead_post"> |
|
72 | <div class="post dead_post"> | |
73 | {% endif %} |
|
73 | {% endif %} | |
74 | {% if post.image %} |
|
74 | {% if post.image %} | |
75 | <div class="image"> |
|
75 | <div class="image"> | |
76 | <a class="fancy" |
|
76 | <a class="fancy" | |
77 | href="{{ post.image.url }}"><img |
|
77 | href="{{ post.image.url }}"><img | |
78 | src=" {{ post.image.url_200x150 }}" |
|
78 | src=" {{ post.image.url_200x150 }}" | |
79 | alt="{% trans 'Post image' %}" /> |
|
79 | alt="{% trans 'Post image' %}" /> | |
80 | </a> |
|
80 | </a> | |
81 | </div> |
|
81 | </div> | |
82 | {% endif %} |
|
82 | {% endif %} | |
83 | <div class="message"> |
|
83 | <div class="message"> | |
84 | <div class="post-info"> |
|
84 | <div class="post-info"> | |
85 | <span class="title">{{ post.title }}</span> |
|
85 | <span class="title">{{ post.title }}</span> | |
86 | <a class="post_id" href=" |
|
86 | <a class="post_id" href=" | |
87 | {% url 'thread' thread.id %}#{{ post.id }}"> |
|
87 | {% url 'thread' thread.id %}#{{ post.id }}"> | |
88 | (#{{ post.id }})</a> |
|
88 | (#{{ post.id }})</a> | |
89 | [{{ post.pub_time }}] |
|
89 | [{{ post.pub_time }}] | |
90 | </div> |
|
90 | </div> | |
91 | {% autoescape off %} |
|
91 | {% autoescape off %} | |
92 | {{ post.text.rendered|truncatewords_html:50 }} |
|
92 | {{ post.text.rendered|truncatewords_html:50 }} | |
93 | {% endautoescape %} |
|
93 | {% endautoescape %} | |
94 | </div> |
|
94 | </div> | |
95 | </div> |
|
95 | </div> | |
96 | {% endfor %} |
|
96 | {% endfor %} | |
97 | </div> |
|
97 | </div> | |
98 | {% endif %} |
|
98 | {% endif %} | |
99 | </div> |
|
99 | </div> | |
100 | {% endfor %} |
|
100 | {% endfor %} | |
101 | {% else %} |
|
101 | {% else %} | |
102 | No threads found. |
|
102 | No threads found. | |
103 | <hr /> |
|
103 | <hr /> | |
104 | {% endif %} |
|
104 | {% endif %} | |
105 |
|
105 | |||
106 | <form enctype="multipart/form-data" method="post">{% csrf_token %} |
|
106 | <form enctype="multipart/form-data" method="post">{% csrf_token %} | |
107 | <div class="post-form-w"> |
|
107 | <div class="post-form-w"> | |
108 |
|
108 | |||
109 | <div class="form-title">{% trans "Create new thread" %}</div> |
|
109 | <div class="form-title">{% trans "Create new thread" %}</div> | |
110 | <div class="post-form"> |
|
110 | <div class="post-form"> | |
111 | <div class="form-row"> |
|
111 | <div class="form-row"> | |
112 | <div class="form-label">{% trans 'Title' %}</div> |
|
112 | <div class="form-label">{% trans 'Title' %}</div> | |
113 | <div class="form-input">{{ form.title }}</div> |
|
113 | <div class="form-input">{{ form.title }}</div> | |
114 | <div class="form-errors">{{ form.title.errors }}</div> |
|
114 | <div class="form-errors">{{ form.title.errors }}</div> | |
115 | </div> |
|
115 | </div> | |
116 | <div class="form-row"> |
|
116 | <div class="form-row"> | |
117 | <div class="form-label">{% trans 'Text' %}</div> |
|
117 | <div class="form-label">{% trans 'Text' %}</div> | |
118 | <div class="form-input">{{ form.text }}</div> |
|
118 | <div class="form-input">{{ form.text }}</div> | |
119 | <div class="form-errors">{{ form.text.errors }}</div> |
|
119 | <div class="form-errors">{{ form.text.errors }}</div> | |
120 | </div> |
|
120 | </div> | |
121 | <div class="form-row"> |
|
121 | <div class="form-row"> | |
122 | <div class="form-label">{% trans 'Image' %}</div> |
|
122 | <div class="form-label">{% trans 'Image' %}</div> | |
123 | <div class="form-input">{{ form.image }}</div> |
|
123 | <div class="form-input">{{ form.image }}</div> | |
124 | <div class="form-errors">{{ form.image.errors }}</div> |
|
124 | <div class="form-errors">{{ form.image.errors }}</div> | |
125 | </div> |
|
125 | </div> | |
126 | <div class="form-row"> |
|
126 | <div class="form-row"> | |
127 | <div class="form-label">{% trans 'Tags' %}</div> |
|
127 | <div class="form-label">{% trans 'Tags' %}</div> | |
128 | <div class="form-input">{{ form.tags }}</div> |
|
128 | <div class="form-input">{{ form.tags }}</div> | |
129 | <div class="form-errors">{{ form.tags.errors }}</div> |
|
129 | <div class="form-errors">{{ form.tags.errors }}</div> | |
130 | </div> |
|
130 | </div> | |
131 | <div class="form-row"> |
|
131 | <div class="form-row"> | |
132 | {{ form.captcha }} |
|
132 | {{ form.captcha }} | |
133 | </div> |
|
133 | </div> | |
134 | </div> |
|
134 | </div> | |
135 | <div class="form-submit"> |
|
135 | <div class="form-submit"> | |
136 | <input type="submit" value="{% trans "Post" %}"/></div> |
|
136 | <input type="submit" value="{% trans "Post" %}"/></div> | |
137 | <div>Tags must be delimited by spaces. Text or image is required |
|
137 | <div>Tags must be delimited by spaces. Text or image is required | |
138 | </div> |
|
138 | </div> | |
139 | <div>Use <a |
|
139 | <div>Use <a | |
140 | href="http://daringfireball.net/projects/markdown/basics"> |
|
140 | href="http://daringfireball.net/projects/markdown/basics"> | |
141 | markdown</a> syntax for posting.</div> |
|
141 | markdown</a> syntax for posting.</div> | |
142 | </div> |
|
142 | </div> | |
143 | </form> |
|
143 | </form> | |
144 |
|
144 | |||
145 | {% endblock %} |
|
145 | {% endblock %} | |
146 |
|
146 | |||
147 | {% block metapanel %} |
|
147 | {% block metapanel %} | |
148 |
|
148 | |||
149 | <span class="metapanel"> |
|
149 | <span class="metapanel"> | |
150 | <b><a href="https://bitbucket.org/neko259/neboard/">Neboard</a> |
|
150 | <b><a href="https://bitbucket.org/neko259/neboard/">Neboard</a> | |
151 | 2013-05 (dev)</b> |
|
151 | 2013-05 (dev)</b> | |
152 | {% trans "Pages:" %} |
|
152 | {% trans "Pages:" %} | |
153 | {% for page in pages %} |
|
153 | {% for page in pages %} | |
154 | [<a href=" |
|
154 | [<a href=" | |
155 | {% if tag %} |
|
155 | {% if tag %} | |
156 | {% url "tag" tag_name=tag page=page %} |
|
156 | {% url "tag" tag_name=tag page=page %} | |
157 | {% else %} |
|
157 | {% else %} | |
158 | {% url "index" page=page %} |
|
158 | {% url "index" page=page %} | |
159 | {% endif %} |
|
159 | {% endif %} | |
160 | ">{{ page }}</a>] |
|
160 | ">{{ page }}</a>] | |
161 | {% endfor %} |
|
161 | {% endfor %} | |
162 | </span> |
|
162 | </span> | |
163 |
|
163 | |||
164 | {% endblock %} |
|
164 | {% endblock %} |
@@ -1,34 +1,34 b'' | |||||
1 | {% extends "base.html" %} |
|
1 | {% extends "boards/base.html" %} | |
2 |
|
2 | |||
3 | {% load i18n %} |
|
3 | {% load i18n %} | |
4 |
|
4 | |||
5 | {% block head %} |
|
5 | {% block head %} | |
6 | <title>Neboard settings</title> |
|
6 | <title>Neboard settings</title> | |
7 | {% endblock %} |
|
7 | {% endblock %} | |
8 |
|
8 | |||
9 | {% block content %} |
|
9 | {% block content %} | |
10 |
|
10 | |||
11 | <div class="post-form-w"> |
|
11 | <div class="post-form-w"> | |
12 | <div class="post-form"> |
|
12 | <div class="post-form"> | |
13 | <span class="form-title">{% trans "Theme" %}</span> |
|
13 | <span class="form-title">{% trans "Theme" %}</span> | |
14 | <form method="post">{% csrf_token %} |
|
14 | <form method="post">{% csrf_token %} | |
15 | {% for choice in form.fields.theme.choices %} |
|
15 | {% for choice in form.fields.theme.choices %} | |
16 | <div class="settings_item"> |
|
16 | <div class="settings_item"> | |
17 | <label for="{{ choice.0 }}"> |
|
17 | <label for="{{ choice.0 }}"> | |
18 | <input type="radio" name="theme" |
|
18 | <input type="radio" name="theme" | |
19 | id="{{ choice.0 }}" |
|
19 | id="{{ choice.0 }}" | |
20 | value="{{ choice.0 }}" |
|
20 | value="{{ choice.0 }}" | |
21 | {% ifequal form.initial.theme choice.0 %} |
|
21 | {% ifequal form.initial.theme choice.0 %} | |
22 | checked |
|
22 | checked | |
23 | {% endifequal %} |
|
23 | {% endifequal %} | |
24 | /> |
|
24 | /> | |
25 | {{ choice.1 }} |
|
25 | {{ choice.1 }} | |
26 | </label> |
|
26 | </label> | |
27 | </div> |
|
27 | </div> | |
28 | {% endfor %} |
|
28 | {% endfor %} | |
29 | <input type="submit" value="{% trans "Save" %}" /> |
|
29 | <input type="submit" value="{% trans "Save" %}" /> | |
30 | </form> |
|
30 | </form> | |
31 | </div> |
|
31 | </div> | |
32 | </div> |
|
32 | </div> | |
33 |
|
33 | |||
34 | {% endblock %} No newline at end of file |
|
34 | {% endblock %} |
@@ -1,24 +1,24 b'' | |||||
1 | {% extends "base.html" %} |
|
1 | {% extends "boards/base.html" %} | |
2 |
|
2 | |||
3 | {% load i18n %} |
|
3 | {% load i18n %} | |
4 | {% load markup %} |
|
4 | {% load markup %} | |
5 |
|
5 | |||
6 | {% block head %} |
|
6 | {% block head %} | |
7 | <title>Neboard - {% trans "tags" %}</title> |
|
7 | <title>Neboard - {% trans "tags" %}</title> | |
8 | {% endblock %} |
|
8 | {% endblock %} | |
9 |
|
9 | |||
10 | {% block content %} |
|
10 | {% block content %} | |
11 |
|
11 | |||
12 | <div class="post"> |
|
12 | <div class="post"> | |
13 | {% if tags %} |
|
13 | {% if tags %} | |
14 | {% for tag in all_tags %} |
|
14 | {% for tag in all_tags %} | |
15 | <a class="tag" href="{% url 'tag' tag.name %}"> |
|
15 | <a class="tag" href="{% url 'tag' tag.name %}"> | |
16 | {{ tag.name }}</a><br /> |
|
16 | {{ tag.name }}</a><br /> | |
17 | {% endfor %} |
|
17 | {% endfor %} | |
18 | {% else %} |
|
18 | {% else %} | |
19 | No tags found. |
|
19 | No tags found. | |
20 | <hr /> |
|
20 | <hr /> | |
21 | {% endif %} |
|
21 | {% endif %} | |
22 | </div> |
|
22 | </div> | |
23 |
|
23 | |||
24 | {% endblock %} No newline at end of file |
|
24 | {% endblock %} |
@@ -1,112 +1,112 b'' | |||||
1 | {% extends "base.html" %} |
|
1 | {% extends "boards/base.html" %} | |
2 |
|
2 | |||
3 | {% load i18n %} |
|
3 | {% load i18n %} | |
4 | {% load markup %} |
|
4 | {% load markup %} | |
5 |
|
5 | |||
6 | {% block head %} |
|
6 | {% block head %} | |
7 | <title>Neboard - {{ posts.0.title }}</title> |
|
7 | <title>Neboard - {{ posts.0.title }}</title> | |
8 | {% endblock %} |
|
8 | {% endblock %} | |
9 |
|
9 | |||
10 | {% block content %} |
|
10 | {% block content %} | |
11 | <script src="{{ STATIC_URL }}js/thread.js"></script> |
|
11 | <script src="{{ STATIC_URL }}js/thread.js"></script> | |
12 |
|
12 | |||
13 | {% if posts %} |
|
13 | {% if posts %} | |
14 | <div id="posts"> |
|
14 | <div id="posts"> | |
15 | {% for post in posts %} |
|
15 | {% for post in posts %} | |
16 | {% if posts.0.can_bump %} |
|
16 | {% if posts.0.can_bump %} | |
17 | <div class="post" id="{{ post.id }}"> |
|
17 | <div class="post" id="{{ post.id }}"> | |
18 | {% else %} |
|
18 | {% else %} | |
19 | <div class="post dead_post" id="{{ post.id }}"> |
|
19 | <div class="post dead_post" id="{{ post.id }}"> | |
20 | {% endif %} |
|
20 | {% endif %} | |
21 | {% if post.image %} |
|
21 | {% if post.image %} | |
22 | <div class="image"> |
|
22 | <div class="image"> | |
23 | <a |
|
23 | <a | |
24 | class="fancy" |
|
24 | class="fancy" | |
25 | href="{{ post.image.url }}"><img |
|
25 | href="{{ post.image.url }}"><img | |
26 | src="{{ post.image.url_200x150 }}" |
|
26 | src="{{ post.image.url_200x150 }}" | |
27 | alt="{% trans 'Post image' %}" /> |
|
27 | alt="{% trans 'Post image' %}" /> | |
28 | </a> |
|
28 | </a> | |
29 | </div> |
|
29 | </div> | |
30 | {% endif %} |
|
30 | {% endif %} | |
31 | <div class="message"> |
|
31 | <div class="message"> | |
32 | <div class="post-info"> |
|
32 | <div class="post-info"> | |
33 | <span class="title">{{ post.title }}</span> |
|
33 | <span class="title">{{ post.title }}</span> | |
34 | <a class="post_id" href="#{{ post.id }}"> |
|
34 | <a class="post_id" href="#{{ post.id }}"> | |
35 | (#{{ post.id }})</a> |
|
35 | (#{{ post.id }})</a> | |
36 | [{{ post.pub_time }}] |
|
36 | [{{ post.pub_time }}] | |
37 | {% if post.is_get %} |
|
37 | {% if post.is_get %} | |
38 | <span class="get"> |
|
38 | <span class="get"> | |
39 | {% trans "Get!" %} |
|
39 | {% trans "Get!" %} | |
40 | </span> |
|
40 | </span> | |
41 | {% endif %} |
|
41 | {% endif %} | |
42 | </div> |
|
42 | </div> | |
43 | {% autoescape off %} |
|
43 | {% autoescape off %} | |
44 | {{ post.text.rendered }} |
|
44 | {{ post.text.rendered }} | |
45 | {% endautoescape %} |
|
45 | {% endautoescape %} | |
46 | </div> |
|
46 | </div> | |
47 | {% if post.tags.all %} |
|
47 | {% if post.tags.all %} | |
48 | <div class="metadata"> |
|
48 | <div class="metadata"> | |
49 | <span class="tags">{% trans 'Tags' %}: |
|
49 | <span class="tags">{% trans 'Tags' %}: | |
50 | {% for tag in post.tags.all %} |
|
50 | {% for tag in post.tags.all %} | |
51 | <a class="tag" href="{% url 'tag' tag.name %}"> |
|
51 | <a class="tag" href="{% url 'tag' tag.name %}"> | |
52 | {{ tag.name }}</a> |
|
52 | {{ tag.name }}</a> | |
53 | {% endfor %} |
|
53 | {% endfor %} | |
54 | </span> |
|
54 | </span> | |
55 | </div> |
|
55 | </div> | |
56 | {% endif %} |
|
56 | {% endif %} | |
57 | </div> |
|
57 | </div> | |
58 | {% endfor %} |
|
58 | {% endfor %} | |
59 | </div> |
|
59 | </div> | |
60 | {% else %} |
|
60 | {% else %} | |
61 | No thread found. |
|
61 | No thread found. | |
62 | <hr /> |
|
62 | <hr /> | |
63 | {% endif %} |
|
63 | {% endif %} | |
64 |
|
64 | |||
65 | <form id="form" enctype="multipart/form-data" method="post" |
|
65 | <form id="form" enctype="multipart/form-data" method="post" | |
66 | >{% csrf_token %} |
|
66 | >{% csrf_token %} | |
67 | <div class="post-form-w"> |
|
67 | <div class="post-form-w"> | |
68 | <div class="form-title">{% trans "Reply to thread" %}</div> |
|
68 | <div class="form-title">{% trans "Reply to thread" %}</div> | |
69 | <div class="post-form"> |
|
69 | <div class="post-form"> | |
70 | <div class="form-row"> |
|
70 | <div class="form-row"> | |
71 | <div class="form-label">{% trans 'Title' %}</div> |
|
71 | <div class="form-label">{% trans 'Title' %}</div> | |
72 | <div class="form-input">{{ form.title }}</div> |
|
72 | <div class="form-input">{{ form.title }}</div> | |
73 | <div class="form-errors">{{ form.title.errors }}</div> |
|
73 | <div class="form-errors">{{ form.title.errors }}</div> | |
74 | </div> |
|
74 | </div> | |
75 | <div class="form-row"> |
|
75 | <div class="form-row"> | |
76 | <div class="form-label">{% trans 'Text' %}</div> |
|
76 | <div class="form-label">{% trans 'Text' %}</div> | |
77 | <div class="form-input">{{ form.text }}</div> |
|
77 | <div class="form-input">{{ form.text }}</div> | |
78 | <div class="form-errors">{{ form.text.errors }}</div> |
|
78 | <div class="form-errors">{{ form.text.errors }}</div> | |
79 | </div> |
|
79 | </div> | |
80 | <div class="form-row"> |
|
80 | <div class="form-row"> | |
81 | <div class="form-label">{% trans 'Image' %}</div> |
|
81 | <div class="form-label">{% trans 'Image' %}</div> | |
82 | <div class="form-input">{{ form.image }}</div> |
|
82 | <div class="form-input">{{ form.image }}</div> | |
83 | <div class="form-errors">{{ form.image.errors }}</div> |
|
83 | <div class="form-errors">{{ form.image.errors }}</div> | |
84 | </div> |
|
84 | </div> | |
85 | <div class="form-row"> |
|
85 | <div class="form-row"> | |
86 | {{ form.captcha }} |
|
86 | {{ form.captcha }} | |
87 | </div> |
|
87 | </div> | |
88 | </div> |
|
88 | </div> | |
89 |
|
89 | |||
90 | <div class="form-submit"><input type="submit" |
|
90 | <div class="form-submit"><input type="submit" | |
91 | value="{% trans "Post" %}"/></div> |
|
91 | value="{% trans "Post" %}"/></div> | |
92 | <div><a href="http://daringfireball.net/projects/markdown/basics"> |
|
92 | <div><a href="http://daringfireball.net/projects/markdown/basics"> | |
93 | {% trans 'Basic markdown syntax.' %}</a></div> |
|
93 | {% trans 'Basic markdown syntax.' %}</a></div> | |
94 | <div>{% trans 'Example: ' %}*<i>{% trans 'italic' %}</i>*, |
|
94 | <div>{% trans 'Example: ' %}*<i>{% trans 'italic' %}</i>*, | |
95 | **<b>{% trans 'bold' %}</b>**</div> |
|
95 | **<b>{% trans 'bold' %}</b>**</div> | |
96 | <div>{% trans 'Quotes can be inserted with' %} ">"</div> |
|
96 | <div>{% trans 'Quotes can be inserted with' %} ">"</div> | |
97 | <div>{% trans 'Links to answers can be inserted with' %} ">> |
|
97 | <div>{% trans 'Links to answers can be inserted with' %} ">> | |
98 | 123"</div> |
|
98 | 123"</div> | |
99 | </div> |
|
99 | </div> | |
100 | </form> |
|
100 | </form> | |
101 |
|
101 | |||
102 | {% endblock %} |
|
102 | {% endblock %} | |
103 |
|
103 | |||
104 | {% block metapanel %} |
|
104 | {% block metapanel %} | |
105 |
|
105 | |||
106 | <span class="metapanel"> |
|
106 | <span class="metapanel"> | |
107 | {{ posts.0.get_reply_count }} {% trans 'replies' %}, |
|
107 | {{ posts.0.get_reply_count }} {% trans 'replies' %}, | |
108 | {{ posts.0.get_images_count }} {% trans 'images' %}. |
|
108 | {{ posts.0.get_images_count }} {% trans 'images' %}. | |
109 | {% trans 'Last update: ' %}{{ posts.0.last_edit_time }} |
|
109 | {% trans 'Last update: ' %}{{ posts.0.last_edit_time }} | |
110 | </span> |
|
110 | </span> | |
111 |
|
111 | |||
112 | {% endblock %} No newline at end of file |
|
112 | {% endblock %} |
@@ -1,212 +1,212 b'' | |||||
1 | from django.core.urlresolvers import reverse |
|
1 | from django.core.urlresolvers import reverse | |
2 | from django.template import RequestContext |
|
2 | from django.template import RequestContext | |
3 | from django.shortcuts import render, redirect, get_object_or_404 |
|
3 | from django.shortcuts import render, redirect, get_object_or_404 | |
4 | from django.http import HttpResponseRedirect |
|
4 | from django.http import HttpResponseRedirect | |
5 |
|
5 | |||
6 | from boards import forms |
|
6 | from boards import forms | |
7 | import boards |
|
7 | import boards | |
8 | from boards import utils |
|
8 | from boards import utils | |
9 | from boards.forms import ThreadForm, PostForm, SettingsForm, PlainErrorList, \ |
|
9 | from boards.forms import ThreadForm, PostForm, SettingsForm, PlainErrorList, \ | |
10 | ThreadCaptchaForm, PostCaptchaForm |
|
10 | ThreadCaptchaForm, PostCaptchaForm | |
11 |
|
11 | |||
12 | from boards.models import Post, Admin, Tag |
|
12 | from boards.models import Post, Admin, Tag | |
13 | import neboard |
|
13 | import neboard | |
14 |
|
14 | |||
15 |
|
15 | |||
16 | def index(request, page=0): |
|
16 | def index(request, page=0): | |
17 | context = RequestContext(request) |
|
17 | context = RequestContext(request) | |
18 |
|
18 | |||
19 | threadFormClass = (ThreadForm |
|
19 | threadFormClass = (ThreadForm | |
20 | if utils.check_if_human(request) |
|
20 | if utils.check_if_human(request) | |
21 | else ThreadCaptchaForm) |
|
21 | else ThreadCaptchaForm) | |
22 |
|
22 | |||
23 | if request.method == 'POST': |
|
23 | if request.method == 'POST': | |
24 | form = threadFormClass(request.POST, request.FILES, |
|
24 | form = threadFormClass(request.POST, request.FILES, | |
25 | error_class=PlainErrorList) |
|
25 | error_class=PlainErrorList) | |
26 |
|
26 | |||
27 | if form.is_valid(): |
|
27 | if form.is_valid(): | |
28 | return _new_post(request, form) |
|
28 | return _new_post(request, form) | |
29 | else: |
|
29 | else: | |
30 | form = threadFormClass(error_class=PlainErrorList) |
|
30 | form = threadFormClass(error_class=PlainErrorList) | |
31 |
|
31 | |||
32 | threads = Post.objects.get_threads(page=int(page)) |
|
32 | threads = Post.objects.get_threads(page=int(page)) | |
33 |
|
33 | |||
34 | # TODO Get rid of the duplicate code in index and tag views |
|
34 | # TODO Get rid of the duplicate code in index and tag views | |
35 | context['threads'] = None if len(threads) == 0 else threads |
|
35 | context['threads'] = None if len(threads) == 0 else threads | |
36 | context['form'] = form |
|
36 | context['form'] = form | |
37 | context['tags'] = Tag.objects.get_popular_tags() |
|
37 | context['tags'] = Tag.objects.get_popular_tags() | |
38 | context['theme'] = _get_theme(request) |
|
38 | context['theme'] = _get_theme(request) | |
39 | context['pages'] = range(Post.objects.get_thread_page_count()) |
|
39 | context['pages'] = range(Post.objects.get_thread_page_count()) | |
40 |
|
40 | |||
41 | return render(request, 'posting_general.html', |
|
41 | return render(request, 'boards/posting_general.html', | |
42 | context) |
|
42 | context) | |
43 |
|
43 | |||
44 |
|
44 | |||
45 | def _new_post(request, form, thread_id=boards.models.NO_PARENT): |
|
45 | def _new_post(request, form, thread_id=boards.models.NO_PARENT): | |
46 | """Add a new post (in thread or as a reply).""" |
|
46 | """Add a new post (in thread or as a reply).""" | |
47 |
|
47 | |||
48 | data = form.cleaned_data |
|
48 | data = form.cleaned_data | |
49 |
|
49 | |||
50 | title = data['title'] |
|
50 | title = data['title'] | |
51 | text = data['text'] |
|
51 | text = data['text'] | |
52 |
|
52 | |||
53 | if 'image' in data.keys(): |
|
53 | if 'image' in data.keys(): | |
54 | image = data['image'] |
|
54 | image = data['image'] | |
55 | else: |
|
55 | else: | |
56 | image = None |
|
56 | image = None | |
57 |
|
57 | |||
58 | ip = _get_client_ip(request) |
|
58 | ip = _get_client_ip(request) | |
59 |
|
59 | |||
60 | tags = [] |
|
60 | tags = [] | |
61 |
|
61 | |||
62 | new_thread = thread_id == boards.models.NO_PARENT |
|
62 | new_thread = thread_id == boards.models.NO_PARENT | |
63 | if new_thread: |
|
63 | if new_thread: | |
64 | tag_strings = data['tags'] |
|
64 | tag_strings = data['tags'] | |
65 |
|
65 | |||
66 | if tag_strings: |
|
66 | if tag_strings: | |
67 | tag_strings = tag_strings.split(' ') |
|
67 | tag_strings = tag_strings.split(' ') | |
68 | for tag_name in tag_strings: |
|
68 | for tag_name in tag_strings: | |
69 | tag_name = tag_name.strip() |
|
69 | tag_name = tag_name.strip() | |
70 | if len(tag_name) > 0: |
|
70 | if len(tag_name) > 0: | |
71 | tag, created = Tag.objects.get_or_create(name=tag_name) |
|
71 | tag, created = Tag.objects.get_or_create(name=tag_name) | |
72 | tags.append(tag) |
|
72 | tags.append(tag) | |
73 |
|
73 | |||
74 | # TODO Add a possibility to define a link image instead of an image file. |
|
74 | # TODO Add a possibility to define a link image instead of an image file. | |
75 | # If a link is given, download the image automatically. |
|
75 | # If a link is given, download the image automatically. | |
76 |
|
76 | |||
77 | post = Post.objects.create_post(title=title, text=text, ip=ip, |
|
77 | post = Post.objects.create_post(title=title, text=text, ip=ip, | |
78 | parent_id=thread_id, image=image, |
|
78 | parent_id=thread_id, image=image, | |
79 | tags=tags) |
|
79 | tags=tags) | |
80 |
|
80 | |||
81 | thread_to_show = (post.id if new_thread else thread_id) |
|
81 | thread_to_show = (post.id if new_thread else thread_id) | |
82 |
|
82 | |||
83 | if new_thread: |
|
83 | if new_thread: | |
84 | return redirect(thread, post_id=thread_to_show) |
|
84 | return redirect(thread, post_id=thread_to_show) | |
85 | else: |
|
85 | else: | |
86 | return redirect(reverse(thread, |
|
86 | return redirect(reverse(thread, | |
87 | kwargs={'post_id': thread_to_show}) + '#' |
|
87 | kwargs={'post_id': thread_to_show}) + '#' | |
88 | + str(post.id)) |
|
88 | + str(post.id)) | |
89 |
|
89 | |||
90 |
|
90 | |||
91 | def tag(request, tag_name, page=0): |
|
91 | def tag(request, tag_name, page=0): | |
92 | """Get all tag threads (posts without a parent).""" |
|
92 | """Get all tag threads (posts without a parent).""" | |
93 |
|
93 | |||
94 | tag = get_object_or_404(Tag, name=tag_name) |
|
94 | tag = get_object_or_404(Tag, name=tag_name) | |
95 | threads = Post.objects.get_threads(tag=tag, page=int(page)) |
|
95 | threads = Post.objects.get_threads(tag=tag, page=int(page)) | |
96 |
|
96 | |||
97 | if request.method == 'POST': |
|
97 | if request.method == 'POST': | |
98 | form = ThreadForm(request.POST, request.FILES, |
|
98 | form = ThreadForm(request.POST, request.FILES, | |
99 | error_class=PlainErrorList) |
|
99 | error_class=PlainErrorList) | |
100 | if form.is_valid(): |
|
100 | if form.is_valid(): | |
101 | return _new_post(request, form) |
|
101 | return _new_post(request, form) | |
102 | else: |
|
102 | else: | |
103 | form = forms.ThreadForm(initial={'tags': tag_name}, |
|
103 | form = forms.ThreadForm(initial={'tags': tag_name}, | |
104 | error_class=PlainErrorList) |
|
104 | error_class=PlainErrorList) | |
105 |
|
105 | |||
106 | context = RequestContext(request) |
|
106 | context = RequestContext(request) | |
107 | context['threads'] = None if len(threads) == 0 else threads |
|
107 | context['threads'] = None if len(threads) == 0 else threads | |
108 | context['tag'] = tag_name |
|
108 | context['tag'] = tag_name | |
109 | context['tags'] = Tag.objects.get_popular_tags() |
|
109 | context['tags'] = Tag.objects.get_popular_tags() | |
110 | context['theme'] = _get_theme(request) |
|
110 | context['theme'] = _get_theme(request) | |
111 | context['pages'] = range(Post.objects.get_thread_page_count(tag=tag)) |
|
111 | context['pages'] = range(Post.objects.get_thread_page_count(tag=tag)) | |
112 |
|
112 | |||
113 | context['form'] = form |
|
113 | context['form'] = form | |
114 |
|
114 | |||
115 | return render(request, 'posting_general.html', |
|
115 | return render(request, 'boards/posting_general.html', | |
116 | context) |
|
116 | context) | |
117 |
|
117 | |||
118 |
|
118 | |||
119 | def thread(request, post_id): |
|
119 | def thread(request, post_id): | |
120 | """Get all thread posts""" |
|
120 | """Get all thread posts""" | |
121 |
|
121 | |||
122 | postFormClass = (PostForm if utils.check_if_human(request) else |
|
122 | postFormClass = (PostForm if utils.check_if_human(request) else | |
123 | PostCaptchaForm) |
|
123 | PostCaptchaForm) | |
124 |
|
124 | |||
125 | if request.method == 'POST': |
|
125 | if request.method == 'POST': | |
126 | form = postFormClass(request.POST, request.FILES, |
|
126 | form = postFormClass(request.POST, request.FILES, | |
127 | error_class=PlainErrorList) |
|
127 | error_class=PlainErrorList) | |
128 | if form.is_valid(): |
|
128 | if form.is_valid(): | |
129 | return _new_post(request, form, post_id) |
|
129 | return _new_post(request, form, post_id) | |
130 | else: |
|
130 | else: | |
131 | form = postFormClass(error_class=PlainErrorList) |
|
131 | form = postFormClass(error_class=PlainErrorList) | |
132 |
|
132 | |||
133 | posts = Post.objects.get_thread(post_id) |
|
133 | posts = Post.objects.get_thread(post_id) | |
134 |
|
134 | |||
135 | context = RequestContext(request) |
|
135 | context = RequestContext(request) | |
136 |
|
136 | |||
137 | context['posts'] = posts |
|
137 | context['posts'] = posts | |
138 | context['form'] = form |
|
138 | context['form'] = form | |
139 | context['tags'] = Tag.objects.get_popular_tags() |
|
139 | context['tags'] = Tag.objects.get_popular_tags() | |
140 | context['theme'] = _get_theme(request) |
|
140 | context['theme'] = _get_theme(request) | |
141 |
|
141 | |||
142 | return render(request, 'thread.html', context) |
|
142 | return render(request, 'boards/thread.html', context) | |
143 |
|
143 | |||
144 |
|
144 | |||
145 | def login(request): |
|
145 | def login(request): | |
146 | """Log in as admin""" |
|
146 | """Log in as admin""" | |
147 |
|
147 | |||
148 | if 'name' in request.POST and 'password' in request.POST: |
|
148 | if 'name' in request.POST and 'password' in request.POST: | |
149 | request.session['admin'] = False |
|
149 | request.session['admin'] = False | |
150 |
|
150 | |||
151 | isAdmin = len(Admin.objects.filter(name=request.POST['name'], |
|
151 | isAdmin = len(Admin.objects.filter(name=request.POST['name'], | |
152 | password=request.POST[ |
|
152 | password=request.POST[ | |
153 | 'password'])) > 0 |
|
153 | 'password'])) > 0 | |
154 |
|
154 | |||
155 | if isAdmin: |
|
155 | if isAdmin: | |
156 | request.session['admin'] = True |
|
156 | request.session['admin'] = True | |
157 |
|
157 | |||
158 | response = HttpResponseRedirect('/') |
|
158 | response = HttpResponseRedirect('/') | |
159 |
|
159 | |||
160 | else: |
|
160 | else: | |
161 | response = render(request, 'login.html', {'error': 'Login error'}) |
|
161 | response = render(request, 'boards/login.html', {'error': 'Login error'}) | |
162 | else: |
|
162 | else: | |
163 | response = render(request, 'login.html', {}) |
|
163 | response = render(request, 'boards/login.html', {}) | |
164 |
|
164 | |||
165 | return response |
|
165 | return response | |
166 |
|
166 | |||
167 |
|
167 | |||
168 | def logout(request): |
|
168 | def logout(request): | |
169 | request.session['admin'] = False |
|
169 | request.session['admin'] = False | |
170 | return HttpResponseRedirect('/') |
|
170 | return HttpResponseRedirect('/') | |
171 |
|
171 | |||
172 |
|
172 | |||
173 | def settings(request): |
|
173 | def settings(request): | |
174 | context = RequestContext(request) |
|
174 | context = RequestContext(request) | |
175 |
|
175 | |||
176 | if request.method == 'POST': |
|
176 | if request.method == 'POST': | |
177 | form = SettingsForm(request.POST) |
|
177 | form = SettingsForm(request.POST) | |
178 | if form.is_valid(): |
|
178 | if form.is_valid(): | |
179 | selected_theme = form.cleaned_data['theme'] |
|
179 | selected_theme = form.cleaned_data['theme'] | |
180 | request.session['theme'] = selected_theme |
|
180 | request.session['theme'] = selected_theme | |
181 |
|
181 | |||
182 | return redirect(settings) |
|
182 | return redirect(settings) | |
183 | else: |
|
183 | else: | |
184 | selected_theme = _get_theme(request) |
|
184 | selected_theme = _get_theme(request) | |
185 | form = SettingsForm(initial={'theme': selected_theme}) |
|
185 | form = SettingsForm(initial={'theme': selected_theme}) | |
186 | context['form'] = form |
|
186 | context['form'] = form | |
187 | context['tags'] = Tag.objects.get_popular_tags() |
|
187 | context['tags'] = Tag.objects.get_popular_tags() | |
188 | context['theme'] = _get_theme(request) |
|
188 | context['theme'] = _get_theme(request) | |
189 |
|
189 | |||
190 | return render(request, 'settings.html', context) |
|
190 | return render(request, 'boards/settings.html', context) | |
191 |
|
191 | |||
192 |
|
192 | |||
193 | def all_tags(request): |
|
193 | def all_tags(request): | |
194 | context = RequestContext(request) |
|
194 | context = RequestContext(request) | |
195 | context['tags'] = Tag.objects.get_popular_tags() |
|
195 | context['tags'] = Tag.objects.get_popular_tags() | |
196 | context['theme'] = _get_theme(request) |
|
196 | context['theme'] = _get_theme(request) | |
197 | context['all_tags'] = Tag.objects.get_not_empty_tags() |
|
197 | context['all_tags'] = Tag.objects.get_not_empty_tags() | |
198 |
|
198 | |||
199 | return render(request, 'tags.html', context) |
|
199 | return render(request, 'boards/tags.html', context) | |
200 |
|
200 | |||
201 |
|
201 | |||
202 | def _get_theme(request): |
|
202 | def _get_theme(request): | |
203 | return request.session.get('theme', neboard.settings.DEFAULT_THEME) |
|
203 | return request.session.get('theme', neboard.settings.DEFAULT_THEME) | |
204 |
|
204 | |||
205 |
|
205 | |||
206 | def _get_client_ip(request): |
|
206 | def _get_client_ip(request): | |
207 | x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR') |
|
207 | x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR') | |
208 | if x_forwarded_for: |
|
208 | if x_forwarded_for: | |
209 | ip = x_forwarded_for.split(',')[-1].strip() |
|
209 | ip = x_forwarded_for.split(',')[-1].strip() | |
210 | else: |
|
210 | else: | |
211 | ip = request.META.get('REMOTE_ADDR') |
|
211 | ip = request.META.get('REMOTE_ADDR') | |
212 | return ip |
|
212 | return ip |
General Comments 0
You need to be logged in to leave comments.
Login now