Beautify the web

This commit is contained in:
Gregorio Chiko Putra 2017-09-12 14:30:42 +07:00
parent 1f62a24c80
commit 5b1b546dc5
12 changed files with 6048 additions and 208 deletions

View File

@ -28,7 +28,7 @@ class Home
public function login($args = [])
{
if (Session::exists('userid')) {
Session::flash('info', 'Anda telah masuk.');
Session::flash('info', 'Anda telah masuk');
Redirect::to('/');
die();
} else {
@ -53,16 +53,16 @@ class Home
]);
if ($user == false) {
$info = "Username/password salah.";
$info = "Username/password salah";
} else {
$hash = Hash::compare($password, $user['salt'], $user['password']);
if ($hash == true) {
if ($user['max_user'] <= 0) {
$info = "Telah mencapai maksimal user yang diizinkan. Silahkan logout pada perangkat lain terlebih dahulu.";
$info = "Telah mencapai maksimal user yang diizinkan - Silahkan logout pada perangkat lain terlebih dahulu";
} else {
if ($this->model->update(['status' => 1], $user['id']) != true) {
$info = "Terjadi kesalahan. Silahkan coba lagi dalam beberapa saat.";
$info = "Terjadi kesalahan. Silahkan coba lagi dalam beberapa saat";
} else {
$max_user = $user['max_user'] - 1;
if ($this->model->update(['max_user' => $max_user], $user['id']) == true) {
@ -85,14 +85,14 @@ class Home
public function logout() {
if ($this->delete() != true) {
$info = "Terjadi kesalahan. Silahkan coba lagi dalam beberapa saat.";
$info = "Terjadi kesalahan. Silahkan coba lagi dalam beberapa saat";
} else {
Session::delete('userid');
Session::delete('username');
Session::delete('full_name');
Session::delete('privilage');
$info = "Berhasil keluar.";
$info = "Berhasil keluar";
}
Session::flash('info', $info);
Redirect::to('/');
@ -114,7 +114,7 @@ class Home
{
foreach ($args as $value) {
if ($value == '') {
Session::flash('info', 'Semua data harus diisi.');
Session::flash('info', 'Semua data harus diisi');
Redirect::to('./register');
die();
}
@ -145,7 +145,7 @@ class Home
$known_uname = $data['username'];
}
if ($args['username'] == $known_uname) {
Session::flash('info', 'Username telah digunakan. Silahkan gunakan username lain.');
Session::flash('info', 'Username telah digunakan. Silahkan gunakan username lain');
Redirect::to('./register');
die();
}

View File

@ -205,7 +205,7 @@ class Posts
{
if (Session::exists('userid')) {
if (Session::get('privilage') != 1) {
Session::flash('info', 'Hanya admin yang bisa mengatur kategori.');
Session::flash('info', 'Hanya admin yang bisa mengatur kategori');
Redirect::to('/');
die();
}
@ -239,7 +239,7 @@ class Posts
foreach ($args as $value) {
if ($value == '') {
Session::flash('info', 'Semua data harus diisi.');
Session::flash('info', 'Semua data harus diisi');
if (isset($table)) {
Redirect::to("/posts/category");
} else {
@ -254,12 +254,12 @@ class Posts
if (isset($table)) {
if ($this->model->entry($args, $table)) {
Session::flash('info', 'Data berhasil diunggah.');
Session::flash('info', 'Data berhasil diunggah');
Redirect::to('/posts/category');
}
} else {
if ($this->model->entry($args)) {
Session::flash('info', 'Data berhasil diunggah.');
Session::flash('info', 'Data berhasil diunggah');
Redirect::to('/');
}
}
@ -273,7 +273,7 @@ class Posts
$this->model->update(['status' => 1], $args['id'], $table);
Session::flash('info', 'Data berhasil diaktifkan.');
Session::flash('info', 'Data berhasil diaktifkan');
Redirect::to('/posts/category');
die();
}
@ -299,7 +299,7 @@ class Posts
];
if ($old_data == $new_data) {
Session::flash('info', 'Tidak ada data yang diubah.');
Session::flash('info', 'Tidak ada data yang diubah');
Redirect::to("./$id");
die();
}
@ -312,10 +312,10 @@ class Posts
}
if ($this->model->update($args, $id)) {
Session::flash('info', 'Data berhasil diperbarui.');
Session::flash('info', 'Data berhasil diperbarui');
Redirect::to('/');
} else {
Session::flash('info', 'Terjadi kesalahan. Silahkan coba lagi dalam beberapa saat.');
Session::flash('info', 'Terjadi kesalahan. Silahkan coba lagi dalam beberapa saat');
Redirect::to("./$id");
}
die();
@ -339,7 +339,7 @@ class Posts
if ($delete == true) {
$info = 'Data berhasil dinonaktifkan.';
} else {
$info = 'Terjadi kesalahan. Silahkan coba lagi dalam beberapa saat.';
$info = 'Terjadi kesalahan. Silahkan coba lagi dalam beberapa saat';
}
Session::flash('info', $info);

View File

@ -9,20 +9,17 @@
<h1>Login</h1>
<div class="flex four grow">
<div class="fourth">
<!-- <label for="username">Username: </label> -->
<div class="fourth-600 full">
<input type="text" name="username" value="" placeholder="Username" maxlength="25" autocomplete="off">
</div>
<div class="two-fourth">
<!-- <label for="password">Password: </label> -->
<div class="fourth-600 full">
<input type="password" name="password" value="" placeholder="Password">
</div>
<div></div>
<div>
<div class="fourth-600 none"></div>
<div class="fourth-600 none"></div>
<input type="hidden" name="_token" value="{{ token }}">
</div>
<div>
<button type="submit" class="half">Masuk</button>
<button type="submit" class="half-600 full">Masuk</button>
</div>
</div>
</form>

View File

@ -3,28 +3,31 @@
{% block title %}Registrasi{% endblock %}
{% block body %}
<main class="documentation">
<section>
<h1>Registrasi</h1>
<form method="post">
<h2>Registrasi</h2>
<label for="full_name">Nama Lengkap: </label>
<input type="text" name="full_name" value="" placeholder="Tulis nama anda" maxlength="50" autocomplete="off">
<br>
<label for="username">Username: </label>
<input type="text" name="username" value="" placeholder="Tulis username" maxlength="25" autocomplete="off">
<br>
<label for="password">Password: </label>
<input type="password" name="password" value="" placeholder="Tulis password">
<div class="flex four grow">
<div class="fourth-600 full">
<input type="text" name="full_name" value="" placeholder="Nama Lengkap" maxlength="50" autocomplete="off">
</div>
<div class="fourth-600 full">
<input type="text" name="username" value="" placeholder="Username" maxlength="25" autocomplete="off">
</div>
<div class="fourth-600 full">
<input type="password" name="password" value="" placeholder="Password">
</div>
<input type="hidden" name="_method" value="post">
<input type="hidden" name="_token" value="{{ token }}">
<br>
<button type="submit">Registrasi</button>
<div class="fourth-600 none"></div>
<div>
<button type="submit" class="three-fourth-600 full">
<i class="fa fa-plus-circle fa-fw" aria-hidden="true"></i>
</button>
</div>
</div>
</form>
</section>
</main>
{% endblock %}

View File

@ -3,10 +3,67 @@
{% block title %}Ubah Pengumuman{% endblock %}
{% block body %}
<form method="post">
<h3>Pengumuman {{ post.id }}</h3>
<main class="documentation">
<section>
<h1>Pengumuman {{ post.id }}</h1>
<form method="post">
<div class="flex five grow">
<aside class="two-fifth-600 full">
<div class="stack">
<label>Dibuat pada: </label>
<span>
{{ post.created_at }}
</span>
</div>
<div class="stack">
<label>Dibuat oleh: </label>
<span>
{{ creator.full_name }}
</span>
</div>
<div class="stack">
<label>Diubah pada: </label>
<span>
{% if post.edited_at is empty %}
-
{% else %}
{{ post.edited_at }}
{% endif %}
</span>
<input type="hidden" name="edited_at" value="{{ timestamp }}">
</div>
<div class="stack">
<label>Diubah oleh: </label>
<span>
{% if post.editor is empty %}
-
{% else %}
{{ editor.full_name }}
{% endif %}
</span>
<input type="hidden" name="editor" value="{{ editor_now.id }}">
</div>
<div class="stack">
<label>Status: </label>
<span>
{% if post.status == 1 %}
Aktif
{% elseif post.status == 2 %}
Belum aktif
{% else %}
Nonaktif
{% endif %}
</span>
</div>
</aside>
<div class="three-fifth-600 full">
<div class="stack">
<div class="stack">
<label for="category">Kategori: </label>
</div>
<div class="stack">
<select name="category">
{% for cat in categories %}
<option value="{{ cat.id }}"
@ -18,108 +75,79 @@
</option>
{% endfor %}
</select>
</div>
<input type="hidden" name="old_category" value="{{ post.category }}">
</div>
<br>
<div class="stack">
<div class="stack">
<label for="content">Konten: </label>
<textarea name="content" rows="3" cols="30" maxlength="255">{{ post.content }}</textarea>
</div>
<div class="stack">
<textarea name="content" rows="3" maxlength="255">{{ post.content }}</textarea>
</div>
<input type="hidden" name="old_content" value="{{ post.content }}">
</div>
<br>
<label>Dibuat pada: </label>
<span>
{{ post.created_at }}
</span>
<br>
<label>Dibuat oleh: </label>
<span>
{{ creator.full_name }}
</span>
<br>
<div class="stack">
<div class="stack">
<label for="valid_at">Berlaku dari: </label>
</div>
<div class="stack">
<input type="date" name="valid_at" value="{{ post.valid_at }}">
</div>
<input type="hidden" name="old_valid_at" value="{{ post.valid_at }}">
</div>
<br>
<div class="stack">
<div class="stack">
<label for="expired_at">Berlaku sampai: </label>
</div>
<div class="stack">
<input type="date" name="expired_at" value="{{ post.expired_at }}">
</div>
<input type="hidden" name="old_expired_at" value="{{ post.expired_at }}">
<br>
<label>Diubah pada: </label>
<span>
{% if post.edited_at is empty %}
-
{% else %}
{{ post.edited_at }}
{% endif %}
</span>
<input type="hidden" name="edited_at" value="{{ timestamp }}">
<br>
<label for="editor_name">Diubah oleh: </label>
<span>
{% if post.editor is empty %}
-
{% else %}
{{ editor.full_name }}
{% endif %}
</span>
<input type="hidden" name="editor" value="{{ editor_now.id }}">
<br>
<label>Status: </label>
<span>
{% if post.status == 1 %}
Aktif
{% elseif post.status == 2 %}
Belum aktif
{% else %}
Nonaktif
{% endif %}
</span>
</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 }}">
<br>
<button type="submit"
<div class="off-four-fifth-600 full">
<button class="fifth" type="submit"
{% if (post.status == 0 or post.status == 3 or editor_now.id != creator.id) %}
disabled
{% endif %}
>
Ubah
{% endif %}>
<i class="fa fa-edit fa-fw" aria-hidden="true"></i>
</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 }}">
<button type="submit">Nonaktifkan</button>
<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>
{% endblock %}

View File

@ -48,7 +48,9 @@
<br>
<button type="submit" class="success">Unggah</button>
<button type="submit">
<i class="fa fa-check fa-fw"></i>
</button>
</div>
</form>
</section>

View File

@ -3,7 +3,10 @@
{% block title %}Kategori{% endblock %}
{% block body %}
<p>List Kategori:</p>
<main class="documentation">
<section>
<h1>Kategori</h1>
<h2>List</h2>
<ul>
{% for cat in categories %}
<li>{{ cat.category }}
@ -14,33 +17,41 @@
{% elseif cat.status == 0 %}
<input type="hidden" name="_method" value="put">
{% endif %}
<input type="hidden" name="_addon" value="kategori">
<input type="hidden" name="_token" value="{{ token }}">
<button type="submit" class="shyButton error">
{% if cat.status == 1 %}
<button type="submit">Nonaktifkan</button>
Nonaktifkan
{% elseif cat.status == 0 %}
<button type="submit">Aktifkan</button>
{% else %}
<code>Nonaktif</code>
Aktifkan
{% endif %}
</button>
</form>
</li><br>
</li>
{% endfor %}
</ul>
<form method="post">
<label for="category">Nama Kategori: </label>
<h2>Tambah</h2>
<div class="flex three grow">
<div class="third-600 full">
<input type="text" name="category" value="" placeholder="Kategori">
</div>
<div class="third-600 none"></div>
<div class="third-600 none"></div>
<input type="hidden" name="_method" value="post">
<input type="hidden" name="_addon" value="kategori">
<input type="hidden" name="_token" value="{{ token }}">
<button type="submit">Tambah</button>
</form>
<div>
<button type="submit" class="third-600 full">
<i class="fa fa-plus fa-fw" aria-hidden="true"></i>
</button>
</div>
</div>
</form>
</section>
</main>
{% endblock %}

View File

@ -3,15 +3,20 @@
{% block title %}Pengumuman{% endblock %}
{% block nav %}
<input type="checkbox" id="bmenug" class="show">
<label for="bmenug" class="burger pseudo button"><i class="fa fa-bars" aria-hidden="true"></i></label>
<div class="menu">
{% if privilage != "" %}
<a href="/posts/entry" class="pseudo button">+ Pengumuman</a>
<a href="/posts/entry" class="pseudo button" data-tooltip="Pengumuman Baru"><i class="fa fa-newspaper-o" aria-hidden="true"></i></a>
{% if privilage == 1 %}
<a href="/posts/category" class="pseudo button">+ Kategori</a>
<a href="/posts/category" class="pseudo button" data-tooltip="Kategori"><i class="fa fa-list-ul" aria-hidden="true"></i></a>
<a href="/register" class="pseudo button" data-tooltip="User Baru"><i class="fa fa-user-plus" aria-hidden="true"></i></a>
{% endif %}
<a href="/logout" class="button error">Keluar</a>
<a href="/logout" class="pseudo button" data-tooltip="Keluar"><i class="fa fa-sign-out" aria-hidden="true"></i></a>
{% else %}
<a href="/login" class="button">Masuk</a>
<a href="/login" class="pseudo button" data-tooltip="Masuk">
<i class="fa fa-sign-in" aria-hidden="true"></i>
</a>
{% endif %}
</div>
{% endblock %}
@ -22,23 +27,27 @@
<h1>List Pengumuman</h1>
{% for post in posts %}
{% if post.id %}
<h2>Pengumuman {{ post.id }}</h2>
{{ post.content | raw }}
<br />
<h2>
Pengumuman {{ post.id }}
<span class="shyFont">
{% if status %}
{% if post.status == 1 %}
<a href="/posts/edit/{{ post.id }}">
Edit
<a href="/posts/edit/{{ post.id }}" data-tooltip="Ubah">
<i class="fa fa-edit" aria-hidden="true"></i>
</a>
{% elseif post.status == 2 %}
<a href="/posts/edit/{{ post.id }}">
<strike>Edit</strike>
<a href="/posts/edit/{{ post.id }}" data-tooltip="Ubah (Belum aktif)">
<strike><i class="fa fa-edit" aria-hidden="true"></i></strike>
</a> (Belum aktif)
{% else %}
<strike>Edit</strike>
<strike data-tooltip="Tidak dapat diubah (Tidak aktif)"><i class="fa fa-edit" aria-hidden="true"></i></strike>
(Nonaktif)
{% endif %}
{% endif %}
</span>
</h2>
{{ post.content | raw }}
{% endif %}
{% endfor %}
</section>

View File

@ -2,6 +2,7 @@
<html>
<head>
<meta charset="utf-8">
<script src="https://use.fontawesome.com/0aa8f3d106.js"></script>
<link rel="stylesheet" href="/css/picnic.min.css">
<title>{% block title %}{% endblock %}</title>
@ -28,16 +29,35 @@
.shyButton {
font-size: .75em;
}
.shyFont {
font-size: .65em;
}
.top {
position: fixed;
z-index: 10001;
}
.fl {
float: left;
}
.fr {
float: right;
}
</style>
</head>
<body>
<nav>
<a href="/" class="brand">
<span>Home</span>
<span><i class="fa fa-home" aria-hidden="true"></i></span>
</a>
{% block nav %}{% endblock %}
</nav>
{% block body %}
{% endblock %}
<script src="/js/rome.js"></script>
</body>
</html>

4
public/css/font-awesome.min.css vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -12,8 +12,9 @@ set_error_handler("Core\Error::errorHandler");
set_exception_handler("Core\Error::exceptionHandler");
if (Core\Session::exists('info')) {
echo '<h3 style="margin:auto;"><span class="label top">';
echo Core\Session::flash('info');
echo "<br>";
echo '</span></h3>';
}
$router = new Core\Router();

5765
public/js/rome.js Normal file

File diff suppressed because one or more lines are too long