Skip to content

Commit

Permalink
Change for add search menu mainsidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
Julio Cesar Leyva Rodriguez committed Jan 26, 2023
1 parent 768755e commit c15f9cd
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 34 deletions.
1 change: 1 addition & 0 deletions src/Language/en/boilerplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
'close' => 'Close',
'action' => 'Action',
'logout' => 'Logout',
'search' => 'Search',
'sweet' => [
'title' => 'Are you sure?',
'text' => "You won't be able to revert this!",
Expand Down
1 change: 1 addition & 0 deletions src/Language/es/boilerplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
'close' => 'Cerrar',
'action' => 'Acción',
'logout' => 'Salir',
'search' => 'Buscar',
'sweet' => [
'title' => 'Estás Seguro?',
'text' => 'Si no estas seguro da click en cancelar!',
Expand Down
1 change: 1 addition & 0 deletions src/Language/id/boilerplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
'close' => 'Tutup',
'action' => 'Aksi',
'logout' => 'Logout',
'search' => 'Cari',
'sweet' => [
'title' => 'Apakah kamu yakin?',
'text' => 'Anda tidak akan dapat mengembalikan ini!',
Expand Down
103 changes: 69 additions & 34 deletions src/Views/layout/mainsidebar.php
Original file line number Diff line number Diff line change
@@ -1,50 +1,85 @@
<aside class="main-sidebar <?= config('Boilerplate')->theme['sidebar']['border'] ? 'border-right' : ''?> sidebar-<?= config('Boilerplate')->theme['sidebar']['type'] ?>-<?= config('Boilerplate')->theme['sidebar']['links']['bg'] ?> elevation-<?= config('Boilerplate')->theme['sidebar']['shadow'] ?>">
<a href="<?= route_to('/') ?>" class="brand-link <?= !empty(config('Boilerplate')->theme['sidebar']['brand']['bg']) ? 'bg-'.config('Boilerplate')->theme['sidebar']['brand']['bg'] : '' ?>">
<aside class="main-sidebar <?= config('Boilerplate')->theme['sidebar']['border'] ? 'border-right' : '' ?> sidebar-<?= config('Boilerplate')->theme['sidebar']['type'] ?>-<?= config('Boilerplate')->theme['sidebar']['links']['bg'] ?> elevation-<?= config('Boilerplate')->theme['sidebar']['shadow'] ?>">
<a href="<?= route_to('/') ?>" class="brand-link <?= !empty(config('Boilerplate')->theme['sidebar']['brand']['bg']) ? 'bg-' . config('Boilerplate')->theme['sidebar']['brand']['bg'] : '' ?>">
<img src="<?= base_url(config('Boilerplate')->theme['sidebar']['brand']['logo']['icon']) ?>" class="brand-image img-circle elevation-<?= config('Boilerplate')->theme['sidebar']['brand']['logo']['shadow'] ?>" style="opacity: .8">
<span class="brand-text"><?= config('Boilerplate')->theme['sidebar']['brand']['logo']['text'] ?></span>
</a>
<div class="sidebar">
<?php if (config('Boilerplate')->theme['sidebar']['user']['visible']) { ?>
<div class="user-panel py-3 d-flex">
<div class="image">
<img src="https://cdn.jsdelivr.net/npm/admin-lte@3.0.2/dist/img/avatar.png" class="img-circle elevation-<?= config('Boilerplate')->theme['sidebar']['user']['shadow'] ?>"
alt="User Image">
<div class="user-panel py-3 d-flex">
<div class="image">
<img src="https://cdn.jsdelivr.net/npm/admin-lte@3.0.2/dist/img/avatar.png" class="img-circle elevation-<?= config('Boilerplate')->theme['sidebar']['user']['shadow'] ?>"
alt="User Image">
</div>
<div class="info">
<a href="<?= base_url(route_to('user-profile')) ?>" class="d-block"><?= user()->username ?></a>
</div>
</div>
<div class="info">
<a href="<?= base_url(route_to('user-profile')) ?>" class="d-block"><?= user()->username ?></a>
<div class="form-inline">
<div class="input-group" data-widget="sidebar-search">
<input class="form-control form-control-sidebar" type="search" id="search" name="search" placeholder="<?= lang('boilerplate.global.search') ?>" aria-label="Search">
<div class="input-group-append">
<button class="btn btn-sidebar">
<i class="fas fa-search fa-fw"></i>
</button>
</div>
</div>

</div>
</div>
<?php } ?>
<nav class="mt-3">
<ul class="nav nav-pills nav-sidebar flex-column nav-child-indent <?= config('Boilerplate')->theme['sidebar']['compact'] ? 'nav-compact' : '' ?>" data-widget="treeview"
role="menu" data-accordion="false">
<?php foreach (menu() as $parent) { ?>
<li class="nav-item has-treeview <?= current_url() == base_url($parent->route) || in_array(uri_string(), array_column($parent->children, 'route')) ? 'menu-open' : '' ?>">
<a href="<?= base_url($parent->route) ?>" class="nav-link <?= current_url() == base_url($parent->route) || in_array(uri_string(), array_column($parent->children, 'route')) ? 'active' : '' ?>">
<i class="nav-icon <?= $parent->icon ?>"></i>
<p>
<?= $parent->title ?>
<?php if (count($parent->children)) { ?>
<i class="right fas fa-angle-left"></i>
<?php } ?>
</p>
</a>
<?php if (count($parent->children)) { ?>
<ul class="nav nav-treeview">
<?php foreach ($parent->children as $child) { ?>
<li class="nav-item has-treeview">
<a href="<?= base_url($child->route) ?>"
class="nav-link <?= current_url() == base_url($child->route) ? 'active' : '' ?>">
<i class="nav-icon <?= $child->icon ?>"></i>
<p><?= $child->title ?></p>
</a>
</li>
<?php foreach (menu() as $parent) { ?>
<li class="nav-item has-treeview <?= current_url() == base_url($parent->route) || in_array(uri_string(), array_column($parent->children, 'route')) ? 'menu-open' : '' ?>">
<a href="<?= base_url($parent->route) ?>" class="nav-link <?= current_url() == base_url($parent->route) || in_array(uri_string(), array_column($parent->children, 'route')) ? 'active' : '' ?>">
<i class="nav-icon <?= $parent->icon ?>"></i>
<p>
<?= $parent->title ?>
<?php if (count($parent->children)) { ?>
<i class="right fas fa-angle-left"></i>
<?php } ?>
</p>
</a>
<?php if (count($parent->children)) { ?>
<ul class="nav nav-treeview">
<?php foreach ($parent->children as $child) { ?>
<li class="nav-item has-treeview">
<a href="<?= base_url($child->route) ?>"
class="nav-link <?= current_url() == base_url($child->route) ? 'active' : '' ?>">
<i class="nav-icon <?= $child->icon ?>"></i>
<p><?= $child->title ?></p>
</a>
</li>
<?php } ?>
</ul>
<?php } ?>
</ul>
<?php } ?>
</li>
</li>
<?php } ?>
</ul>
</nav>
</div>
</aside>
</aside>

<?= $this->section('js') ?>

<script>

$(document).ready(function () {


$("#search").on("keyup", function () {
if (this.value.length > 0) {
$(".nav-sidebar li").hide().filter(function () {
return $(this).text().toLowerCase().indexOf($("#search").val().toLowerCase()) != -1;
}).show();
} else {
$(".sidebar-menu li").show();
}
});

});

</script>


<?= $this->endSection() ?>

0 comments on commit c15f9cd

Please sign in to comment.