- Function to store and get worked good
- Token works great - Session works great
This commit is contained in:
@@ -4,43 +4,44 @@
|
||||
|
||||
{% block body %}
|
||||
<form method="post">
|
||||
<h3>Pengumuman 1</h3>
|
||||
{% for post in posts %}
|
||||
<h3>Pengumuman {{ post.id }}</h3>
|
||||
|
||||
<label for="category">Kategori: </label>
|
||||
<select name="category">
|
||||
<option value="1" {% if category == 1 %}selected{% endif %}>Category 1</option>
|
||||
<option value="2" {% if category == 2 %}selected{% endif %}>Category 2</option>
|
||||
<option value="3" {% if category == 3 %}selected{% endif %}>Category 3</option>
|
||||
<option value="4" {% if category == 4 %}selected{% endif %}>Category 4</option>
|
||||
{% for cat in categories %}
|
||||
<option value="{{ cat.id }}" {% if post.category == cat.id %}selected{% endif %}>{{ cat.category }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
<br>
|
||||
|
||||
<label for="konten">Konten: </label>
|
||||
<textarea name="konten" rows="3" cols="30">{{ content }}</textarea>
|
||||
<textarea name="konten" rows="3" cols="30">{{ post.content }}</textarea>
|
||||
|
||||
<br>
|
||||
|
||||
<label for="created_at">Dibuat pada: </label>
|
||||
<input type="text" name="created_at" value={{ created_at }} disabled>
|
||||
<input type="text" name="created_at" value="{{ post.created_at }}" readonly>
|
||||
|
||||
<br>
|
||||
|
||||
<label for="creator">Dibuat oleh: </label>
|
||||
<input type="text" name="creator" value="User {{ creator }}" disabled>
|
||||
<input type="text" name="creator" value="{{ post.creator }}" readonly>
|
||||
|
||||
<br>
|
||||
|
||||
<label for="edited_at">Diubah pada: </label>
|
||||
<input type="text" name="edited_at" value={{ edited_at }} disabled>
|
||||
<input type="text" name="edited_at" value="{{ post.edited_at }}" readonly>
|
||||
|
||||
<br>
|
||||
|
||||
<label for="editor">Diubah oleh: </label>
|
||||
<input type="text" name="editor" value="User {{ editor }}" disabled>
|
||||
<input type="text" name="editor" value="{{ post.editor }}" readonly>
|
||||
|
||||
<!-- Current Timestamp -->
|
||||
<input type="hidden" name="_currts" value={{ timestamp }}>
|
||||
<input type="hidden" name="_currts" value="{{ timestamp }}" disabled>
|
||||
{% endfor %}
|
||||
|
||||
<!-- Method -->
|
||||
<input type="hidden" name="_method" value="put">
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<form method="post">
|
||||
<h3>Tambah Pengumuman</h3>
|
||||
|
||||
<label for="kategori">Kategori</label>
|
||||
<select name="kategori">
|
||||
<label for="category">Kategori</label>
|
||||
<select name="category">
|
||||
{% for cat in categories %}
|
||||
<option value="{{ cat.id }}">{{ cat.category }}</option>
|
||||
{% endfor %}
|
||||
@@ -15,20 +15,27 @@
|
||||
|
||||
<br>
|
||||
|
||||
<label for="konten">Konten</label>
|
||||
<textarea name="konten" rows="3" cols="30"></textarea>
|
||||
<label for="expired_at">Berlaku sampai</label>
|
||||
<input type="date" name="expired_at" value="">
|
||||
|
||||
<br>
|
||||
|
||||
<label for="content">Konten</label>
|
||||
<textarea name="content" rows="3" cols="30"></textarea>
|
||||
|
||||
<input type="hidden" name="creator" value="1"> <!-- Nanti diganti user id -->
|
||||
|
||||
<!-- Current Timestamp -->
|
||||
<input type="hidden" name="_currts" value={{ timestamp }}>
|
||||
<input type="hidden" name="_currts" value="{{ timestamp }}" disabled>
|
||||
|
||||
<!-- Method -->
|
||||
<input type="hidden" name="_method" value="post">
|
||||
|
||||
<!-- Token -->
|
||||
<input type="hidden" name="_token" value={{ token }}>
|
||||
<input type="hidden" name="_token" value="{{ token }}">
|
||||
|
||||
<br>
|
||||
|
||||
<button type="submit" name="entry">Entry</button>
|
||||
<button type="submit">Entry</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user