GithubHelp home page GithubHelp logo

infinetyes / nova-menu-builder Goto Github PK

View Code? Open in Web Editor NEW
64.0 3.0 25.0 159 KB

A Menu Builder for Laravel Nova

License: MIT License

JavaScript 3.46% Vue 50.45% CSS 0.03% HTML 3.25% PHP 42.81%
laravel nova menu builder laravelnova

nova-menu-builder's Introduction

Nova Menu Builder

This tool allows you to create menus in Laravel Nova

menu builder Home

Menu Builder Items

Installation

You can install the package in to a Laravel app that uses Nova via composer:

composer require infinety-es/nova-menu-builder

Then you should publish the database table file and migrate it:

php artisan vendor:publish --tag=menu-builder-migration
php artisan migrate

Usage

Next up, you must register the tool with Nova. This is typically done in the tools method of the NovaServiceProvider.

// in app/Providers/NovaServiceProvider.php

// ...

public function tools()
{
    return [
        // ...
        new \Infinety\MenuBuilder\MenuBuilder(),
    ];
}

Helpers

There are three helpers built in for your blades

  • menu_builder('slug').

    	Creates an html menu for given slug. Extra options are not required. By default tags are `ul` and `li`, and without html classes.
    
{!! menu_builder('main') !!}

//or

{!! menu_builder('main', 'parent-class', 'child-class', 'dl', 'dd') !!}
  • menu_name('slug').

    	Returns the name of the menu for a given slug.
    
{{ menu_name('main') }}
  • menu_json('slug').

    	Returns a json with all items for given slug.
    
{!! menu_json('main') !!}

Example using blade.

@foreach (getMenuBySlug('header')->parentItems as $menuItem)
    @include('menu-builder::menu-item', [
      'menu' => $menuItem,
      'active_top_class' => 'active',
      'active_child_class' => 'active',
    ])
@endforeach

Localization

Set your translations in the corresponding xx.json file located in /resources/lang/vendor/nova

"Menu Builder": "Menu Builder",
"Menu Items": "Menu Items",
"Add item": "Add item",
"Delete item": "Delete item",
"Are you sure to delete this menu item?": "Are you sure to delete this menu item?",
"Take care. All children items will be deleted cause you're deleting the parent.": "Take care. All children items will be deleted cause you're deleting the parent.",
"Cancel": "Cancel",
"Yes, remove!": "Yes, remove!",
"Add Menu item": "Add Menu item",
"Name": "Name",
"Slug": "Slug",
"Menu Helper": "Menu Helper",
"Link type": "Link type",
"Choose an option": "Choose an option",
"Static Url": "Static Url",
"Dynamic Route": "Dynamic Route",
"URL": "URL",
"Route": "Route",
"Parameters": "Parameters",
"Open in": "Open in",
"Same window": "Same window",
"New window": "New window",
"Classes": "Classes",
"Create menu item": "Create menu item",
"Update menu item": "Update menu item",
"Item removed successfully!": "Item removed successfully!",
"Item created!": "Item created!",
"Item updated!": "Item updated!",
"Menu reordered!": "Menu reordered!",
"Error on server!": "Error on server!",
"Enabled": "Enabled",
"Disabled": "Disabled"

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Postcardware

You're free to use this package, but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.

Our address is: Infinety - Calle Comedias, 8 Floor 3, Suite 5 46003 Valencia (Spain).

Credits

License

The MIT License (MIT). Please see License File for more information.

nova-menu-builder's People

Contributors

atmonshi avatar hellozach avatar hofmannsven avatar kikoseijo avatar krato avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nova-menu-builder's Issues

Ambiguous table name

Thanks in advance! i love this one ! works pretty nice.

I can't use it by default, I have a table called "menu" so i get a error :P

Could be nice add a prefix , in_menu for example.

Thanks anyway !

Call to a member function authorize() on string

Hello,

I've just installed this and am having some issues getting it working. Laravel 5.8, Nova 2.0.5 and getting the following error when trying to load or create items:

Call to a member function authorize() on string

Thanks

Get menu name in blade files?

Is there a way to get the menu name in my blade views?
I'm not using Vue in my website front views so I can't properly use the json feature.

Also I'm not sure about this but if I want to test if the menu exists I'll do something like this:

@if (menu_builder('main'))
    {!! menu_builder('main') !!}
@endif

But what if somehow I change the slug? I wonder if there's a better way to achieve this.

Thx for your work anyways :)

Adding Menu Items Causes Flashing and Loss of Focus

On a fresh Laravel 6x install and the latest menu builder I can easily create a new menu but when adding a new menu item after each letter is added to an input field onkeyup the popup flashes and the input focus is removed so you need to click into the input field for each character, it does save afterwards.

Class 'Infinety\MenuBuilder\MenuBuilderServiceProvider' not found

Laravel 8
Class Infinety\MenuBuilder\MenuBuilderServiceProvider located in ./vendor/infinety-es/nova-menu-builder/src/ToolServiceProvider.php does not comply with psr-4 autoloading standard. Skipping.
Class 'Infinety\MenuBuilder\MenuBuilderServiceProvider' not found

Please rename ToolServiceProvider.php to MenuBuilderServiceProvider.php

Class "nav-link" in menu settings

It is not good code:
/vendor/infinety-es/nova-menu-builder/src/Http/Models/MenuItems.php return '<a class="nav-link '.$this->classes.'" href="'.$this->link.'" target="'.$this->target.'">'.$this->name.'</a>';
I propose to bring this parameter to this place - /nova/resources/menu-builder/1/edit
Do you need help?

Laravel 6 Compatibility

I've just upgraded to Laravel 6 and experiencing issues with the menu builder that references old methods, any updates when Laravel 6 will be supported?

Call to undefined function Infinety\MenuBuilder\Http\Models\starts_with()

nav-link is hardcoded

There is a link class of nav-link hardcoded into the model, it would be best to allow this to be overridden or added just like you do with the parent and child classes.

Active menu item

Im really liking this menu package for nova. Thank you for all the effort.

Is there a way to extend the ability to also add the active class to the li when the routes match? as well as a class to the a:href tag within the li?

Dynamic Routes?

I have tried to add a dynamic route where the route name is defined but keep getting an error message to say the route is not a real route name.

In my web.php file, I have a route defined for blog, so I put blog into the name but always get the same message.

How do you define a route properly in the menu manager?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.