##// END OF EJS Templates
Allow resetting form manually
neko259 -
r1880:3ff4ab75 default
parent child Browse files
Show More
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -483,8 +483,8 b' msgid "to message "'
483 msgstr "на сообщение"
483 msgstr "на сообщение"
484
484
485 #: templates/boards/thread_normal.html:59
485 #: templates/boards/thread_normal.html:59
486 msgid "Close form"
486 msgid "Reset form"
487 msgstr "Закрыть форму"
487 msgstr "Сбросить форму"
488
488
489 #: templates/search/search.html:17
489 #: templates/search/search.html:17
490 msgid "Ok"
490 msgid "Ok"
@@ -93,10 +93,6 b' textarea, input {'
93 cursor: pointer;
93 cursor: pointer;
94 }
94 }
95
95
96 #form-close-button {
97 display: none;
98 }
99
100 .post-image-full {
96 .post-image-full {
101 width: 100%;
97 width: 100%;
102 height: auto;
98 height: auto;
@@ -23,7 +23,6 b''
23 for the JavaScript code in this page.
23 for the JavaScript code in this page.
24 */
24 */
25
25
26 var CLOSE_BUTTON = '#form-close-button';
27 var REPLY_TO_MSG = '.reply-to-message';
26 var REPLY_TO_MSG = '.reply-to-message';
28 var REPLY_TO_MSG_ID = '#reply-to-message-id';
27 var REPLY_TO_MSG_ID = '#reply-to-message-id';
29
28
@@ -38,11 +37,23 b' function getForm() {'
38 return $('.post-form-w');
37 return $('.post-form-w');
39 }
38 }
40
39
41 function resetFormPosition() {
40 /**
41 * Clear all entered values in the form fields
42 */
43 function resetForm() {
42 var form = getForm();
44 var form = getForm();
45
46 form.find('input:text, input:password, input:file, select, textarea').val('');
47 form.find('input:radio, input:checkbox').removeAttr('checked').removeAttr('selected');
48 $('.file_wrap').find('.file-thumb').remove();
49 $('#preview-text').hide();
50
51 resetFormPosition(form);
52 }
53
54 function resetFormPosition(form) {
43 form.insertAfter($('.thread'));
55 form.insertAfter($('.thread'));
44
56
45 $(CLOSE_BUTTON).hide();
46 $(REPLY_TO_MSG).hide();
57 $(REPLY_TO_MSG).hide();
47 }
58 }
48
59
@@ -50,7 +61,6 b' function showFormAfter(blockToInsertAfte'
50 var form = getForm();
61 var form = getForm();
51 form.insertAfter(blockToInsertAfter);
62 form.insertAfter(blockToInsertAfter);
52
63
53 $(CLOSE_BUTTON).show();
54 form.show();
64 form.show();
55 $(REPLY_TO_MSG_ID).text(blockToInsertAfter.attr('id'));
65 $(REPLY_TO_MSG_ID).text(blockToInsertAfter.attr('id'));
56 $(REPLY_TO_MSG).show();
66 $(REPLY_TO_MSG).show();
@@ -264,16 +264,6 b' function showNewPostsTitle(newPostCount)'
264 }
264 }
265 }
265 }
266
266
267 /**
268 * Clear all entered values in the form fields
269 */
270 function resetForm(form) {
271 form.find('input:text, input:password, input:file, select, textarea').val('');
272 form.find('input:radio, input:checkbox')
273 .removeAttr('checked').removeAttr('selected');
274 $('.file_wrap').find('.file-thumb').remove();
275 $('#preview-text').hide();
276 }
277
267
278 /**
268 /**
279 * When the form is posted, this method will be run as a callback
269 * When the form is posted, this method will be run as a callback
@@ -286,8 +276,7 b' function updateOnPost(response, statusTe'
286 $('.post-form-w').unblock();
276 $('.post-form-w').unblock();
287
277
288 if (status === 'ok') {
278 if (status === 'ok') {
289 resetFormPosition();
279 resetForm();
290 resetForm(form);
291 getThreadDiff();
280 getThreadDiff();
292 scrollToBottom();
281 scrollToBottom();
293 } else {
282 } else {
@@ -393,7 +382,7 b' function updateNodeAttr(oldNode, newNode'
393
382
394 form.ajaxForm(options);
383 form.ajaxForm(options);
395
384
396 resetForm(form);
385 resetForm();
397 }
386 }
398 }
387 }
399 });
388 });
@@ -66,7 +66,7 b''
66 </div>
66 </div>
67 <div><a href="{% url "staticpage" name="help" %}">
67 <div><a href="{% url "staticpage" name="help" %}">
68 {% trans 'Text syntax' %}</a></div>
68 {% trans 'Text syntax' %}</a></div>
69 <div><a id="form-close-button" href="#" onClick="resetFormPosition(); return false;">{% trans 'Close form' %}</a></div>
69 <div><a href="#" onClick="resetForm(); return false;">{% trans 'Reset form' %}</a></div>
70 </div>
70 </div>
71 </div>
71 </div>
72
72
General Comments 0
You need to be logged in to leave comments. Login now