Categories now have their background color and font color, which effects the client and admin side

This commit is contained in:
2017-09-15 16:32:26 +07:00
parent ec548a46b7
commit 9ca1050979
6 changed files with 231 additions and 110 deletions

View File

@@ -0,0 +1,20 @@
{% extends "base.html" %}
{% block title %}Ubah Kategori{% endblock %}
{% block body %}
<main class="documentation">
<section>
<form method="post">
<div class="flex four-600 two">
<h1>Kategori
</h1>
<h1>
<input type="text" name="category" value="{{ category.category }}">
</h1>
</form>
</section>
</main>
{% endblock %}

View File

@@ -6,54 +6,97 @@
<main class="documentation">
<section>
<h1>Kategori</h1>
<h2>List</h2>
<ul>
{% for cat in categories %}
<li>{{ cat.category }}
<div class="flex two-600 full grow">
<div>
<form method="post">
<input type="hidden" name="id" value="{{ cat.id }}">
{% if cat.status == 1 %}
<input type="hidden" name="status" value="0">
<input type="hidden" name="_method" value="delete">
{% elseif cat.status == 0 %}
<input type="hidden" name="status" value="1">
<input type="hidden" name="_method" value="put">
{% endif %}
<h2>Tambah Kategori</h2>
<div class="flex three-600 two grow">
<div class="third-600 full">
<label for="category">Nama</label>
</div>
<div class="two-third-600 full">
<input type="text" name="category">
</div>
<input type="hidden" name="_addon" value="kategori">
<input type="hidden" name="_token" value="{{ token }}">
<div class="third-600 full">
<label for="background">Background</label>
</div>
<div class="two-third-600 full">
<input type="color" name="background">
</div>
<button type="submit" class="shyButton
{% if cat.status == 1 %}
error">Nonaktifkan
{% elseif cat.status == 0 %}
success">Aktifkan
{% endif %}
</button>
</form>
</li>
{% endfor %}
</ul>
<div class="third-600 full">
<label for="foreground">Teks</label>
</div>
<div class="two-third-600 full">
<input type="color" name="foreground">
</div>
<form method="post">
<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 }}">
<div>
<button type="submit" class="third-600 full">
<input type="hidden" name="_method" value="post">
<input type="hidden" name="_addon" value="kategori">
<input type="hidden" name="_token" value="{{ token }}">
<button type="submit" class="pseudo full">
<i class="fa fa-plus fa-fw" aria-hidden="true"></i>
<span style="font-size:smaller;">Tambah</span>
</button>
</div>
</div>
</form>
</form>
</div>
<div>
<h2>List</h2>
<ul style="margin-top:0;">
{% for cat in categories %}
<li>
<div style="height:initial;text-align:center;border-radius:5px;background-color:{{ cat.background }};color:{{ cat.foreground }};">
<span>
{{ cat.category }}
</span>
</div>
<div class="flex two-600 full grow" style="margin:0;">
<div>
<a href="#" class="pseudo button full">
<i class="fa fa-edit fa-fw"></i>
<span style="font-size:smaller;">Ubah</span>
</a>
</div>
<div>
<form method="post">
<input type="hidden" name="id" value="{{ cat.id }}">
{% if cat.status == 1 %}
<input type="hidden" name="status" value="0">
<input type="hidden" name="_method" value="delete">
{% elseif cat.status == 0 %}
<input type="hidden" name="status" value="1">
<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="pseudo full" style="height:100%;">
{% if cat.status == 1 %}
<i class="fa fa-times-circle-o fa-fw"></i>
<span class="font-size:smaller;">Matikan</span>
{% elseif cat.status == 0 %}
<span class="font-size:smaller;">Matikan</span>
{% endif %}
</button>
</form>
</div>
</div>
<div class="fourth-600 none"></div>
</li>
{% endfor %}
</ul>
</div>
</div>
</section>
</main>
{% endblock %}

View File

@@ -22,24 +22,27 @@
{% block body %}
<main class="documentation">
<div style="background:#fff;text-align:left;width:100%;padding:80px 0 0;">
<div style="text-align:left;width:100%;">
{% if privilege == "" %}
<div id="slidr-div">
{% if not posts %}
<div style="background:#fff;text-align:left;width:100vw;padding:10vh 0 0;">
<h1 class="fitty">Tidak ada pengumuman</h1>
</div>
{% else %}
<div id="slidr-div">
{% for post in posts %}
<div data-slidr="{{ post.id }}" style="width: 100%;">
<div class="fitty" style="padding: 0 5rem">
<div data-slidr="{{ post.id }}" style="color:{{ post.foreground }};background-color:{{ post.background }};width:100%;height:100vh;padding:15vh 0;">
<div class="fitty" style="padding:0 5rem">
{{ post.content|rendermd }}
</div>
</div>
{% endfor %}
{% endif %}
</div>
{% endif %}
{% else %}
<div style="background:#fff;text-align:left;width:100vw;padding:10vh 0 0;">
<div class="filter flex six-600 four grow">
<div class="sixth-600 none"></div>
<a href="/" class="navy noFitty">Semua</a>
@@ -54,57 +57,57 @@
</a>
{% 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|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 %}
<div class="half-900">
<a href="/posts/edit/{{ post.id }}" class="button full">
<i class="fa fa-edit fa-fw"></i>
<span style="font-size:smaller;">Ubah</span>
</a>
</div>
{% else %}
<div class="half-900">
<span class="button pseudo full" style="color:rgba(17,17,17,.3)">Nonaktif</span>
</div>
{% endif %}
{% if (post.status == 1 and editor_now.id == creator.id) %}
<div class="half-900">
<input type="hidden" name="id" value="{{ post.id }}">
<input type="hidden" name="status" value="0">
<!-- Method -->
<input type="hidden" name="_method" value="delete">
<!-- Token -->
<input type="hidden" name="_token" value="{{ token }}">
<button type="submit" class="error full">
<i class="fa fa-times-circle-o fa-fw" aria-hidden="true"></i>
<span style="font-size:smaller;">Matikan</span>
</button>
</div>
{% elseif (post.status == 2 and editor_now.id == creator.id) %}
<div class="half-900">
<input type="hidden" name="id" value="{{ post.id }}">
<input type="hidden" name="valid_at" value="##date##">
<!-- Method -->
<input type="hidden" name="_method" value="put">
<!-- Token -->
<input type="hidden" name="_token" value="{{ token }}">
<button type="submit" class="success full">
<i class="fa fa-check fa-fw" aria-hidden="true"></i>
<span style="font-size:smaller;">Aktifkan</span>
</button>
</div>
{% endif %}
</footer>
</form>
<div class="fourth-900 half-600 card box" style="background-color:{{ post.background }};">
<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" style="color:{{ post.foreground }};">{{ post.content|rendermd }}</span>
<form method="post">
<footer class="flex full grow">
{% if post.status != 0 %}
<div class="half-900">
<a href="/posts/edit/{{ post.id }}" class="button full">
<i class="fa fa-edit fa-fw"></i>
<span style="font-size:smaller;">Ubah</span>
</a>
</div>
{% else %}
<div class="half-900">
<span class="button pseudo full" style="color:rgba(17,17,17,.3)">Nonaktif</span>
</div>
{% endif %}
{% if (post.status == 1 and editor_now.id == creator.id) %}
<div class="half-900">
<input type="hidden" name="id" value="{{ post.id }}">
<input type="hidden" name="status" value="0">
<!-- Method -->
<input type="hidden" name="_method" value="delete">
<!-- Token -->
<input type="hidden" name="_token" value="{{ token }}">
<button type="submit" class="error full">
<i class="fa fa-times-circle-o fa-fw" aria-hidden="true"></i>
<span style="font-size:smaller;">Matikan</span>
</button>
</div>
{% elseif (post.status == 2 and editor_now.id == creator.id) %}
<div class="half-900">
<input type="hidden" name="id" value="{{ post.id }}">
<input type="hidden" name="valid_at" value="##date##">
<!-- Method -->
<input type="hidden" name="_method" value="put">
<!-- Token -->
<input type="hidden" name="_token" value="{{ token }}">
<button type="submit" class="success full">
<i class="fa fa-check fa-fw" aria-hidden="true"></i>
<span style="font-size:smaller;">Aktifkan</span>
</button>
</div>
{% endif %}
</footer>
</form>
</div>
{% endfor %}
</div>
</div>
{% endif %}
</div>
</main>

View File

@@ -24,6 +24,10 @@
padding-right: .6em;
}
.flex>h1 {
padding: 0;
}
nav.transparent {
box-shadow: none;
background: none;