##// END OF EJS Templates
When swapping the form view, move elements of one form instead of swapping 2...
neko259 -
r698:9dc8a37d 1.8-dev
parent child Browse files
Show More
@@ -73,4 +73,9 b' textarea, input {'
73 -moz-box-sizing: border-box;
73 -moz-box-sizing: border-box;
74 -webkit-box-sizing: border-box;
74 -webkit-box-sizing: border-box;
75 box-sizing: border-box;
75 box-sizing: border-box;
76 } No newline at end of file
76 }
77
78 .compact-form-text > textarea {
79 height: 100px;
80 width: 100%;
81 }
@@ -1,4 +1,4 b''
1 var isCompact = true;
1 var isCompact = false;
2
2
3 $('input[name=image]').wrap($('<div class="file_wrap"></div>'));
3 $('input[name=image]').wrap($('<div class="file_wrap"></div>'));
4
4
@@ -21,25 +21,25 b' var isCompact = true;'
21 }
21 }
22 });
22 });
23
23
24 var compactForm = $('.swappable-form-compact');
25 var fullForm = $('.swappable-form-full');
24 var fullForm = $('.swappable-form-full');
26
25
27 function swapForm() {
26 function swapForm() {
28 compactForm.toggle();
29 fullForm.toggle();
30
31 if (isCompact) {
27 if (isCompact) {
32 var oldText = compactForm.find('textarea')[0].value;
28 // TODO Use IDs (change the django form code) instead of absolute numbers
33 fullForm.find('textarea')[0].value = oldText;
29 fullForm.find('textarea').appendTo(fullForm.find('.form-row')[4]);
30 fullForm.find('.file_wrap').appendTo(fullForm.find('.form-row')[7]);
31 fullForm.find('.form-row').show();
34 } else {
32 } else {
35 var oldText = fullForm.find('textarea')[0].value;
33 fullForm.find('textarea').appendTo($('.compact-form-text'));
36 compactForm.find('textarea')[0].value = oldText;
34 fullForm.find('.file_wrap').insertBefore($('.compact-form-text'));
35 fullForm.find('.form-row').hide();
36 fullForm.find('input[type=text]').val('');
37 }
37 }
38 isCompact = !isCompact;
38 isCompact = !isCompact;
39
39
40 scrollToBottom();
40 scrollToBottom();
41 }
41 }
42
42
43 if (compactForm.length > 0) {
43 $(document).ready(function() {
44 fullForm.toggle();
44 swapForm();
45 }
45 })
@@ -49,23 +49,10 b''
49 <script src="{% static 'js/panel.js' %}"></script>
49 <script src="{% static 'js/panel.js' %}"></script>
50 <div class="form-title">{% trans "Reply to thread" %} #{{ opening_post.id }}</div>
50 <div class="form-title">{% trans "Reply to thread" %} #{{ opening_post.id }}</div>
51 <div class="post-form" id="compact-form">
51 <div class="post-form" id="compact-form">
52 <div class="swappable-form-compact">
53 <form enctype="multipart/form-data" method="post"
54 >{% csrf_token %}
55 <input type="file" name="image" accept="image/*"/>
56 <div class="compact-form-text">
57 <textarea name="text" style="height: 100px;
58 width: 100%;
59 "></textarea>
60 </div>
61 <div class="form-submit">
62 <input type="submit" value="{% trans "Post" %}"/>
63 </div>
64 </form>
65 </div>
66 <div class="swappable-form-full">
52 <div class="swappable-form-full">
67 <form enctype="multipart/form-data" method="post"
53 <form enctype="multipart/form-data" method="post"
68 >{% csrf_token %}
54 >{% csrf_token %}
55 <div class="compact-form-text"></div>
69 {{ form.as_div }}
56 {{ form.as_div }}
70 <div class="form-submit">
57 <div class="form-submit">
71 <input type="submit" value="{% trans "Post" %}"/>
58 <input type="submit" value="{% trans "Post" %}"/>
General Comments 0
You need to be logged in to leave comments. Login now