##// 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
@@ -1,76 +1,81 b''
1 1 .ui-button {
2 2 display: none;
3 3 }
4 4
5 5 .ui-dialog-content {
6 6 padding: 0;
7 7 min-height: 0;
8 8 }
9 9
10 10 .mark_btn {
11 11 cursor: pointer;
12 12 }
13 13
14 14 .img-full {
15 15 position: fixed;
16 16 background-color: #CCC;
17 17 border: 1px solid #000;
18 18 cursor: pointer;
19 19 }
20 20
21 21 .strikethrough {
22 22 text-decoration: line-through;
23 23 }
24 24
25 25 .post_preview {
26 26 z-index: 300;
27 27 position:absolute;
28 28 }
29 29
30 30 .gallery_image {
31 31 display: inline-block;
32 32 }
33 33
34 34 @media print {
35 35 .post-form-w {
36 36 display: none;
37 37 }
38 38 }
39 39
40 40 input[name="image"] {
41 41 display: block;
42 42 width: 100px;
43 43 height: 100px;
44 44 cursor: pointer;
45 45 position: absolute;
46 46 opacity: 0;
47 47 z-index: 1;
48 48 }
49 49
50 50 .file_wrap {
51 51 width: 100px;
52 52 height: 100px;
53 53 border: solid 1px white;
54 54 display: inline-block;
55 55 }
56 56
57 57 form > .file_wrap {
58 58 float: left;
59 59 }
60 60
61 61 .file-thumb {
62 62 width: 100px;
63 63 height: 100px;
64 64 background-size: cover;
65 65 background-position: center;
66 66 }
67 67
68 68 .compact-form-text {
69 69 margin-left:110px;
70 70 }
71 71
72 72 textarea, input {
73 73 -moz-box-sizing: border-box;
74 74 -webkit-box-sizing: border-box;
75 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,45 +1,45 b''
1 var isCompact = true;
1 var isCompact = false;
2 2
3 3 $('input[name=image]').wrap($('<div class="file_wrap"></div>'));
4 4
5 5 $('body').on('change', 'input[name=image]', function(event) {
6 6 var file = event.target.files[0];
7 7
8 8 if(file.type.match('image.*')) {
9 9 var fileReader = new FileReader();
10 10
11 11 fileReader.addEventListener("load", function(event) {
12 12 var wrapper = $('.file_wrap');
13 13
14 14 wrapper.find('.file-thumb').remove();
15 15 wrapper.append(
16 16 $('<div class="file-thumb" style="background-image: url('+event.target.result+')"></div>')
17 17 );
18 18 });
19 19
20 20 fileReader.readAsDataURL(file);
21 21 }
22 22 });
23 23
24 var compactForm = $('.swappable-form-compact');
25 24 var fullForm = $('.swappable-form-full');
26 25
27 26 function swapForm() {
28 compactForm.toggle();
29 fullForm.toggle();
30
31 27 if (isCompact) {
32 var oldText = compactForm.find('textarea')[0].value;
33 fullForm.find('textarea')[0].value = oldText;
28 // TODO Use IDs (change the django form code) instead of absolute numbers
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 32 } else {
35 var oldText = fullForm.find('textarea')[0].value;
36 compactForm.find('textarea')[0].value = oldText;
33 fullForm.find('textarea').appendTo($('.compact-form-text'));
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 38 isCompact = !isCompact;
39 39
40 40 scrollToBottom();
41 41 }
42 42
43 if (compactForm.length > 0) {
44 fullForm.toggle();
45 }
43 $(document).ready(function() {
44 swapForm();
45 })
@@ -1,108 +1,95 b''
1 1 {% extends "boards/base.html" %}
2 2
3 3 {% load i18n %}
4 4 {% load cache %}
5 5 {% load static from staticfiles %}
6 6 {% load board %}
7 7
8 8 {% block head %}
9 9 <title>{{ opening_post.get_title|striptags|truncatewords:10 }}
10 10 - {{ site_name }}</title>
11 11 {% endblock %}
12 12
13 13 {% block content %}
14 14 {% spaceless %}
15 15 {% get_current_language as LANGUAGE_CODE %}
16 16
17 17 {% cache 600 thread_view thread.id thread.last_edit_time moderator LANGUAGE_CODE %}
18 18
19 19 <div class="image-mode-tab">
20 20 <a class="current_mode" href="{% url 'thread' opening_post.id %}">{% trans 'Normal mode' %}</a>,
21 21 <a href="{% url 'thread_mode' opening_post.id 'gallery' %}">{% trans 'Gallery mode' %}</a>
22 22 </div>
23 23
24 24 {% if bumpable %}
25 25 <div class="bar-bg">
26 26 <div class="bar-value" style="width:{{ bumplimit_progress }}%" id="bumplimit_progress">
27 27 </div>
28 28 <div class="bar-text">
29 29 <span id="left_to_limit">{{ posts_left }}</span> {% trans 'posts to bumplimit' %}
30 30 </div>
31 31 </div>
32 32 {% endif %}
33 33
34 34 <div class="thread">
35 35 {% with can_bump=thread.can_bump %}
36 36 {% for post in thread.get_replies %}
37 37 {% if forloop.first %}
38 38 {% post_view post moderator=moderator is_opening=True thread=thread can_bump=can_bump opening_post_id=opening_post.id %}
39 39 {% else %}
40 40 {% post_view post moderator=moderator is_opening=False thread=thread can_bump=can_bump opening_post_id=opening_post.id %}
41 41 {% endif %}
42 42 {% endfor %}
43 43 {% endwith %}
44 44 </div>
45 45
46 46 {% if not thread.archived %}
47 47
48 48 <div class="post-form-w" id="form">
49 49 <script src="{% static 'js/panel.js' %}"></script>
50 50 <div class="form-title">{% trans "Reply to thread" %} #{{ opening_post.id }}</div>
51 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 52 <div class="swappable-form-full">
67 53 <form enctype="multipart/form-data" method="post"
68 54 >{% csrf_token %}
55 <div class="compact-form-text"></div>
69 56 {{ form.as_div }}
70 57 <div class="form-submit">
71 58 <input type="submit" value="{% trans "Post" %}"/>
72 59 </div>
73 60 </form>
74 61 </div>
75 62 <a onclick="swapForm(); return false;" href="#">
76 63 {% trans 'Switch mode' %}
77 64 </a>
78 65 <div><a href="{% url "staticpage" name="help" %}">
79 66 {% trans 'Text syntax' %}</a></div>
80 67 </div>
81 68 </div>
82 69
83 70 <script src="{% static 'js/jquery.form.min.js' %}"></script>
84 71 <script src="{% static 'js/thread_update.js' %}"></script>
85 72 {% endif %}
86 73
87 74 <script src="{% static 'js/form.js' %}"></script>
88 75 <script src="{% static 'js/thread.js' %}"></script>
89 76
90 77 {% endcache %}
91 78
92 79 {% endspaceless %}
93 80 {% endblock %}
94 81
95 82 {% block metapanel %}
96 83
97 84 {% get_current_language as LANGUAGE_CODE %}
98 85
99 86 <span class="metapanel" data-last-update="{{ last_update }}">
100 87 {% cache 600 thread_meta thread.last_edit_time moderator LANGUAGE_CODE %}
101 88 <span id="reply-count">{{ thread.get_reply_count }}</span>/{{ max_replies }} {% trans 'replies' %},
102 89 <span id="image-count">{{ thread.get_images_count }}</span> {% trans 'images' %}.
103 90 {% trans 'Last update: ' %}<span id="last-update">{{ thread.last_edit_time }}</span>
104 91 [<a href="rss/">RSS</a>]
105 92 {% endcache %}
106 93 </span>
107 94
108 95 {% endblock %}
General Comments 0
You need to be logged in to leave comments. Login now