From ec548a46b7528450fd3977312d860d10b1140523 Mon Sep 17 00:00:00 2001 From: Gregorio Chiko Putra Date: Fri, 15 Sep 2017 13:56:24 +0700 Subject: [PATCH] Added MDE (issue #4) --- App/Controllers/Posts.php | 5 +- App/Views/Data/edit_pengumuman.html | 40 +- App/Views/Data/entry_pengumuman.html | 13 +- App/Views/Data/pengumuman.html | 6 +- App/Views/base.html | 6 + Core/View.php | 11 +- public/css/simplemde.min.css | 7 + public/js/simplemde.min.js | 15 + vendor/composer/autoload_namespaces.php | 1 + vendor/composer/autoload_static.php | 7 + vendor/composer/installed.json | 53 + vendor/michelf/php-markdown/License.md | 36 + .../php-markdown/Michelf/Markdown.inc.php | 10 + .../michelf/php-markdown/Michelf/Markdown.php | 1896 +++++++++++++++++ .../Michelf/MarkdownExtra.inc.php | 11 + .../php-markdown/Michelf/MarkdownExtra.php | 1785 ++++++++++++++++ .../Michelf/MarkdownInterface.inc.php | 9 + .../Michelf/MarkdownInterface.php | 38 + vendor/michelf/php-markdown/Readme.md | 384 ++++ vendor/michelf/php-markdown/Readme.php | 31 + vendor/michelf/php-markdown/composer.json | 31 + 21 files changed, 4351 insertions(+), 44 deletions(-) create mode 100644 public/css/simplemde.min.css create mode 100644 public/js/simplemde.min.js create mode 100644 vendor/michelf/php-markdown/License.md create mode 100644 vendor/michelf/php-markdown/Michelf/Markdown.inc.php create mode 100644 vendor/michelf/php-markdown/Michelf/Markdown.php create mode 100644 vendor/michelf/php-markdown/Michelf/MarkdownExtra.inc.php create mode 100644 vendor/michelf/php-markdown/Michelf/MarkdownExtra.php create mode 100644 vendor/michelf/php-markdown/Michelf/MarkdownInterface.inc.php create mode 100644 vendor/michelf/php-markdown/Michelf/MarkdownInterface.php create mode 100644 vendor/michelf/php-markdown/Readme.md create mode 100644 vendor/michelf/php-markdown/Readme.php create mode 100644 vendor/michelf/php-markdown/composer.json diff --git a/App/Controllers/Posts.php b/App/Controllers/Posts.php index d099c7c..adb73d4 100644 --- a/App/Controllers/Posts.php +++ b/App/Controllers/Posts.php @@ -8,6 +8,7 @@ use \Core\Token; use \Core\Session; use \Core\Redirect; use \Core\XSS; +use \Michelf\Markdown; class Posts { @@ -120,7 +121,7 @@ class Posts { if (Session::exists('userid')) { $date = new \DateTime(); - $now = $date->format("Y-m-d"); + $now = $date->format("d-m-Y"); $get_categories = $this->model->showAll([], 'kategori'); $categories = []; @@ -187,7 +188,7 @@ class Posts ], $table); $date = new \DateTime(); - $timestamp = $date->format("Y-m-d"); + $timestamp = $date->format("d-m-Y"); View::render( 'Data/edit_pengumuman.html', diff --git a/App/Views/Data/edit_pengumuman.html b/App/Views/Data/edit_pengumuman.html index 4275c97..04e4e1c 100644 --- a/App/Views/Data/edit_pengumuman.html +++ b/App/Views/Data/edit_pengumuman.html @@ -13,7 +13,7 @@
- {{ post.created_at }} + {{ post.created_at|date("d-m-Y") }}
@@ -28,7 +28,7 @@ {% if post.edited_at is empty %} - {% else %} - {{ post.edited_at }} + {{ post.edited_at|date("d-m-Y") }} {% endif %} @@ -84,7 +84,7 @@
- +
@@ -94,9 +94,9 @@
- +
- +
@@ -104,16 +104,13 @@
- +
- + - - -
@@ -122,31 +119,12 @@ disabled {% endif %}> + Ubah
- - {% if (post.status == 1 and editor_now.id == creator.id) %} -
-
-
- - - - - - -
- -
-
-
-
- {% endif %} @@ -159,5 +137,7 @@ dateValidator: rome.val.afterEq(left), time: false }); + + var simplemde = new SimpleMDE({ element: document.getElementById("smde") }); {% endblock %} diff --git a/App/Views/Data/entry_pengumuman.html b/App/Views/Data/entry_pengumuman.html index ab673ad..e27d7d7 100644 --- a/App/Views/Data/entry_pengumuman.html +++ b/App/Views/Data/entry_pengumuman.html @@ -5,11 +5,10 @@ {% block body %}
+

Tambah Pengumuman

-

Tambah Pengumuman

- +
- - -
-
@@ -65,5 +62,7 @@ dateValidator: rome.val.afterEq(left), time: false }); + + var simplemde = new SimpleMDE({ element: document.getElementById("smde") }); {% endblock %} diff --git a/App/Views/Data/pengumuman.html b/App/Views/Data/pengumuman.html index 6bd15f8..9130761 100644 --- a/App/Views/Data/pengumuman.html +++ b/App/Views/Data/pengumuman.html @@ -32,7 +32,7 @@ {% for post in posts %}
- {{ post.content | raw }} + {{ post.content|rendermd }}
{% endfor %} @@ -55,8 +55,8 @@ {% for post in posts %}
- [{{ post.valid_at }} - {{ post.expired_at }}] - {{ post.content }} + [{{ post.valid_at|date("d/m/Y") }} - {{ post.expired_at|date("d/m/Y") }}] + {{ post.content|rendermd }}