generated from Code-Institute-Org/gitpod-full-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
edit_post.html
114 lines (111 loc) · 6.18 KB
/
edit_post.html
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
{% extends "base.html" %}
{% block content %}
<h3 class="center-align blue-grey-text text-lighten-5">Edit Post</h3>
<!-- Self customised code mostly from CI tutorials below -->
<div class="container">
<div class="row card-panel blue-grey lighten-5">
<form class="col s12" method="POST" action="{{ url_for('edit_post', post_id=post._id) }}">
<!-- category selection -->
<div class="row">
<div class="input-field col s12">
<i class="fas fa-folder prefix grey-text text-darken-4"></i>
<select id="category_name" name="category_name" type="text" class="validate" required>
<option value="" disabled>Choose Category</option>
{% for category in categories %}
{% if category.category_name == post.category_name %}
<option value="{{ category.category_name }}" selected>{{ category.category_name }}</option>
{% else %}
<option value="{{ category.category_name }}">{{ category.category_name }}</option>
{% endif %}
{% endfor %}
</select>
<label for="category_name">Category</label>
</div>
</div>
<!-- post title -->
<div class="row">
<div class="input-field col s12">
<i class="fas fa-pencil-alt prefix grey-text text-darken-4"></i>
<input id="title_text" name="title_text" type="text" value="{{ post.title_text }}" minlength="5"
maxlength="50" data-length="50" class="validate" required>
<label for="title_text">Title of your post</label>
</div>
</div>
<!-- post summary -->
<div class="row">
<div class="input-field col s12">
<i class="fas fa-align-justify prefix grey-text text-darken-4"></i>
<textarea id="summary" name="summary" class="materialize-textarea validate" minlength="5"
maxlength="250" data-length="250" required>
{%- for summaryitem in post.summary -%}
{{ summaryitem + '\n' }}
{%- endfor -%}
</textarea>
<label for="summary">Title short description</label>
</div>
</div>
<!-- post body -->
<div class="row">
<div class="input-field col s12">
<i class="fas fa-book-open prefix grey-text text-darken-4"></i>
<textarea id="post_body" name="post_body" class="materialize-textarea validate" minlength="5"
data-length="4000" required>
{%- for body in post.post_body -%}
{{ body + '\n' }}
{%- endfor -%}
</textarea>
<label for="post_body">Write your main text</label>
</div>
</div>
<!-- user contact -->
<div class="row">
<div class="input-field col s12">
<i class="fas fa-at prefix grey-text text-darken-4"></i>
<input id="email" name="email" type="email" value="{{ post.email }}" minlength="5"
maxlength="50" data-length="50" class="validate">
<label for="email">Contact email</label>
</div>
</div>
<!-- image link -->
<div class="row">
<div class="input-field col s12">
<i class="fas fa-image prefix grey-text text-darken-4"></i>
<input id="image_link" name="image_link" type="url" value="{{ post.image_link }}" minlength="5"
maxlength="1000" class="validate" required>
<label for="image_link">Post related image link</label>
</div>
</div>
<!-- image title -->
<div class="row">
<div class="input-field col s12">
<i class="fas fa-pencil-alt prefix grey-text text-darken-4"></i>
<input id="image_title" name="image_title" type="text" value="{{ post.image_title }}" minlength="5"
maxlength="50" data-length="50" class="validate" required>
<label for="image_title">Post related image link</label>
</div>
</div>
<!-- post date -->
<div class="row">
<div class="input-field col s12">
<i class="fas fa-calendar-alt prefix grey-text text-darken-4"></i>
<input id="date_post" name="date_post" type="text" value="{{ post.date_post }}" class="datepicker validate" required>
<label for="date_post">Date</label>
</div>
</div>
<!-- submit button -->
<div class="row">
<div class="col s12 center-align">
<button type="submit" class="max-width waves-effect waves-light btn-large blue-grey-text text-lighten-5 grey darken-2 z-depth-3">
<i class="fas fa-paper-plane"></i>
Edit Post
</button>
<a href="{{ url_for('get_posts') }}"
class="max-width cancel-btn waves-effect waves-light btn-large blue-grey-text text-lighten-5 z-depth-3">
Cancel <i class="fas fa-times-circle"></i>
</a>
</div>
</div>
</form>
</div>
</div>
{% endblock %}