##// END OF EJS Templates
Basic support for the generic forms. Still need to fix some things in the form...
neko259 -
r425:abb0b1c9 default
parent child Browse files
Show More
@@ -27,6 +27,7 b' class NeboardForm(forms.Form):'
27 def as_p(self):
27 def as_p(self):
28 "Returns this form rendered as HTML <p>s."
28 "Returns this form rendered as HTML <p>s."
29 return self._html_output(
29 return self._html_output(
30 # TODO Do not show hidden rows in the list here
30 normal_row='<div class="form-row">'
31 normal_row='<div class="form-row">'
31 '<div class="form-label">'
32 '<div class="form-label">'
32 '%(label)s'
33 '%(label)s'
@@ -36,12 +37,11 b' class NeboardForm(forms.Form):'
36 '</div>'
37 '</div>'
37 '%(help_text)s'
38 '%(help_text)s'
38 '</div>',
39 '</div>',
39 error_row='<div class="form-errors">%s</div>',
40 error_row='<div class="form-row"><div class="form-label"></div><div class="form-errors">%s</div></div>',
40 row_ender='</p>',
41 row_ender='</p>',
41 help_text_html=' <span class="helptext">%s</span>',
42 help_text_html=' <span class="helptext">%s</span>',
42 errors_on_separate_row=True)
43 errors_on_separate_row=True)
43
44
44
45 class PostForm(NeboardForm):
45 class PostForm(NeboardForm):
46
46
47 title = forms.CharField(max_length=TITLE_MAX_LENGTH, required=False,
47 title = forms.CharField(max_length=TITLE_MAX_LENGTH, required=False,
@@ -201,65 +201,23 b''
201 {% else %}
201 {% else %}
202 <div class="post">
202 <div class="post">
203 {% trans 'No threads exist. Create the first one!' %}</div>
203 {% trans 'No threads exist. Create the first one!' %}</div>
204 {% endif %}
204 {% endif %}
205
205
206 <form enctype="multipart/form-data" method="post">{% csrf_token %}
207 <div class="post-form-w">
206 <div class="post-form-w">
208
209 <div class="form-title">{% trans "Create new thread" %}</div>
210 <div class="post-form">
207 <div class="post-form">
211 <div class="form-row">
208 <div class="form-title">{% trans "Create new thread" %}</div>
212 <div class="form-label">{% trans 'Title' %}</div>
209 <form enctype="multipart/form-data" method="post">{% csrf_token %}
213 <div class="form-input">{{ form.title }}</div>
210 {{ form.as_p }}
214 <div class="form-errors">{{ form.title.errors }}</div>
211 <div class="form-submit">
215 </div>
212 <input type="submit" value="{% trans "Post" %}"/></div>
216 <div class="form-row">
213 <div>
217 <div class="form-label">{% trans 'Formatting' %}</div>
214 </form>
218 <div class="form-input" id="mark_panel">
215 {% trans 'Tags must be delimited by spaces. Text or image is required.' %}
219 <span class="mark_btn" id="quote"><span class="quote">&gt;{% trans 'quote' %}</span></span>
220 <span class="mark_btn" id="italic"><i>{% trans 'italic' %}</i></span>
221 <span class="mark_btn" id="bold"><b>{% trans 'bold' %}</b></span>
222 <span class="mark_btn" id="spoiler"><span class="spoiler">{% trans 'spoiler' %}</span></span>
223 <span class="mark_btn" id="comment"><span class="comment">// {% trans 'comment' %}</span></span>
224 </div>
225 </div>
226 <div class="form-row">
227 <div class="form-label">{% trans 'Text' %}</div>
228 <div class="form-input">{{ form.text }}</div>
229 <div class="form-errors">{{ form.text.errors }}</div>
230 </div>
216 </div>
231 <div class="form-row">
217 <div><a href="{% url "staticpage" name="help" %}">
232 <div class="form-label">{% trans 'Image' %}</div>
218 {% trans 'Text syntax' %}</a></div>
233 <div class="form-input">{{ form.image }}</div>
234 <div class="form-errors">{{ form.image.errors }}</div>
235 </div>
236 <div class="form-row">
237 <div class="form-label">{% trans 'Tags' %}</div>
238 <div class="form-input">{{ form.tags }}</div>
239 <div class="form-errors">{{ form.tags.errors }}</div>
240 </div>
241 <div class="form-row form-email">
242 <div class="form-label">{% trans 'e-mail' %}</div>
243 <div class="form-input">{{ form.email }}</div>
244 <div class="form-errors">{{ form.email.errors }}</div>
245 </div>
246 <div class="form-row">
247 {{ form.captcha }}
248 <div class="form-errors">{{ form.captcha.errors }}</div>
249 </div>
250 <div class="form-row">
251 <div class="form-errors">{{ form.other.errors }}</div>
252 </div>
253 </div>
219 </div>
254 <div class="form-submit">
255 <input type="submit" value="{% trans "Post" %}"/></div>
256 <div>
257 {% trans 'Tags must be delimited by spaces. Text or image is required.' %}
258 </div>
259 <div><a href="{% url "staticpage" name="help" %}">
260 {% trans 'Text syntax' %}</a></div>
261 </div>
220 </div>
262 </form>
263
221
264 {% endblock %}
222 {% endblock %}
265
223
@@ -93,56 +93,20 b''
93 </div>
93 </div>
94 {% endcache %}
94 {% endcache %}
95
95
96 <form id="form" enctype="multipart/form-data" method="post"
96 <div class="post-form-w">
97 >{% csrf_token %}
97 <div class="form-title">{% trans "Reply to thread" %} #{{ thread.get_opening_post.id }}</div>
98 <div class="post-form-w">
98 <div class="post-form">
99 <div class="form-title">{% trans "Reply to thread" %} #{{ thread.get_opening_post.id }}</div>
99 <form id="form" enctype="multipart/form-data" method="post"
100 <div class="post-form">
100 >{% csrf_token %}
101 <div class="form-row">
101 {{ form.as_p }}
102 <div class="form-label">{% trans 'Title' %}</div>
102 <div class="form-submit">
103 <div class="form-input">{{ form.title }}</div>
103 <input type="submit" value="{% trans "Post" %}"/>
104 <div class="form-errors">{{ form.title.errors }}</div>
105 </div>
106 <div class="form-row">
107 <div class="form-label">{% trans 'Formatting' %}</div>
108 <div class="form-input" id="mark_panel">
109 <span class="mark_btn" id="quote"><span class="quote">&gt;{% trans 'quote' %}</span></span>
110 <span class="mark_btn" id="italic"><i>{% trans 'italic' %}</i></span>
111 <span class="mark_btn" id="bold"><b>{% trans 'bold' %}</b></span>
112 <span class="mark_btn" id="spoiler"><span class="spoiler">{% trans 'spoiler' %}</span></span>
113 <span class="mark_btn" id="comment"><span class="comment">// {% trans 'comment' %}</span></span>
114 </div>
115 </div>
116 <div class="form-row">
117 <div class="form-label">{% trans 'Text' %}</div>
118 <div class="form-input">{{ form.text }}</div>
119 <div class="form-errors">{{ form.text.errors }}</div>
120 </div>
121 <div class="form-row">
122 <div class="form-label">{% trans 'Image' %}</div>
123 <div class="form-input">{{ form.image }}</div>
124 <div class="form-errors">{{ form.image.errors }}</div>
125 </div>
126 <div class="form-row form-email">
127 <div class="form-label">{% trans 'e-mail' %}</div>
128 <div class="form-input">{{ form.email }}</div>
129 <div class="form-errors">{{ form.email.errors }}</div>
130 </div>
131 <div class="form-row">
132 {{ form.captcha }}
133 <div class="form-errors">{{ form.captcha.errors }}</div>
134 </div>
135 <div class="form-row">
136 <div class="form-errors">{{ form.other.errors }}</div>
137 </div>
138 </div>
104 </div>
139
105 </form>
140 <div class="form-submit"><input type="submit"
106 <div><a href="{% url "staticpage" name="help" %}">
141 value="{% trans "Post" %}"/></div>
107 {% trans 'Text syntax' %}</a></div>
142 <div><a href="{% url "staticpage" name="help" %}">
143 {% trans 'Text syntax' %}</a></div>
144 </div>
108 </div>
145 </form>
109 </div>
146
110
147 {% endspaceless %}
111 {% endspaceless %}
148 {% endblock %}
112 {% endblock %}
General Comments 0
You need to be logged in to leave comments. Login now