##// END OF EJS Templates
Added a compact form to the thread.
neko259 -
r676:3550bfce default
parent child Browse files
Show More
@@ -37,7 +37,7 b''
37 }
37 }
38 }
38 }
39
39
40 #id_image {
40 input[name="image"] {
41 display: block;
41 display: block;
42 width: 100px;
42 width: 100px;
43 height: 100px;
43 height: 100px;
@@ -51,6 +51,8 b''
51 width: 100px;
51 width: 100px;
52 height: 100px;
52 height: 100px;
53 border: solid 1px white;
53 border: solid 1px white;
54 display: inline-block;
55 float: left;
54 }
56 }
55
57
56 #file-thumb {
58 #file-thumb {
@@ -59,3 +61,13 b''
59 background-size: cover;
61 background-size: cover;
60 background-position: center;
62 background-position: center;
61 }
63 }
64
65 .compact-form-text {
66 margin-left:110px;
67 }
68
69 textarea {
70 -moz-box-sizing: border-box;
71 -webkit-box-sizing: border-box;
72 box-sizing: border-box;
73 } No newline at end of file
@@ -154,19 +154,19 b' p {'
154 color: #fff;
154 color: #fff;
155 border: solid 1px;
155 border: solid 1px;
156 padding: 0;
156 padding: 0;
157 width: 100%;
158 font: medium sans;
157 font: medium sans;
159 }
158 }
160
159
161 .form-submit {
160 .form-submit {
162 display: table;
161 display: table;
163 margin-bottom: 1ex;
162 margin-bottom: 1ex;
163 margin-top: 1ex;
164 }
164 }
165
165
166 .form-title {
166 .form-title {
167 font-weight: bold;
167 font-weight: bold;
168 font-size: 2.5ex;
168 font-size: 2ex;
169 text-decoration: underline;
169 margin-bottom: 0.5ex;
170 }
170 }
171
171
172 input[type="submit"] {
172 input[type="submit"] {
@@ -88,12 +88,6 b' li {'
88 padding: 1ex;
88 padding: 1ex;
89 }
89 }
90
90
91 #form {
92 display: table;
93 border-collapse: collapse;
94 width: 100%;
95 }
96
97 .form-row {
91 .form-row {
98 display: table-row;
92 display: table-row;
99 }
93 }
@@ -356,4 +350,9 b' li {'
356
350
357 .gallery_image_metadata {
351 .gallery_image_metadata {
358 margin-bottom: 1em;
352 margin-bottom: 1em;
353 }
354
355 .swappable-form-full > form {
356 display: table;
357 width: 100%;
359 } No newline at end of file
358 }
@@ -1,10 +1,8 b''
1 $('#id_image').parent().append(
1 var isCompact = true;
2 $('<div/>', {
3 id: 'file_wrap'
4 }).append($('#id_image'))
5 );
6
2
7 $('body').on('change', '#id_image', function(event) {
3 $('input[name=image]').wrap($('<div id="file_wrap"></div>'));
4
5 $('body').on('change', 'input[name=image]', function(event) {
8 var file = event.target.files[0];
6 var file = event.target.files[0];
9
7
10 if(file.type.match('image.*')) {
8 if(file.type.match('image.*')) {
@@ -20,3 +18,24 b''
20 fileReader.readAsDataURL(file);
18 fileReader.readAsDataURL(file);
21 }
19 }
22 });
20 });
21
22 var compactForm = $('.swappable-form-compact');
23 var fullForm = $('.swappable-form-full');
24
25 function swapForm() {
26 compactForm.toggle();
27 fullForm.toggle();
28
29 if (isCompact) {
30 var oldText = compactForm.find('textarea')[0].value;
31 fullForm.find('textarea')[0].value = oldText;
32 } else {
33 var oldText = fullForm.find('textarea')[0].value;
34 compactForm.find('textarea')[0].value = oldText;
35 }
36 isCompact = !isCompact;
37 }
38
39 if (compactForm.length > 0) {
40 fullForm.toggle();
41 } No newline at end of file
@@ -51,4 +51,4 b' function addQuickReply(postId) {'
51 $("html, body").animate({ scrollTop: $(textAreaId).offset().top }, "slow");
51 $("html, body").animate({ scrollTop: $(textAreaId).offset().top }, "slow");
52 }
52 }
53
53
54 $('form').toggle();
54 $('#full-form').toggle();
@@ -130,12 +130,14 b''
130 <script src="{% static 'js/panel.js' %}"></script>
130 <script src="{% static 'js/panel.js' %}"></script>
131 <div class="post-form">
131 <div class="post-form">
132 <div class="form-title">{% trans "Create new thread" %}</div>
132 <div class="form-title">{% trans "Create new thread" %}</div>
133 <div class="swappable-form-full">
133 <form enctype="multipart/form-data" method="post">{% csrf_token %}
134 <form enctype="multipart/form-data" method="post">{% csrf_token %}
134 {{ form.as_div }}
135 {{ form.as_div }}
135 <div class="form-submit">
136 <div class="form-submit">
136 <input type="submit" value="{% trans "Post" %}"/>
137 <input type="submit" value="{% trans "Post" %}"/>
137 </div>
138 </div>
138 </form>
139 </form>
140 </div>
139 <div>
141 <div>
140 {% trans 'Tags must be delimited by spaces. Text or image is required.' %}
142 {% trans 'Tags must be delimited by spaces. Text or image is required.' %}
141 </div>
143 </div>
@@ -47,17 +47,34 b''
47
47
48 <div class="post-form-w" id="form">
48 <div class="post-form-w" id="form">
49 <script src="{% static 'js/panel.js' %}"></script>
49 <script src="{% static 'js/panel.js' %}"></script>
50 <div class="form-title"
50 <div class="form-title">{% trans "Reply to thread" %} #{{ opening_post.id }}</div>
51 onclick="$('form').toggle();"
51 <div class="post-form" id="compact-form">
52 >{% trans "Reply to thread" %} #{{ opening_post.id }}</div>
52 <div class="swappable-form-compact">
53 <div class="post-form">
54 <form enctype="multipart/form-data" method="post"
53 <form enctype="multipart/form-data" method="post"
55 >{% csrf_token %}
54 >{% csrf_token %}
56 {{ form.as_div }}
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>
57 <div class="form-submit">
61 <div class="form-submit">
58 <input type="submit" value="{% trans "Post" %}"/>
62 <input type="submit" value="{% trans "Post" %}"/>
59 </div>
63 </div>
60 </form>
64 </form>
65 </div>
66 <div class="swappable-form-full">
67 <form enctype="multipart/form-data" method="post"
68 >{% csrf_token %}
69 {{ form.as_div }}
70 <div class="form-submit">
71 <input type="submit" value="{% trans "Post" %}"/>
72 </div>
73 </form>
74 </div>
75 <a onclick="swapForm(); return false;" href="#">
76 {% trans 'Switch mode' %}
77 </a>
61 <div><a href="{% url "staticpage" name="help" %}">
78 <div><a href="{% url "staticpage" name="help" %}">
62 {% trans 'Text syntax' %}</a></div>
79 {% trans 'Text syntax' %}</a></div>
63 </div>
80 </div>
General Comments 0
You need to be logged in to leave comments. Login now