##// END OF EJS Templates
Merged with the old validation changes.
neko259 -
r75:bb74538a merge default
parent child Browse files
Show More
@@ -1,63 +1,62 b''
1 import re
1 import re
2 from django import forms
2 from django import forms
3 from neboard import settings
3 from neboard import settings
4
4
5
5
6 class PostForm(forms.Form):
6 class PostForm(forms.Form):
7 MAX_TEXT_LENGTH = 10000
7 MAX_TEXT_LENGTH = 10000
8 MAX_IMAGE_SIZE = 8 * 1024 * 1024
8 MAX_IMAGE_SIZE = 8 * 1024 * 1024
9
9
10 title = forms.CharField(max_length=50, required=False)
10 title = forms.CharField(max_length=50, required=False)
11 text = forms.CharField(widget=forms.Textarea, required=False)
11 text = forms.CharField(widget=forms.Textarea, required=False)
12 image = forms.ImageField(required=False)
12 image = forms.ImageField(required=False)
13
13
14 def clean_text(self):
14 def clean_text(self):
15 text = self.cleaned_data['text']
15 text = self.cleaned_data['text']
16 if text:
16 if text:
17 if len(text) > self.MAX_TEXT_LENGTH:
17 if len(text) > self.MAX_TEXT_LENGTH:
18 raise forms.ValidationError('Too many text')
18 raise forms.ValidationError('Too many text')
19 return text
19 return text
20
20
21 def clean_image(self):
21 def clean_image(self):
22 image = self.cleaned_data['image']
22 image = self.cleaned_data['image']
23 if image:
23 if image:
24 if image._size > self.MAX_IMAGE_SIZE:
24 if image._size > self.MAX_IMAGE_SIZE:
25 raise forms.ValidationError('Too large image: more than ' +
25 raise forms.ValidationError('Too large image: more than ' +
26 str(self.MAX_IMAGE_SIZE) + ' bytes')
26 str(self.MAX_IMAGE_SIZE) + ' bytes')
27 return image
27 return image
28
28
29 def clean(self):
29 def clean(self):
30 cleaned_data = super(PostForm, self).clean()
30 cleaned_data = super(PostForm, self).clean()
31
31
32 text = cleaned_data.get('text')
32 text = cleaned_data.get('text')
33 image = cleaned_data.get('image')
33 image = cleaned_data.get('image')
34
34
35 if (not text) and (not image):
35 if (not text) and (not image):
36 raise forms.ValidationError('Enter either text or image')
36 raise forms.ValidationError('Enter either text or image')
37
37
38 return cleaned_data
38 return cleaned_data
39
39
40
40
41 class ThreadForm(PostForm):
41 class ThreadForm(PostForm):
42 regex_tags = re.compile(ur'^[\w\s\d]+$', re.UNICODE)
42 regex_tags = re.compile(ur'^[\w\s\d]+$', re.UNICODE)
43
44 tags = forms.CharField(max_length=100)
43 tags = forms.CharField(max_length=100)
45
44
46 def clean_tags(self):
45 def clean_tags(self):
47 tags = self.cleaned_data['tags']
46 tags = self.cleaned_data['tags']
48
47
49 if tags:
48 if tags:
50 if not self.regex_tags.match(tags):
49 if not self.regex_tags.match(tags):
51 raise forms.ValidationError(
50 raise forms.ValidationError(
52 'Inappropriate characters in tags')
51 'Inappropriate characters in tags')
53
52
54 return tags
53 return tags
55
54
56 def clean(self):
55 def clean(self):
57 cleaned_data = super(ThreadForm, self).clean()
56 cleaned_data = super(ThreadForm, self).clean()
58
57
59 return cleaned_data
58 return cleaned_data
60
59
61
60
62 class SettingsForm(forms.Form):
61 class SettingsForm(forms.Form):
63 theme = forms.ChoiceField(choices=settings.THEMES, widget=forms.RadioSelect) No newline at end of file
62 theme = forms.ChoiceField(choices=settings.THEMES, widget=forms.RadioSelect)
@@ -1,240 +1,253 b''
1 html {
1 html {
2 background: #555;
2 background: #555;
3 color: #ffffff;
3 color: #ffffff;
4 }
4 }
5
5
6 #admin_panel {
6 #admin_panel {
7 background: #FF0000;
7 background: #FF0000;
8 color: #00FF00
8 color: #00FF00
9 }
9 }
10
10
11 .input_field {
12
13 }
14
15 .input_field_name {
16
17 }
18
19 .input_field_error {
20 color: #FF0000;
21 }
22
23
11 .title {
24 .title {
12 font-weight: bold;
25 font-weight: bold;
13 color: #ffcc00;
26 color: #ffcc00;
14 }
27 }
15
28
16 .link, a {
29 .link, a {
17 color: #afdcec;
30 color: #afdcec;
18 }
31 }
19
32
20 .block {
33 .block {
21 display: inline-block;
34 display: inline-block;
22 vertical-align: top;
35 vertical-align: top;
23 }
36 }
24
37
25 .tag {
38 .tag {
26 color: #b4cfec;
39 color: #b4cfec;
27 }
40 }
28
41
29 .post_id {
42 .post_id {
30 color: #fff380;
43 color: #fff380;
31 }
44 }
32
45
33 .post, .dead_post {
46 .post, .dead_post {
34 background: #333;
47 background: #333;
35 margin: 5px;
48 margin: 5px;
36 padding: 10px;
49 padding: 10px;
37 border-radius: 5px;
50 border-radius: 5px;
38 clear: left;
51 clear: left;
39 word-wrap: break-word;
52 word-wrap: break-word;
40 }
53 }
41
54
42 .metadata {
55 .metadata {
43 padding: 5px;
56 padding: 5px;
44 margin-top: 10px;
57 margin-top: 10px;
45 border: solid 1px #666;
58 border: solid 1px #666;
46 font-size: 0.9em;
59 font-size: 0.9em;
47 color: #ddd;
60 color: #ddd;
48 display: table;
61 display: table;
49 }
62 }
50
63
51 .navigation_panel {
64 .navigation_panel {
52 background: #444;
65 background: #444;
53 margin: 5px;
66 margin: 5px;
54 padding: 10px;
67 padding: 10px;
55 border-radius: 5px;
68 border-radius: 5px;
56 color: #eee;
69 color: #eee;
57 }
70 }
58
71
59 .navigation_panel .link {
72 .navigation_panel .link {
60 border-right: 1px solid #fff;
73 border-right: 1px solid #fff;
61 font-weight: bold;
74 font-weight: bold;
62 margin-right: 1ex;
75 margin-right: 1ex;
63 padding-right: 1ex;
76 padding-right: 1ex;
64 }
77 }
65 .navigation_panel .link:last-child {
78 .navigation_panel .link:last-child {
66 border-left: 1px solid #fff;
79 border-left: 1px solid #fff;
67 border-right: none;
80 border-right: none;
68 float: right;
81 float: right;
69 margin-left: 1ex;
82 margin-left: 1ex;
70 margin-right: 0;
83 margin-right: 0;
71 padding-left: 1ex;
84 padding-left: 1ex;
72 padding-right: 0;
85 padding-right: 0;
73 }
86 }
74
87
75 .navigation_panel::after, .post::after {
88 .navigation_panel::after, .post::after {
76 clear: both;
89 clear: both;
77 content: ".";
90 content: ".";
78 display: block;
91 display: block;
79 height: 0;
92 height: 0;
80 line-height: 0;
93 line-height: 0;
81 visibility: hidden;
94 visibility: hidden;
82 }
95 }
83
96
84 p {
97 p {
85 margin-top: .5em;
98 margin-top: .5em;
86 margin-bottom: .5em;
99 margin-bottom: .5em;
87 }
100 }
88
101
89 .post-form-w {
102 .post-form-w {
90 display: table;
103 display: table;
91 background: #333344;
104 background: #333344;
92 border-radius: 5px;
105 border-radius: 5px;
93 color: #fff;
106 color: #fff;
94 padding: 10px;
107 padding: 10px;
95 margin: 5px
108 margin: 5px
96 }
109 }
97
110
98 .form-row {
111 .form-row {
99 display: table-row;
112 display: table-row;
100 }
113 }
101
114
102 .form-label, .form-input {
115 .form-label, .form-input {
103 display: table-cell;
116 display: table-cell;
104 }
117 }
105
118
106 .form-label {
119 .form-label {
107 padding: .25em 1ex .25em 0;
120 padding: .25em 1ex .25em 0;
108 vertical-align: top;
121 vertical-align: top;
109 }
122 }
110
123
111 .form-input {
124 .form-input {
112 padding: .25em 0;
125 padding: .25em 0;
113 }
126 }
114
127
115 .post-form input, .post-form textarea {
128 .post-form input, .post-form textarea {
116 background: #333;
129 background: #333;
117 color: #fff;
130 color: #fff;
118 border: solid 1px;
131 border: solid 1px;
119 padding: 0;
132 padding: 0;
120 width: 100%;
133 width: 100%;
121 }
134 }
122
135
123 .form-submit {
136 .form-submit {
124 border-bottom: 2px solid #ddd;
137 border-bottom: 2px solid #ddd;
125 margin-bottom: .5em;
138 margin-bottom: .5em;
126 padding-bottom: .5em;
139 padding-bottom: .5em;
127 }
140 }
128
141
129 .form-title {
142 .form-title {
130 font-weight: bold;
143 font-weight: bold;
131 }
144 }
132
145
133 input[type="submit"] {
146 input[type="submit"] {
134 background: #222;
147 background: #222;
135 border: solid 1px #fff;
148 border: solid 1px #fff;
136 color: #fff;
149 color: #fff;
137 }
150 }
138
151
139 blockquote {
152 blockquote {
140 border-left: solid 2px;
153 border-left: solid 2px;
141 padding-left: 5px;
154 padding-left: 5px;
142 color: #B1FB17;
155 color: #B1FB17;
143 margin: 0;
156 margin: 0;
144 }
157 }
145
158
146 .post > .image {
159 .post > .image {
147 float: left; margin: 0 1ex .5ex 0;
160 float: left; margin: 0 1ex .5ex 0;
148 }
161 }
149
162
150 .post > .metadata {
163 .post > .metadata {
151 clear: left;
164 clear: left;
152 }
165 }
153
166
154 .get {
167 .get {
155 font-weight: bold;
168 font-weight: bold;
156 color: #d55;
169 color: #d55;
157 }
170 }
158
171
159 * {
172 * {
160 text-decoration: none;
173 text-decoration: none;
161 }
174 }
162
175
163 .dead_post {
176 .dead_post {
164 background-color: #442222;
177 background-color: #442222;
165 }
178 }
166
179
167 .quote {
180 .quote {
168 color: greenyellow;
181 color: greenyellow;
169 padding-left: 5px;
182 padding-left: 5px;
170 border-left: solid 2px greenyellow;
183 border-left: solid 2px greenyellow;
171 }
184 }
172
185
173 .spoiler {
186 .spoiler {
174 background: white;
187 background: white;
175 color: white;
188 color: white;
176 }
189 }
177
190
178 .spoiler:hover {
191 .spoiler:hover {
179 background: black;
192 background: black;
180 }
193 }
181
194
182 .comment {
195 .comment {
183 color: darkseagreen;
196 color: darkseagreen;
184 }
197 }
185
198
186 a:hover {
199 a:hover {
187 text-decoration: underline;
200 text-decoration: underline;
188 }
201 }
189
202
190 .last-replies {
203 .last-replies {
191 margin-left: 3ex;
204 margin-left: 3ex;
192 }
205 }
193
206
194 .thread {
207 .thread {
195 margin-bottom: 3ex;
208 margin-bottom: 3ex;
196 }
209 }
197
210
198 .post:target {
211 .post:target {
199 border: solid 2px white;
212 border: solid 2px white;
200 }
213 }
201
214
202 pre{
215 pre{
203 white-space:pre-wrap
216 white-space:pre-wrap
204 }
217 }
205
218
206 li {
219 li {
207 list-style-position: inside;
220 list-style-position: inside;
208 }
221 }
209
222
210 .fancybox-skin {
223 .fancybox-skin {
211 position: relative;
224 position: relative;
212 background-color: #fff;
225 background-color: #fff;
213 color: #ddd;
226 color: #ddd;
214 text-shadow: none;
227 text-shadow: none;
215 }
228 }
216
229
217 .fancybox-image {
230 .fancybox-image {
218 border: 1px solid black;
231 border: 1px solid black;
219 }
232 }
220
233
221 .image-mode-tab {
234 .image-mode-tab {
222 background: #444;
235 background: #444;
223 color: #eee;
236 color: #eee;
224 display: table;
237 display: table;
225 margin: 5px;
238 margin: 5px;
226 padding: 5px;
239 padding: 5px;
227 border-radius: 5px;
240 border-radius: 5px;
228 }
241 }
229
242
230 .image-mode-tab > label {
243 .image-mode-tab > label {
231 margin: 0 1ex;
244 margin: 0 1ex;
232 }
245 }
233
246
234 .image-mode-tab > label > input {
247 .image-mode-tab > label > input {
235 margin-right: .5ex;
248 margin-right: .5ex;
236 }
249 }
237
250
238 #posts-table {
251 #posts-table {
239 margin: 5px;
252 margin: 5px;
240 } No newline at end of file
253 }
@@ -1,244 +1,257 b''
1 * {
1 * {
2 font-size: inherit;
2 font-size: inherit;
3 margin: 0;
3 margin: 0;
4 padding: 0;
4 padding: 0;
5 }
5 }
6 html {
6 html {
7 background: #fff;
7 background: #fff;
8 color: #000;
8 color: #000;
9 font: medium sans-serif;
9 font: medium sans-serif;
10 }
10 }
11 a {
11 a {
12 color: inherit;
12 color: inherit;
13 text-decoration: underline;
13 text-decoration: underline;
14 }
14 }
15 li {
15 li {
16 list-style-position: inside;
16 list-style-position: inside;
17 }
17 }
18
18
19 #admin_panel {
19 #admin_panel {
20 background: #182F6F;
20 background: #182F6F;
21 color: #fff;
21 color: #fff;
22 padding: .5ex 1ex .5ex 1ex;
22 padding: .5ex 1ex .5ex 1ex;
23 }
23 }
24
24
25 .navigation_panel {
25 .navigation_panel {
26 background: #182F6F;
26 background: #182F6F;
27 color: #B4CFEC;
27 color: #B4CFEC;
28 margin-bottom: 1em;
28 margin-bottom: 1em;
29 padding: .5ex 1ex 1ex 1ex;
29 padding: .5ex 1ex 1ex 1ex;
30 }
30 }
31 .navigation_panel::after {
31 .navigation_panel::after {
32 clear: both;
32 clear: both;
33 content: ".";
33 content: ".";
34 display: block;
34 display: block;
35 height: 0;
35 height: 0;
36 line-height: 0;
36 line-height: 0;
37 visibility: hidden;
37 visibility: hidden;
38 }
38 }
39
39
40 .navigation_panel a:link, .navigation_panel a:visited, .navigation_panel a:hover {
40 .navigation_panel a:link, .navigation_panel a:visited, .navigation_panel a:hover {
41 text-decoration: none;
41 text-decoration: none;
42 }
42 }
43
43
44 .navigation_panel .link {
44 .navigation_panel .link {
45 border-right: 1px solid #fff;
45 border-right: 1px solid #fff;
46 color: #fff;
46 color: #fff;
47 font-weight: bold;
47 font-weight: bold;
48 margin-right: 1ex;
48 margin-right: 1ex;
49 padding-right: 1ex;
49 padding-right: 1ex;
50 }
50 }
51 .navigation_panel .link:last-child {
51 .navigation_panel .link:last-child {
52 border-left: 1px solid #fff;
52 border-left: 1px solid #fff;
53 border-right: none;
53 border-right: none;
54 float: right;
54 float: right;
55 margin-left: 1ex;
55 margin-left: 1ex;
56 margin-right: 0;
56 margin-right: 0;
57 padding-left: 1ex;
57 padding-left: 1ex;
58 padding-right: 0;
58 padding-right: 0;
59 }
59 }
60
60
61 .navigation_panel .tag {
61 .navigation_panel .tag {
62 color: #fff;
62 color: #fff;
63 }
63 }
64
64
65 .input_field {
66
67 }
68
69 .input_field_name {
70
71 }
72
73 .input_field_error {
74 color: #FF0000;
75 }
76
77
65 .title {
78 .title {
66 color: #182F6F;
79 color: #182F6F;
67 font-weight: bold;
80 font-weight: bold;
68 }
81 }
69
82
70 .post-form-w {
83 .post-form-w {
71 background: #182F6F;
84 background: #182F6F;
72 border-radius: 1ex;
85 border-radius: 1ex;
73 color: #fff;
86 color: #fff;
74 margin: 1em 1ex;
87 margin: 1em 1ex;
75 padding: 1ex;
88 padding: 1ex;
76 }
89 }
77 .post-form {
90 .post-form {
78 display: table;
91 display: table;
79 border-collapse: collapse;
92 border-collapse: collapse;
80 width: 100%;
93 width: 100%;
81
94
82 }
95 }
83 .form-row {
96 .form-row {
84 display: table-row;
97 display: table-row;
85 }
98 }
86 .form-label, .form-input {
99 .form-label, .form-input {
87 display: table-cell;
100 display: table-cell;
88 vertical-align: top;
101 vertical-align: top;
89 }
102 }
90 .form-label {
103 .form-label {
91 padding: .25em 1ex .25em 0;
104 padding: .25em 1ex .25em 0;
92 }
105 }
93 .form-input {
106 .form-input {
94 padding: .25em 0;
107 padding: .25em 0;
95 }
108 }
96 .form-input > * {
109 .form-input > * {
97 background: #fff;
110 background: #fff;
98 color: #000;
111 color: #000;
99 border: none;
112 border: none;
100 padding: 0;
113 padding: 0;
101 resize: vertical;
114 resize: vertical;
102 width: 100%;
115 width: 100%;
103 }
116 }
104 .form-submit {
117 .form-submit {
105 border-bottom: 1px solid #666;
118 border-bottom: 1px solid #666;
106 margin-bottom: .5em;
119 margin-bottom: .5em;
107 padding-bottom: .5em;
120 padding-bottom: .5em;
108 }
121 }
109 .form-title {
122 .form-title {
110 font-weight: bold;
123 font-weight: bold;
111 margin-bottom: .5em;
124 margin-bottom: .5em;
112 }
125 }
113 .post-form .settings_item {
126 .post-form .settings_item {
114 margin: .5em 0;
127 margin: .5em 0;
115 }
128 }
116 .form-submit input {
129 .form-submit input {
117 margin-top: .5em;
130 margin-top: .5em;
118 padding: .2em 1ex;
131 padding: .2em 1ex;
119 }
132 }
120 .form-label {
133 .form-label {
121 text-align: right;
134 text-align: right;
122 }
135 }
123
136
124 .block {
137 .block {
125 display: inline-block;
138 display: inline-block;
126 vertical-align: top;
139 vertical-align: top;
127 }
140 }
128
141
129 .post_id {
142 .post_id {
130 color: #a00;
143 color: #a00;
131 }
144 }
132
145
133 .post {
146 .post {
134 clear: left;
147 clear: left;
135 margin: 0 1ex 1em 1ex;
148 margin: 0 1ex 1em 1ex;
136 overflow-x: auto;
149 overflow-x: auto;
137 word-wrap: break-word;
150 word-wrap: break-word;
138 }
151 }
139 .last-replies > .post, #posts > .post {
152 .last-replies > .post, #posts > .post {
140 border-bottom: 1px solid #182F6F;
153 border-bottom: 1px solid #182F6F;
141 padding-bottom: 1em;
154 padding-bottom: 1em;
142 }
155 }
143 #posts > .post:last-child {
156 #posts > .post:last-child {
144 border-bottom: none;
157 border-bottom: none;
145 padding-bottom: 0;
158 padding-bottom: 0;
146 }
159 }
147
160
148 .metadata {
161 .metadata {
149 background: #C0E4E8;
162 background: #C0E4E8;
150 border: 1px solid #7F9699;
163 border: 1px solid #7F9699;
151 border-radius: .4ex;
164 border-radius: .4ex;
152 display: table;
165 display: table;
153 margin-top: .5em;
166 margin-top: .5em;
154 padding: .4em;
167 padding: .4em;
155 }
168 }
156
169
157 .post ul, .post ol {
170 .post ul, .post ol {
158 margin: .5em 0 .5em 3ex;
171 margin: .5em 0 .5em 3ex;
159 }
172 }
160 .post li {
173 .post li {
161 margin: .2em 0;
174 margin: .2em 0;
162 }
175 }
163 .post p {
176 .post p {
164 margin: .5em 0;
177 margin: .5em 0;
165 }
178 }
166 .post blockquote {
179 .post blockquote {
167 border-left: 3px solid #182F6F;
180 border-left: 3px solid #182F6F;
168 margin: .5em 0 .5em 3ex;
181 margin: .5em 0 .5em 3ex;
169 padding-left: 1ex;
182 padding-left: 1ex;
170 }
183 }
171 .post blockquote > blockquote {
184 .post blockquote > blockquote {
172 padding-top: .1em;
185 padding-top: .1em;
173 }
186 }
174
187
175 .post > .image {
188 .post > .image {
176 float: left;
189 float: left;
177 margin-right: 1ex;
190 margin-right: 1ex;
178 }
191 }
179 .post > .metadata {
192 .post > .metadata {
180 clear: left;
193 clear: left;
181 }
194 }
182
195
183 .post > .message .get {
196 .post > .message .get {
184 color: #182F6F; font-weight: bold;
197 color: #182F6F; font-weight: bold;
185 }
198 }
186
199
187 .dead_post > .metadata {
200 .dead_post > .metadata {
188 background: #eee;
201 background: #eee;
189 }
202 }
190
203
191 .quote {
204 .quote {
192 color: #182F6F;
205 color: #182F6F;
193 padding-left: 5px;
206 padding-left: 5px;
194 border-left: solid 2px blue;
207 border-left: solid 2px blue;
195 }
208 }
196
209
197 .spoiler {
210 .spoiler {
198 background: black;
211 background: black;
199 color: black;
212 color: black;
200 }
213 }
201
214
202 .spoiler:hover {
215 .spoiler:hover {
203 background: #ffffff;
216 background: #ffffff;
204 }
217 }
205
218
206 .comment {
219 .comment {
207 color: #557055;
220 color: #557055;
208 }
221 }
209
222
210 .last-replies {
223 .last-replies {
211 margin-left: 6ex;
224 margin-left: 6ex;
212 }
225 }
213
226
214 .thread > .post > .message > .post-info {
227 .thread > .post > .message > .post-info {
215 border-bottom: 2px solid #182F6F;
228 border-bottom: 2px solid #182F6F;
216 padding-bottom: .5em;
229 padding-bottom: .5em;
217 }
230 }
218
231
219 .last-replies > .post:last-child {
232 .last-replies > .post:last-child {
220 border-bottom: none;
233 border-bottom: none;
221 padding-bottom: 0;
234 padding-bottom: 0;
222 }
235 }
223
236
224 :target .post_id {
237 :target .post_id {
225 background: #182F6F;
238 background: #182F6F;
226 color: #FFF;
239 color: #FFF;
227 text-decoration: none;
240 text-decoration: none;
228 }
241 }
229
242
230 .image-mode-tab {
243 .image-mode-tab {
231 background: #182F6F;
244 background: #182F6F;
232 color: #FFF;
245 color: #FFF;
233 display: table;
246 display: table;
234 margin: 1em auto 1em 0;
247 margin: 1em auto 1em 0;
235 padding: .2em .5ex;
248 padding: .2em .5ex;
236 }
249 }
237
250
238 .image-mode-tab > label {
251 .image-mode-tab > label {
239 margin: 0 1ex;
252 margin: 0 1ex;
240 }
253 }
241
254
242 .image-mode-tab > label > input {
255 .image-mode-tab > label > input {
243 margin-right: .5ex;
256 margin-right: .5ex;
244 } No newline at end of file
257 }
@@ -1,154 +1,158 b''
1 {% extends "base.html" %}
1 {% extends "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>{{ tag }}</h2>
18 <h2>{{ 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 </a>
35 </a>
36 </div>
36 </div>
37 {% endif %}
37 {% endif %}
38 <div class="message">
38 <div class="message">
39 <div class="post-info">
39 <div class="post-info">
40 <span class="title">{{ thread.title }}</span>
40 <span class="title">{{ thread.title }}</span>
41 <a class="post_id" href="{% url 'thread' thread.id %}">
41 <a class="post_id" href="{% url 'thread' thread.id %}">
42 (#{{ thread.id }})</a>
42 (#{{ thread.id }})</a>
43 [{{ thread.pub_time }}]
43 [{{ thread.pub_time }}]
44 [<a class="link" href="{% url 'thread' thread.id %}#form"
44 [<a class="link" href="{% url 'thread' thread.id %}#form"
45 >{% trans "Reply" %}</a>]
45 >{% trans "Reply" %}</a>]
46 </div>
46 </div>
47 {% autoescape off %}
47 {% autoescape off %}
48 {{ thread.text.rendered|truncatewords_html:50 }}
48 {{ thread.text.rendered|truncatewords_html:50 }}
49 {% endautoescape %}
49 {% endautoescape %}
50 </div>
50 </div>
51 <div class="metadata">
51 <div class="metadata">
52 {{ thread.get_reply_count }} {% trans 'replies' %},
52 {{ thread.get_reply_count }} {% trans 'replies' %},
53 {{ thread.get_images_count }} {% trans 'images' %}.
53 {{ thread.get_images_count }} {% trans 'images' %}.
54 {% if thread.tags.all %}
54 {% if thread.tags.all %}
55 <span class="tags">{% trans 'Tags' %}:
55 <span class="tags">{% trans 'Tags' %}:
56 {% for tag in thread.tags.all %}
56 {% for tag in thread.tags.all %}
57 <a class="tag" href="
57 <a class="tag" href="
58 {% url 'tag' tag_name=tag.name %}">
58 {% url 'tag' tag_name=tag.name %}">
59 {{ tag.name }}</a>
59 {{ tag.name }}</a>
60 {% endfor %}
60 {% endfor %}
61 </span>
61 </span>
62 {% endif %}
62 {% endif %}
63 </div>
63 </div>
64 </div>
64 </div>
65 {% if thread.get_last_replies %}
65 {% if thread.get_last_replies %}
66 <div class="last-replies">
66 <div class="last-replies">
67 {% for post in thread.get_last_replies %}
67 {% for post in thread.get_last_replies %}
68 {% if thread.can_bump %}
68 {% if thread.can_bump %}
69 <div class="post">
69 <div class="post">
70 {% else %}
70 {% else %}
71 <div class="post dead_post">
71 <div class="post dead_post">
72 {% endif %}
72 {% endif %}
73 {% if post.image %}
73 {% if post.image %}
74 <div class="image">
74 <div class="image">
75 <a class="fancy"
75 <a class="fancy"
76 href="{{ post.image.url }}"><img
76 href="{{ post.image.url }}"><img
77 src="{{ post.image.url_200x150 }}" />
77 src="{{ post.image.url_200x150 }}" />
78 </a>
78 </a>
79 </div>
79 </div>
80 {% endif %}
80 {% endif %}
81 <div class="message">
81 <div class="message">
82 <div class="post-info">
82 <div class="post-info">
83 <span class="title">{{ post.title }}</span>
83 <span class="title">{{ post.title }}</span>
84 <a class="post_id" href="
84 <a class="post_id" href="
85 {% url 'thread' thread.id %}#{{ post.id }}">
85 {% url 'thread' thread.id %}#{{ post.id }}">
86 (#{{ post.id }})</a>
86 (#{{ post.id }})</a>
87 [{{ post.pub_time }}]
87 [{{ post.pub_time }}]
88 </div>
88 </div>
89 {% autoescape off %}
89 {% autoescape off %}
90 {{ post.text.rendered|truncatewords_html:50 }}
90 {{ post.text.rendered|truncatewords_html:50 }}
91 {% endautoescape %}
91 {% endautoescape %}
92 </div>
92 </div>
93 </div>
93 </div>
94 {% endfor %}
94 {% endfor %}
95 </div>
95 </div>
96 {% endif %}
96 {% endif %}
97 </div>
97 </div>
98 {% endfor %}
98 {% endfor %}
99 {% else %}
99 {% else %}
100 No threads found.
100 No threads found.
101 <hr />
101 <hr />
102 {% endif %}
102 {% endif %}
103
103
104 <form enctype="multipart/form-data" method="post">{% csrf_token %}
104 <form enctype="multipart/form-data" method="post">{% csrf_token %}
105 <div class="post-form-w">
105 <div class="post-form-w">
106 <div class="form-title">{% trans "Create new thread" %}</div>
106 <div class="form-title">{% trans "Create new thread" %}</div>
107 <div class="post-form">
107 <div class="post-form">
108 <div class="form-row">
108 <div class="form-row">
109 <div class="form-label">{% trans 'Title' %}</div>
109 <div class="form-label">{% trans 'Title' %}</div>
110 <div class="form-input">{{ form.title }}</div>
110 <div class="form-input">{{ form.title }}</div>
111 <div class="form-errors">{{ form.title.errors }}</div>
111 </div>
112 </div>
112 <div class="form-row">
113 <div class="form-row">
113 <div class="form-label">{% trans 'Text' %}</div>
114 <div class="form-label">{% trans 'Text' %}</div>
114 <div class="form-input">{{ form.text }}</div>
115 <div class="form-input">{{ form.text }}</div>
116 <div class="form-errors">{{ form.text.errors }}</div>
115 </div>
117 </div>
116 <div class="form-row">
118 <div class="form-row">
117 <div class="form-label">{% trans 'Image' %}</div>
119 <div class="form-label">{% trans 'Image' %}</div>
118 <div class="form-input">{{ form.image }}</div>
120 <div class="form-input">{{ form.image }}</div>
121 <div class="form-errors">{{ form.image.errors }}</div>
119 </div>
122 </div>
120 <div class="form-row">
123 <div class="form-row">
121 <div class="form-label">{% trans 'Tags' %}</div>
124 <div class="form-label">{% trans 'Tags' %}</div>
122 <div class="form-input">{{ form.tags }}</div>
125 <div class="form-input">{{ form.tags }}</div>
126 <div class="form-errors">{{ form.tags.errors }}</div>
123 </div>
127 </div>
124 </div>
128 </div>
125 <div class="form-submit"><input type="submit"
129 <div class="form-submit"><input type="submit"
126 value="{% trans "Post" %}"/></div>
130 value="{% trans "Post" %}"/></div>
127 <div>Tags must be delimited by spaces. Text or image is required
131 <div>Tags must be delimited by spaces. Text or image is required
128 </div>
132 </div>
129 <div>Use <a
133 <div>Use <a
130 href="http://daringfireball.net/projects/markdown/basics">
134 href="http://daringfireball.net/projects/markdown/basics">
131 markdown</a> syntax for posting.</div>
135 markdown</a> syntax for posting.</div>
132 </div>
136 </div>
133 </form>
137 </form>
134
138
135 {% endblock %}
139 {% endblock %}
136
140
137 {% block metapanel %}
141 {% block metapanel %}
138
142
139 <span class="metapanel">
143 <span class="metapanel">
140 <b><a href="https://bitbucket.org/neko259/neboard/">Neboard</a>
144 <b><a href="https://bitbucket.org/neko259/neboard/">Neboard</a>
141 2013-05 (dev)</b>
145 2013-05 (dev)</b>
142 {% trans "Pages:" %}
146 {% trans "Pages:" %}
143 {% for page in pages %}
147 {% for page in pages %}
144 [<a href="
148 [<a href="
145 {% if tag %}
149 {% if tag %}
146 {% url "tag" tag_name=tag page=page %}
150 {% url "tag" tag_name=tag page=page %}
147 {% else %}
151 {% else %}
148 {% url "index" page=page %}
152 {% url "index" page=page %}
149 {% endif %}
153 {% endif %}
150 ">{{ page }}</a>]
154 ">{{ page }}</a>]
151 {% endfor %}
155 {% endfor %}
152 </span>
156 </span>
153
157
154 {% endblock %}
158 {% endblock %}
@@ -1,102 +1,106 b''
1 {% extends "base.html" %}
1 {% extends "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 </a>
27 </a>
28 </div>
28 </div>
29 {% endif %}
29 {% endif %}
30 <div class="message">
30 <div class="message">
31 <div class="post-info">
31 <div class="post-info">
32 <span class="title">{{ post.title }}</span>
32 <span class="title">{{ post.title }}</span>
33 <a class="post_id" href="#{{ post.id }}">
33 <a class="post_id" href="#{{ post.id }}">
34 (#{{ post.id }})</a>
34 (#{{ post.id }})</a>
35 [{{ post.pub_time }}]
35 [{{ post.pub_time }}]
36 {% if post.is_get %}
36 {% if post.is_get %}
37 <span class="get">
37 <span class="get">
38 {% trans "Get!" %}
38 {% trans "Get!" %}
39 </span>
39 </span>
40 {% endif %}
40 {% endif %}
41 </div>
41 </div>
42 {% autoescape off %}
42 {% autoescape off %}
43 {{ post.text.rendered }}
43 {{ post.text.rendered }}
44 {% endautoescape %}
44 {% endautoescape %}
45 </div>
45 </div>
46 {% if post.tags.all %}
46 {% if post.tags.all %}
47 <div class="metadata">
47 <div class="metadata">
48 <span class="tags">{% trans 'Tags' %}:
48 <span class="tags">{% trans 'Tags' %}:
49 {% for tag in post.tags.all %}
49 {% for tag in post.tags.all %}
50 <a class="tag" href="{% url 'tag' tag.name %}">
50 <a class="tag" href="{% url 'tag' tag.name %}">
51 {{ tag.name }}</a>
51 {{ tag.name }}</a>
52 {% endfor %}
52 {% endfor %}
53 </span>
53 </span>
54 </div>
54 </div>
55 {% endif %}
55 {% endif %}
56 </div>
56 </div>
57 {% endfor %}
57 {% endfor %}
58 </div>
58 </div>
59 {% else %}
59 {% else %}
60 No thread found.
60 No thread found.
61 <hr />
61 <hr />
62 {% endif %}
62 {% endif %}
63
63
64 <<<<<<< local
64 <form id="form" enctype="multipart/form-data" method="post"
65 <form id="form" enctype="multipart/form-data" method="post"
65 >{% csrf_token %}
66 >{% csrf_token %}
66 <div class="post-form-w">
67 <div class="post-form-w">
67 <div class="form-title">{% trans "Reply to thread" %}</div>
68 <div class="form-title">{% trans "Reply to thread" %}</div>
68 <div class="post-form">
69 <div class="post-form">
69 <div class="form-row">
70 <div class="form-row">
70 <div class="form-label">{% trans 'Title' %}</div>
71 <div class="form-label">{% trans 'Title' %}</div>
71 <div class="form-input">{{ form.title }}</div>
72 <div class="form-input">{{ form.title }}</div>
73 <div class="form-errors">{{ form.title.errors }}</div>
72 </div>
74 </div>
73 <div class="form-row">
75 <div class="form-row">
74 <div class="form-label">{% trans 'Text' %}</div>
76 <div class="form-label">{% trans 'Text' %}</div>
75 <div class="form-input">{{ form.text }}</div>
77 <div class="form-input">{{ form.text }}</div>
78 <div class="form-errors">{{ form.text.errors }}</div>
76 </div>
79 </div>
77 <div class="form-row">
80 <div class="form-row">
78 <div class="form-label">{% trans 'Image' %}</div>
81 <div class="form-label">{% trans 'Image' %}</div>
79 <div class="form-input">{{ form.image }}</div>
82 <div class="form-input">{{ form.image }}</div>
83 <div class="form-errors">{{ form.image.errors }}</div>
80 </div>
84 </div>
81 </div>
85 </div>
82 <div class="form-submit"><input type="submit"
86 <div class="form-submit"><input type="submit"
83 value="{% trans "Post" %}"/></div>
87 value="{% trans "Post" %}"/></div>
84 <div>Use <a
88 <div>Use <a
85 href="http://daringfireball.net/projects/markdown/basics">
89 href="http://daringfireball.net/projects/markdown/basics">
86 markdown</a> syntax for posting.</div>
90 markdown</a> syntax for posting.</div>
87 <div>Example: *<i>italic</i>*, **<b>bold</b>**</div>
91 <div>Example: *<i>italic</i>*, **<b>bold</b>**</div>
88 <div>Insert quotes with "&gt;"</div>
92 <div>Insert quotes with "&gt;"</div>
89 </div>
93 </div>
90 </form>
94 </form>
91
95
92 {% endblock %}
96 {% endblock %}
93
97
94 {% block metapanel %}
98 {% block metapanel %}
95
99
96 <span class="metapanel">
100 <span class="metapanel">
97 {{ posts.0.get_reply_count }} {% trans 'replies' %},
101 {{ posts.0.get_reply_count }} {% trans 'replies' %},
98 {{ posts.0.get_images_count }} {% trans 'images' %}.
102 {{ posts.0.get_images_count }} {% trans 'images' %}.
99 {% trans 'Last update: ' %}{{ posts.0.last_edit_time }}
103 {% trans 'Last update: ' %}{{ posts.0.last_edit_time }}
100 </span>
104 </span>
101
105
102 {% endblock %} No newline at end of file
106 {% endblock %}
General Comments 0
You need to be logged in to leave comments. Login now