Added MDE (issue #4)

This commit is contained in:
2017-09-15 13:56:24 +07:00
parent 0f011f2545
commit ec548a46b7
21 changed files with 4351 additions and 44 deletions

View File

@@ -13,7 +13,7 @@
<div class="stack">
<label>Dibuat pada: </label>
<span>
{{ post.created_at }}
{{ post.created_at|date("d-m-Y") }}
</span>
</div>
<div class="stack">
@@ -28,7 +28,7 @@
{% if post.edited_at is empty %}
-
{% else %}
{{ post.edited_at }}
{{ post.edited_at|date("d-m-Y") }}
{% endif %}
</span>
<input type="hidden" name="edited_at" value="{{ timestamp }}">
@@ -84,7 +84,7 @@
<label for="content">Konten: </label>
</div>
<div class="stack">
<textarea name="content" rows="3" maxlength="255">{{ post.content }}</textarea>
<textarea id="smde" name="content" rows="3" maxlength="255">{{ post.content }}</textarea>
</div>
<input type="hidden" name="old_content" value="{{ post.content }}">
</div>
@@ -94,9 +94,9 @@
<label for="valid_at">Berlaku dari: </label>
</div>
<div class="stack">
<input id="left" name="valid_at" value="{{ post.valid_at }}">
<input id="left" name="valid_at" value="{{ post.valid_at|date("d-m-Y") }}">
</div>
<input type="hidden" name="old_valid_at" value="{{ post.valid_at }}">
<input type="hidden" name="old_valid_at" value="{{ post.valid_at|date("d-m-Y") }}">
</div>
<div class="stack">
@@ -104,16 +104,13 @@
<label for="expired_at">Berlaku sampai: </label>
</div>
<div class="stack">
<input id="right" name="expired_at" value="{{ post.expired_at }}">
<input id="right" name="expired_at" value="{{ post.expired_at|date("d-m-Y") }}">
</div>
<input type="hidden" name="old_expired_at" value="{{ post.expired_at }}">
<input type="hidden" name="old_expired_at" value="{{ post.expired_at|date("d-m-Y") }}">
</div>
<!-- Current Timestamp -->
<input type="hidden" name="_currts" value="{{ timestamp }}" disabled>
<!-- Method -->
<input type="hidden" name="_method" value="put">
<!-- Token -->
<input type="hidden" name="_token" value="{{ token }}">
<div class="off-four-fifth-600 full">
@@ -122,31 +119,12 @@
disabled
{% endif %}>
<i class="fa fa-edit fa-fw" aria-hidden="true"></i>
<span style="font-size:smaller;">Ubah</span>
</button>
</div>
</div>
</div>
</form>
{% if (post.status == 1 and editor_now.id == creator.id) %}
<div class="flex five grow">
<div class="off-two-fifth-600">
<form method="post">
<input type="hidden" name="id" value="{{ post.id }}">
<!-- Method -->
<input type="hidden" name="_method" value="delete">
<!-- Token -->
<input type="hidden" name="_token" value="{{ token }}">
<div class="off-four-fifth-600 full">
<button type="submit" class="error fifth">
<i class="fa fa-times-circle-o fa-fw" aria-hidden="true"></i>
</button>
</div>
</form>
</div>
</div>
{% endif %}
</section>
</main>
@@ -159,5 +137,7 @@
dateValidator: rome.val.afterEq(left),
time: false
});
var simplemde = new SimpleMDE({ element: document.getElementById("smde") });
</script>
{% endblock %}

View File

@@ -5,11 +5,10 @@
{% block body %}
<main class="documentation">
<section>
<h2>Tambah Pengumuman</h2>
<form method="post">
<h2>Tambah Pengumuman</h2>
<div class="flex three grow">
<div class="full third-600">
<label for="category">Kategori</label>
<select name="category">
{% for cat in categories %}
@@ -32,24 +31,22 @@
<div class="full two-third-600">
<label for="content">Konten: </label>
<textarea name="content" rows="2" cols="30" maxlength="255"></textarea>
<textarea id="smde" name="content" maxlength="255"></textarea>
</div>
<input type="hidden" name="creator" value="{{ user }}">
<!-- Current 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 }}">
<br>
<button type="submit">
<button type="submit" class="pseudo">
<i class="fa fa-check fa-fw"></i>
<span style="font-size:smaller;">Unggah</span>
</button>
</div>
</form>
@@ -65,5 +62,7 @@
dateValidator: rome.val.afterEq(left),
time: false
});
var simplemde = new SimpleMDE({ element: document.getElementById("smde") });
</script>
{% endblock %}

View File

@@ -32,7 +32,7 @@
{% for post in posts %}
<div data-slidr="{{ post.id }}" style="width: 100%;">
<div class="fitty" style="padding: 0 5rem">
{{ post.content | raw }}
{{ post.content|rendermd }}
</div>
</div>
{% endfor %}
@@ -55,8 +55,8 @@
{% for post in posts %}
<div class="fourth-900 half-600 card box">
<span class="stack" style="font-size:smaller;color:rgba(17,17,17,.4);margin-bottom:.6em;">[{{ post.valid_at }} - {{ post.expired_at }}]</span>
<span class="stack">{{ post.content }}</span>
<span class="stack" style="font-size:smaller;color:rgba(17,17,17,.4);margin-bottom:.6em;">[{{ post.valid_at|date("d/m/Y") }} - {{ post.expired_at|date("d/m/Y") }}]</span>
<span class="stack">{{ post.content|rendermd }}</span>
<form method="post">
<footer class="flex full grow">
{% if post.status != 0 %}