thedevdojo / voyager

Voyager - The Missing Laravel Admin
https://voyager.devdojo.com
MIT License
11.78k stars 2.67k forks source link

Voyager menu not taking bootstrap styles #5283

Open donchoborisov opened 3 years ago

donchoborisov commented 3 years ago

Version information

Laravel: v7.0 Voyager: v1.4.2 PHP: 7.3.# Database: Mysq

Description

HI there, I am trying to add my menu on the front-end following the instructions from your page.

Steps To Reproduce

Steps to reproduce the behavior: 1.I create the menu with menu builder

  1. im using this menu('main', 'bootstrap'); for displaying the menu 3.The menu items are coming but they are not coming with the bootstrap styling
  2. See error

Screenshots

image

Additional context

Add any other context about the problem here.

emptynick commented 3 years ago

Voyager only provides the HTML with proper bootstrap classes, you'll have to provide the CSS yourself

donchoborisov commented 3 years ago

image

donchoborisov commented 3 years ago

This will output your menu in an unstyled unordered list. If you do use bootstrap to stylize your web app you can pass a second argument to the menu display method telling it that you want to stylize the menu with bootstrap styles like so

fletch3555 commented 3 years ago

@donchoborisov which version of bootstrap are you using? Can you look at the source and confirm whether there are any classes on those menu elements?

donchoborisov commented 3 years ago

Hi there thank you for your response. I am using bootstrap@4.5.3

<li class="nav-item"><a class="nav-link text-light text-uppercase font-weight-bold px-3">{{menu('main-menu','bootstrap')}}</a></li>

fletch3555 commented 3 years ago

The 2nd question was actually the more important one. I meant can you check in the browser and confirm that the rendered menu has classes attached to it.

I believe that view was written for bootstrap 3, not 4. I haven't used bootstrap in a while, so I can't say for certain if the class names being used changed between versions.

donchoborisov commented 3 years ago

let me see how it looks in bootstrap 3

donchoborisov commented 3 years ago

same the list is coming unstyled

fletch3555 commented 3 years ago

Okay, can you share the rendered markup in your browser dev-tools? I'd like to see exactly what the browser is seeing

donchoborisov commented 3 years ago

image

donchoborisov commented 3 years ago

I manage to get the menus styled with this code but im not too sure how i can get the submenus now

@php

 $menu = DB::select('select * from menu_items where menu_id=2');

@endphp