kishor10d / Admin-Panel-User-Management-using-CodeIgniter

Admin Panel User Management Demo - CodeIgniter + AdminLTE Theme
http://cias.codeinsect.com
GNU General Public License v3.0
337 stars 240 forks source link

adminLTE template #28

Closed d33pak-s1ngh closed 6 years ago

d33pak-s1ngh commented 6 years ago

i have added the new version of adminLTE template where i have paste the latest dist folder into assets and removed the existing one. the problem i am getting is that the new template menu work bit diffrent so when i create a sub menu and click on it only the sub menu becomes active, the parent of that sub menu remains in active. that means i have to add active class to the parent. following is the menu strcture

<li class="treeview">
    <a href="#">
        <i class="fa fa-users"></i>
        <span>Users</span>
        <span class="pull-right-container">
            <i class="fa fa-angle-left pull-right"></i>
        </span>
    </a>
    <ul class="treeview-menu">
        <li><a href=""><i class="fa fa-circle-o"></i>New User</a></li>
        <li id="li"><a id="alink" href="<?php echo base_url(); ?>userListing"><i class="fa fa-circle-o"></i>User List</a></li>
        <li><a href=""><i class="fa fa-circle-o"></i>User Role</a></li>
    </ul>
</li>

because of the code in footer.php only sub menu becomes active not the main.

var windowURL = window.location.href;
        pageURL = windowURL.substring(0, windowURL.lastIndexOf('/'));
        var x= $('a[href="'+pageURL+'"]');
            x.addClass('active');
            x.parent().addClass('active');
        var y= $('a[href="'+windowURL+'"]');
            y.addClass('active');
            y.parent().addClass('active');

can you help with this one.

d33pak-s1ngh commented 6 years ago

fixed the problem with the following code.

var windowURL = window.location.href;
        pageURL = windowURL.substring(0, windowURL.lastIndexOf('/'));

        var x= $('a[href="'+pageURL+'"]');
            x.addClass('active');
            x.parent().addClass('active');

        var y= $('a[href="'+windowURL+'"]');
           // y.addClass('active');
           // y.parent().addClass('active');
           y.parentsUntil("sidebar-menu").addClass('active'); //This part will add active class to all its parents
kishor10d commented 6 years ago

@d33pak-s1ngh : Thanks.