[Задача 12794] Изменил верстку меню на использование bootstrap navigation bar. Изменил menu helper.

parent 15bf7e76
......@@ -50,11 +50,11 @@ class Typos extends CI_Controller {
$data['base_url'] = $this->config->base_url();
if ($this->session->usertype == 'admin') {
$data['items'] = menu_admin($data['base_url']);
$data['menuItems'] = menu_admin($data['base_url']);
}
if ($this->session->usertype == 'user') {
$data['items'] = menu_user($data['base_url']);
$data['menuItems'] = menu_user($data['base_url']);
}
$this->load->view($this->header_name, $data);
......
......@@ -8,25 +8,41 @@
/**
* Composes and returns a admin menu as array of items
* @return string
* @return array
*/
function menu_admin($baseUrl) {
$data['sites'] = "<a href='".$baseUrl."index.php/admins/sites'>Сайты</a>";
$data['users'] = "<a href='".$baseUrl."index.php/admins/users'>Пользователи</a>";
$data['typos'] = "<a href='".$baseUrl."index.php/users/typos'>Опечатки</a>";
$data['logout'] = "<a href='".$baseUrl."index.php/authorization/logout'>Выйти</a>";
$data = [];
$data[] = [
"href" => "${baseUrl}index.php/admins/sites",
"name" => "Сайты"
];
$data[] = [
"href" => "${baseUrl}index.php/admins/users",
"name" => "Пользователи"
];
$data[] = [
"href" => "${baseUrl}index.php/users/typos",
"name" => "Опечатки"
];
return $data;
}
/**
* Composes and returns a user menu as array of items
* @return string
* @return array
*/
function menu_user($baseUrl) {
//$data['typos'] = "<a href='".$baseUrl."index.php/users/typos'>Опечатки</a>";
$data['logout'] = "<a href='".$baseUrl."index.php/authorization/logout'>Выйти</a>";
$data = [];
$data[] = [
"href" => "${baseUrl}index.php/users/typos",
"name" => "Опечатки"
];
return $data;
}
......@@ -17,8 +17,3 @@
</head>
<body>
<!-- Шапка -->
<header id="head">
<h1> TYPOS@ETERSOFT - Сервис опечаток </h1>
</header>
<div class="left">
<div id="menu">
<span class="heading">Меню</span>
<hr>
<div class="items">
<ul>
<?php
if ($items) {
foreach ($items as $item) {
echo "<li>".$item."</li>";
}
}
?>
</ul>
</div>
<!-- Шапка-меню -->
<nav class="header navbar navbar-expand-md navbar-light bg-light">
<a href="#" class="navbar-brand">
<img src="//time.office.etersoft.ru/images/logo.png" width="30" height="30" alt="Etersoft Logo">
TYPOS@ETERSOFT - Сервис опечаток
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav"
area-controls="#navbarNav" area-expanded="false" area-label="Раскрыть меню">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse " id="navbarNav">
<ul class="navbar-nav mr-auto">
<?foreach ($menuItems as $index => $item): ?>
<?if ($index === 0): ?>
<li class="nav-item active">
<a href="<?= $item["href"] ?>" class="nav-link">
<?= $item["name"] ?>
<span class="sr-only">(текущая)</span>
</a>
</li>
<?else:?>
<li class="nav-item">
<a href="<?= $item["href"] ?>" class="nav-link">
<?= $item["name"] ?>
</a>
</li>
<?endif;?>
<?endforeach;?>
</ul>
<ul class="navbar-nav">
<li class="nav-item">
<a href="<?=$base_url?>index.php/authorization/logout">Выйти</a>
</li>
</ul>
</div>
</div>
\ No newline at end of file
</nav>
\ No newline at end of file
......@@ -50,16 +50,8 @@ body {
float: left;
}
#head {
padding: 8px;
.header {
margin-bottom: 15px;
background-color: #F3F3F3;
}
#head h1 {
vertical-align: center;
margin: 0;
color: #FF9C00;
}
#footer {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment