aboutsummaryrefslogtreecommitdiff
path: root/templates/posts/edit.django
blob: 93d582da90686aef02a4e387f89df0a7f768c881 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
{% extends 'layouts/main.django' %}
{% block content %}
  <div class="edit-post">
    <div class="edit-main">
      {% if Post.Title %}
        <h1 class="post-title">{{ Post.Title }}</h1>
      {% else %}
        <h1 class="post-title">Post #{{ Post.ID }}</h1>
      {% endif %}
      <form action="/posts/{{ Post.ID }}/edit" method="post" class="ibform">
        {% if Error %}
          <div class="error">{{ Error }}</div>
        {% endif %}
        <div class="fgroup">
          <div class="fg-main">
            <label for="title">Title</label>
          </div>
          <div class="fg-sub">
            <input type="text" class="itext" id="title" name="title" value="{{ Post.Title }}" placeholder="e.g., My Awesome Post" />
            <small>Optional title for the post. If left empty, the post will be titled "Post #{{ Post.ID }}".</small>
          </div>
        </div>
        <div class="fgroup">
          <div class="fg-main">
            <label for="description">Description</label>
          </div>
          <div class="fg-sub">
            <textarea id="description" name="description" class="itextarea" placeholder="Describe your post here..." rows="6">{{ Post.Description }}</textarea>
            <small>Optional description for the post. This can be used to provide more context or details about the content of the post. <a href="/help/syntax" target="_blank">Learn more about syntax</a>.</small>
          </div>
        </div>
        <div class="fgroup">
          <div class="fg-main">
            <label for="source_url">SourceURL</label>
          </div>
          <div class="fg-sub">
            <input type="url" class="itext" id="source_url" name="source_url" value="{{ Post.SourceURL }}" placeholder="https://example.com/source" />
          </div>
        </div>
        <div class="fgroup">
          <div class="fg-main">
            <label>Rating</label>
          </div>
          <div class="fg-sub-radio">
            {% if 'Safe' in Post.Rating %}
              <input type="radio" id="rating-safe" name="rating" value="Safe" checked />
            {% else %}
              <input type="radio" id="rating-safe" name="rating" value="Safe" />
            {% endif %}
            <label for="rating-safe">Safe</label>
            {% if 'Sensitive' in Post.Rating %}
              <input type="radio" id="rating-sensitive" name="rating" value="Sensitive" checked />
            {% else %}
              <input type="radio" id="rating-sensitive" name="rating" value="Sensitive" />
            {% endif %}
            <label for="rating-sensitive">Sensitive</label>
            {% if 'Questionable' in Post.Rating %}
              <input type="radio" id="rating-questionable" name="rating" value="Questionable" checked />
            {% else %}
              <input type="radio" id="rating-questionable" name="rating" value="Questionable" />
            {% endif %}
            <label for="rating-questionable">Questionable</label>
            {% if 'Explicit' in Post.Rating %}
              <input type="radio" id="rating-explicit" name="rating" value="Explicit" checked />
            {% else %}
              <input type="radio" id="rating-explicit" name="rating" value="Explicit" />
            {% endif %}
            <label for="rating-explicit">Explicit</label>
          </div>
        </div>
        {% if User.CanApprovePosts %}
          <div class="fgroup">
            <div class="fg-main">
              <label for="is_approved">Is Approved</label>
            </div>
            <div class="fg-sub-radio">
              {% if Post.IsApproved %}
                <input type="checkbox" id="is_approved" name="is_approved" value="1" checked="checked" />
              {% else %}
                <input type="checkbox" id="is_approved" name="is_approved" value="1" />
              {% endif %}
              <label for="is_approved"><small>Mark this post as approved. Approved posts won't be deleted after 3 days.</small></label>
            </div>
          </div>
        {% endif %}
        {% if User.CanDeletePosts %}
          <div class="fgroup">
            <div class="fg-main">
              <label for="is_deleted">Is Deleted</label>
            </div>
            <div class="fg-sub-radio">
              {% if Post.IsDeleted %}
                <input type="checkbox" id="is_deleted" name="is_deleted" value="1" checked="checked" />
              {% else %}
                <input type="checkbox" id="is_deleted" name="is_deleted" value="1" />
              {% endif %}
              <label for="is_deleted"><small>Mark this post as deleted. Deleted posts are hidden from public view.</small></label>
            </div>
          </div>
        {% endif %}
        {% if User.IsAdmin %}
          <div class="fgroup">
            <div class="fg-main">
              <label for="uploader">Uploader</label>
            </div>
            <div class="fg-sub">
              <select id="uploader" name="uploader">
                {% for u in Users %}
                  {% if u.ID == Post.UploaderID %}
                    <option value="{{ u.ID }}" selected>{{ u.Username }}</option>
                  {% else %}
                    <option value="{{ u.ID }}">{{ u.Username }}</option>
                  {% endif %}
                {% endfor %}
              </select>
            </div>
          </div>
          <div class="fgroup">
            <div class="fg-main">
              <label for="approver">Approver</label>
            </div>
            <div class="fg-sub">
              <select id="approver" name="approver">
                {% if not Post.ApproverID %}
                  <option value="0" selected>---</option>
                {% else %}
                  <option value="0">---</option>
                {% endif %}
                {% for a in Approvers %}
                  {% if a.ID == Post.ApproverID %}
                    <option value="{{ a.ID }}" selected>{{ a.Username }}</option>
                  {% else %}
                    <option value="{{ a.ID }}">{{ a.Username }}</option>
                  {% endif %}
                {% endfor %}
              </select>
            </div>
          </div>
        {% endif %}
        <input type="hidden" name="next" value="{{ Request.Path }}" />
        <input type="submit" value="Save Changes" style="margin-top: 8px;" />
      </form>
      <h1>Tags</h1>
      <div class="tag-list">
        <div class="post-detail-item">
          <span class="post-detail-label">General Tags:</span>
          <span class="post-detail-value">
            {% if PostTags.general|length > 0 %}
              {% for tag in PostTags.general %}
                <a href="/tags/{{ tag.Name }}" style="color: {{ tag.Type.Color }};">{{ tag.Name }}</a>
              {% endfor %}
            {% else %}
              <span class="no-tags">No general tags</span>
            {% endif %}
          </span>
        </div>
        <input type="text" id="general-tag-input" class="itext" placeholder="Add general tag" />
        <button type="button" id="add-general-tag" class="ib-button">Add</button>
      </div>
    </div>
    <div class="edit-sidebar">
      <img src="{{ CDNURL }}/thumbnail/{{ Post.FileName }}" alt="{{ Post.Title }}" width="{{ Post.Sizes.1.Width }}" height="{{ Post.Sizes.1.Height }}" />
      <div class="post-detail-item">
        <span class="post-detail-label">ID:</span>
        <span class="post-detail-value">{{ Post.ID }}</span>
      </div>
      <div class="post-detail-item">
        <span class="post-detail-label">Uploader:</span>
        <span class="post-detail-value"><a href="/u/{{ Post.Uploader.Username }}">{{ Post.Uploader.Username }}</a></span>
      </div>
      <div class="post-detail-item">
        <span class="post-detail-label">Approver:</span>
        {% if Post.Approver.ID %}
          <span class="post-detail-value"><a href="/u/{{ Post.Approver.Username }}">{{ Post.Approver.Username }}</a></span>
        {% else %}
          {% if Post.IsApproved %}
            <span class="post-detail-value">N/A</span>
          {% else %}
            <span class="post-detail-value">Not Approved</span>
          {% endif %}
        {% endif %}
      </div>
      <div class="post-detail-item">
        <span class="post-detail-label">Filename:</span>
        <span class="post-detail-value">{{ Post.FileName }}</span>
      </div>
      <div class="post-detail-item">
        <span class="post-detail-label">Type:</span>
        <span class="post-detail-value">{{ Post.ContentType }}</span>
      </div>
      <div class="post-detail-item">
        <span class="post-detail-label">MD5:</span>
        <span class="post-detail-value">{{ Post.MD5Hash }}</span>
      </div>
      <div class="post-detail-item">
        <span class="post-detail-label">ViewCount:</span>
        <span class="post-detail-value">{{ Post.ViewCount }}</span>
      </div>
      <div class="post-detail-item">
        <span class="post-detail-label">Favourites:</span>
        <span class="post-detail-value post-favourite-actions">{{ Post.FavouriteCount }}</span>
      </div>
      <div class="post-detail-item">
        <span class="post-detail-label">Comments:</span>
        <span class="post-detail-value">{{ Post.CommentCount }}</span>
      </div>
    </div>
  </div>
{% endblock %}