Code Monkey home page Code Monkey logo

cake-menu_builder's Issues

Trying to Make noLinkFormat work with jQuery UI Accordion

I'm trying to make the noLinkFormat parameter work with jQuery UI Accordion. Theoretically, I need to surround the non-linking menu entry with something distinguishable to jQuery like

tags. Here's what I tried initially:

In the helper array:

'Menu.MenuBuilder' => array(
'noLinkFormat' => '

%s

',
'authField' => 'role',
'authVar' => 'user',
'authModel' => 'Users.User'
),

In the menu array itself:

array(
'title' => 'Learning Resources',
'permissions' => array(''),
'children' => array(
array(
'title' => 'Collections',
'url' => 'admin/collections/index',
and so

Unfortunately, that produced unclickable "Learning Resources" entry in the menu that looked like this in the source code:

  • Home
  • Learning Resources

      So I changed my menu array to look like this:

      array(
      'title' => 'Learning Resources',
      'url' => '#',
      'permissions' => array(''),
      'children' => array(
      array( and so on

      However, cake-menu then totally ignored my noLinkFormat parameter and produced this kind of source code:

    • Home
    • Learning Resources
      • With that, I don't see anything that I can hook jQuery UI accordion onto. Am I missing something? Is there a way to do that? Or to set the parameters to create the kind of hooks that it needs?

  • Travis ci

    Can you add travis ci support to be sur your plugin is fonctionnal

    thx

    Permissions

    I wanted to ask a question about the plugin for cakephp menu builder. I configured everything correctly by following his guide and menu function without problems, but once I try to set the permissions for the users menu item with the "permsissions" disappears even though the user has permission to view it. Can you help me?. Thank you.

    Permissions with Related Role Model

    When I try to use 'permissions' => array('admin') or 'permissions' => array('') it doesn't seem to work, The first never displays, even if an admin user is logged in, and the second always displays even though an admin is logged in. I'm guessing that it's because there is no role or group field in the User model. Instead, there is a role_id field to a related Role model in keeping with an ACL configuration. Is there a way to restrict the display of menu items by role in this situation?

    I've tried including the following settings for MenuBuilder in AppController:

    'Menu.MenuBuilder' => array(
                    'noLinkFormat' => '<div>%s</div>',
                    'authField' => 'role_id',
                ),
    

    In this case, I also tried using the role_id numbers as in 'permissions' => array('1', '2', '3') , but that prevents the display of the menu item even though debug shows that the logged in user has 'role_id' => '1' in his $user array.

    Readme alteration

    Might be worth adding a section about Loading the Plugin to the bootstrap.php

    CakePlugin::load('MenuBuilder');

    if the

    CakePlugin::loadAll();

    is not used.

    Support CakePHP 2.0

    Hi there. Your plugin seems to have saved my life :) I had to restructure it a bit to make it work with 2.0, though it's really just a matter of renaming stuff around. I uploaded it to http://www.morpheu5.net/public/MenuBuilder.tar.bz2 if you want to consider making it a branch.

    PS. I had to use the full syntax for the build method because it seems that something has changed in the way you retrieve the menu array:

    <?php echo $this->MenuBuilder->build('main-menu', array(), $menu['main-menu']) ?>
    

    Permissions Issue

    Hello!
    I'm using the plugin of cakephp menu builder. I've followed the guide but i'm having troubles with the permissions for the users. The menu item with the "permsissions" disappears even though the user has permission to view it. I'm using ACL too, does it have anything to do with that problem?
    Can anyone help me.
    Thanks.

    Permission based setup Doesn't works with Auth.

    Hi ,
    I found issue in your code:
    var user : array( 'id' => '6', 'username' => 'ruslan', 'roll_id' => null, 'group' => 'admin', 'created' => '2016-02-08 12:24:15', 'modified' => '0000-00-00 00:00:00' )
    in your constructor:
    public $settings = array( 'activeClass' => 'active', 'firstClass' => 'first-item', 'childrenClass' => 'has-children', 'menuClass' => null, 'evenOdd' => false, 'itemFormat' => '<li%s>%s%s</li>', 'wrapperFormat' => '<ul%s>%s</ul>', 'wrapperClass' => null, 'noLinkFormat' => '<a href="#">%s</a>', 'menuVar' => 'menu', 'authVar' => 'user', 'authModel' => 'User', 'authField' => 'group', 'indentHtmlOutput' => true, ); if (isset($View->viewVars[$this->settings['authVar']]) && isset($View->viewVars[$this->settings['authVar']][$this->settings['authModel']]) && isset($View->viewVars[$this->settings['authVar']][$this->settings['authModel']][$this->settings['authField']])) { $this->_group = $View->viewVars[$this->settings['authVar']][$this->settings['authModel']][$this->settings['authField']]; }
    $this->_group - Always is null;

    Permissions Not Working

    I'm using CakePHP 2.7 with the CakeDC/Users plugin to manage authentication and access control. When I insert the 'permissions' entry into the Cake-Menu array, it has no effect. Specifically, in my controller $helpers, I have:

    public $helpers = array(
                'Html',
                'Form',
                'Session',
                'Js' => array('jquery'),
                'Menu.MenuBuilder' => array(
                    'noLinkFormat' => '<h3>%s</h3>',
                    'authField' => 'group_id',
                    'authVar' => 'user',
                    'authModel' => 'Users.User'),
            );

    In the pertinent portion of the $menu array, I have this:

    array(
                            'title'    => 'Articles',
                            'url'      => '#',
                            'children' => array(
                                array(
                                    'title' => 'Manage Articles',
                                    'url'   => array(
                                        'plugin'     => FALSE,
                                        'admin'      => TRUE,
                                        'controller' => 'posts',
                                        'action'     => 'index',
                                        'permissions' => array('512b9492-097c-462d-9c34-08b058f5bb4b'),
                                    ),
                                ), array(
                                    'title' => 'Add Article',
                                    'url'   => array(
                                        'plugin'     => FALSE,
                                        'admin'      => TRUE,
                                        'controller' => 'posts',
                                        'action'     => 'add'
                                    ),
                                ),
                            ),

    512b9492-097c-462d-9c34-08b058f5bb4b is the GUID for the admin group and is found in the group_id field for my record in the users table.

    In this example, I would expect to see the Add Article menu entry even when no one is logged in, but only see the Manage Articles entry when an admin, such as me, is logged in. However, the Manage Articles entry is _always_ available -- even when no one is logged in. (I have a display in the footer that shows who is logged in so I can confirm this both ways.) Of course, if I am not logged in and click the Manage Articles menu entry, Auth blocks me from getting to admin_index for Posts, but the menu entry shouldn't show up.

    Any ideas on what I may be doing wrong or what I need to do to make this work?

    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.