mdmsoft / yii2-admin

Auth manager for Yii2 (RBAC Manager)
GNU General Public License v3.0
1.16k stars 577 forks source link

yii2-admin 3.0 - header menu to content #198

Closed loveorigami closed 9 years ago

loveorigami commented 9 years ago

When I change module layout to my layout in config (as in v2.0)

        'admin' => [
            'class' => 'mdm\admin\Module',
            'layout' => '@backend/views/layouts/main', // default null. other avaliable value 'right-menu' and 'top-menu'
        ],

I have view without menu

00011

because header layout with menu https://github.com/mdmsoft/yii2-admin/blob/3.master/views/layouts/main.php#L24 outside of the content.

I made an exception for this module in my layout

            <?php
            if(Yii::$app->controller->module->id == 'admin'){
                $this->title='RBAC'; // for page title
                echo $this->render('//layouts/_admin_menu'); // render tab menu
            }
            ?>
  <?php echo $content ?> // here content from admin module without menu

as tab menu, (//layouts/_admin_menu)

<ul class="nav nav-tabs" ng-controller="HeaderMenuCtrl">
    <li ng-repeat="menu in headerMenu" ng-class="{active:location.path().indexOf(menu.id)===0}">
        <a ng-href="{{menu.url}}" ng-bind="menu.label"></a>
    </li>
</ul>
<div class="clear_small"></div>

0002

but it's not very flexible: when you change code for menu (as now in v3.1) in my layout menu not working. And other users will also be asking this question

loveorigami commented 9 years ago

I see your new view. But in my view content is outside of the content box. 002

because div class="row" clear all paddings

For me good as :

 <div ng-app="dAdmin">

        <ul class="nav nav-tabs">
            <li ng-repeat="menu in headerMenu" ng-class="{active:isRouteActive(menu.id)}">
                <a ng-href="{{menu.url}}" ng-bind="menu.label"></a>
            </li>
        </ul>

        <div style="padding-bottom: 10px;"></div>

        <?=
        NgView::widget([
            'name' => 'dAdmin',

or may be better add new property in module public menuView and replased it in config as

        'admin' => [
            'class' => 'mdm\admin\Module',
            'layout' => '@backend/views/layouts/main',
            'menuView' => '@backend/views/admin_menu',
        ],
loveorigami commented 9 years ago

Now it is fine! Please, add

$this->title= Yii::t('rbac-admin', 'RBAC Manager')

here https://github.com/mdmsoft/yii2-admin/blob/fd120e21a578c3df927f53e1712ccbc90f84e848/views/default/index.php#L8 for displaying this title in browser

loveorigami commented 9 years ago

Many thanks! Now work is very good!

And small wish to you: can you change label color for roles and permissions. Because info and warning with white letters see is not good.

For example:

2015-08-28_9-28-51

loveorigami commented 9 years ago

Many Thanks! Now is very good!