Coder Social home page Coder Social logo

davicotico / jquery-menu-editor Goto Github PK

View Code? Open in Web Editor NEW
191.0 11.0 86.0 327 KB

Multilevel Menu Editor for Bootstrap 4.x (Html & Javascript code)

Home Page: https://davidticona.com/demos/jQuery-Menu-Editor/

License: MIT License

JavaScript 100.00%
jquery jquery-plugin menu menu-generator menu-builder

jquery-menu-editor's People

Contributors

davicotico 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jquery-menu-editor's Issues

Disable drag and drop

Hello, thank you very much for this project. I have a doubt. Is it possible to disable drag and drop and manipulate li just by the buttons?

Thanks.

Open to licence change?

I would love to use this plugin in my project Saltcorn (https://github.com/saltcorn/saltcorn) which is MIT licensed. I don't think I can do this without relicensing my entire project under the GPL - see discussion https://opensource.stackexchange.com/questions/4360/what-are-the-implications-of-licensing-a-javascript-library-under-gpl. Would you be open to changing the licence for jQuery-Menu-Editor to a licence that would allow projects to use it without then needing to apply the GPL to the entire importing project? Of course if you don't want to do this, then I understand.

Move menu item to top/bottom of the list

Hi,

I was looking at the documentation and I couldn't find an option to add a button against menu items to move them to the top or to the bottom of the list. Can someone help me with this?

touch start event Error.

Getting the following violation running php 7.3.10 with jQuery 3.3.1 on a https:// localhost server.
touchstart

[Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/574554379596595
jquery-3.3.1.min.js:2

Would be nice if you had the code for saving to a MySQLi database.

Double deleting confirmation with 2 menu editors on page

When you have a page with 2 menu editors, using the same buttons and whatever, an event is attached twice to the same element (line 1117), which causes a popup message to appear twice.

Solution: remove the click event listener before setting it.

Menu starting as everyone had children

Hello, im starting the menu like this:

`

    $(document).ready(function(){
            $.ajax({
                type: "POST",
                url: "{{ route('menu.getMenu') }}",
                data: {},
                success: function(data){
                    arrayjson = data;
                    editor.update();
                    editor.setData(arrayjson);
                    // console.log(data);
                },error: function(data){
                    console.log(data.responseText);
                }
            });
        })`

And show as like all the menus had children:

image

But just the last had an child.
If I drag a menu, the bug was fixed:

image

Custom fields

Hi
My menu uses another fields, like display_name, type, url (instead of href), it doesn't use target, for example.
Is it possible to modify the field list without having to hack too much code? Is there an API to which I can pass the fields list?
Thanks!

Improve programmatic control of the menu

Not currently possible, it heavily relies on markup, and there is little programmatic control. The current way of manipulating items is by getting the existing menu items, merging that with whatever items you wanna add and push the merged data to the editor via setData.

Might create a PR for this.

.net core example

using Newtonsoft.Json.Linq;
using System;
using System.IO;

namespace ConsoleApp2
{

internal class Program
{

    static string DisplayArray(string target, string href, string text, bool li_type=false)
    {
        if (li_type == false)
        {
            if (target.ToString() != "_self")
            {
                return "<li><a target=\"" + target + "\" href=\"" + href + "\" class=\"nav-link text-left\">" + text + "</a></li>\n";
            }
            else
            {
                return "<li><a  href=\"" + href + "\" class=\"nav-link text-left\">" + text + "</a></li>\n";
            }
        }
        else
        {
            return "<a  href=\"" + href + "\" class=\"nav-link text-left\">" + text + "</a>\n";
        }
      
    }

    private static void Main(string[] args)
    {
        string menu = "";
        string jsonFile = @"C:\menu.json";
        var json = File.ReadAllText(jsonFile);

        try
        {
            var jObject = JObject.Parse(json);

            if (jObject != null)
            {
                JArray experiencesArrary = (JArray)jObject["menuList"];

                if (experiencesArrary != null)
                {
                    foreach (var item in experiencesArrary)
                    {

                        if (item["children"] != null)
                        {
                            menu += "<li class=\"has-children\">\n";
                            menu += DisplayArray(item["target"].ToString(), item["href"].ToString(), item["text"].ToString());
                            
                            menu += "<ul class=\"dropdown\">\n";
                            foreach (var itemChild in item["children"])
                            {
                                menu += DisplayArray(itemChild["target"].ToString(), itemChild["href"].ToString(), itemChild["text"].ToString());
                            }
                            menu += "</ul>\n";
                            menu += "</li>";
                        } else
                        {
                            menu += "<li>\n";
                            menu += DisplayArray(item["target"].ToString(), item["href"].ToString(), item["text"].ToString(),true);
                            menu += "</li>";
                        }
                    }
                   
                    Console.WriteLine(menu);
                }
            }
        }
        catch (Exception)
        {
            throw;
        }
    }
}

}

iconClass not found

In my environment, i get undefined for 'fa' class so my icon classes are set as 'undefined fa-icon-name' which results in no icon being showing up.

So, as a work around, i changed the jquery-menu-editor.js a bit,

iconPicker.on('change', function (e) {
        //var iconClass = (e.iconClass!=='') ? iconClass+' ' : '';
        var iconClass = "";
        if((typeof e.iconClass === 'undefined') || (e.iconClass === ''))
        {
            console.log('undefined iconclass');
            iconClass = "fa ";
        }
        $("#mnu_icon").val(iconClass+e.icon);
        console.log($("#mnu_icon").val());
        //console.log()
    });

doing this, issue is resolved but i want to know from where iconClass can be set so that issue does not show up with default setup.

tooltip isn't working

I updated tooltip in json but it isn't working i dont know why. Can you help ? I checked demo also there itself it is not working.

Stop drag level

How can i stop dragging the list on three level? i mean to say the parent should have only two level.
capture

i don't want more than three level like the picture below
capture_2

Add additional attributes to an item

is it posible to add an extra attribute to the output?

I added an extra field to the add/edit form, but this field will not be added to the JSON output. also, when I edit the added menu item, this field will not restore the value in the form.

Radio button groups do not work

If you have a radio button group in the form, the value does not get copied over to the form when pressing edit.

From looking at the source code, I suspect there may also be a problem if you use a checkbox. This is probably a more serious problem, because checkboxes are more popular than radio groups

drag only in menu

it's possible don't drag in a submenu
like this example
Menu1
*submenu1
*Submenu2
Menu2
*Submenus

All fields not filled with json values

I pass json like that:

[
   {
      "text":"Opcion2",
      "icon":"fa fa-bar-chart-o",
      "href":"http://home.com",
      "target":"_top",
      "title":"test2"
   },
   {
      "text":"Home",
      "icon":"fa fa-home",
      "href":"http://home.com",
      "target":"_blank",
      "title":"test1"
   }
]

What I want is to pass data first time when 'Edit' button is clicked. But when I click 'edit' button it does not add json values automatically to the 'target' and 'title' fields during page refresh. Or in other words "target" and "title" fields are always empty on first time 'edit' click.

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.