[v2.0] Admin navigation

182 views
Skip to first unread message

Fahad Ibnay Heylaal

unread,
Oct 10, 2011, 6:15:06 PM10/10/11
to Croogo
Admin navigation can be managed by a static class. Plugin elements won't be necessary any more then.

Let's say, there is a class called CroogoNav. From our Example plugin's bootstrap, we can do this:

// bootstrap
CroogoNav::add('content', array(
    'title' => 'Content'
    'link' => '#',
    'weight' => 5, // for ordering
    'access' => array('admin', 'role1', 'role2'),
    'children' => array(),
));

// If we wanted to inject a new link UNDER Content link:
CroogoNav::add('content.children.new_link_alias', array(
    'title' => 'Link under Content',
    'link' => '#',
    'weight' => 10,
    'access' => array('admin'),
    'children' => array(),
));
 
Notice the first argument of the method. As long as we maintain a valid dot separated path, we can utilize Set class to do the magic. And can generate an unordered list from the layout when required.

--
Fahad Ibnay Heylaal
http://fahad19.com

Rachman Chavik

unread,
Oct 10, 2011, 8:18:56 PM10/10/11
to cro...@googlegroups.com
Fahad,
  • What would be the format of the 'link' parameter? Router::url() compatible ?
  • To avoid having too many things chucked into config/plugin_bootstrap.php, I'd suggest to have menu configuration in a separate config, eg: config/admin_menu.php.
  • For the first parameter, I understand that we could go for unlimited number of children? ie:
    CroogoNav::add('content.children.new_link_alias.children.third_level.children.fourth_level', array(....));
Awesome!

Regards,

John

unread,
Oct 10, 2011, 11:10:42 PM10/10/11
to Croogo
If these menus were created in a model would be easily organized using
the tree behavior, see example book.cakephp.org/view/1339/Tree, after
save add in cache by 6 months (or until receive new changes)


This CroogoNav is very like that WordPress menu class, very flexible.




On 10 out, 20:18, Rachman Chavik <rcha...@gmail.com> wrote:
> Fahad,
>
>    - What would be the format of the 'link' parameter? Router::url()
>    compatible ?
>    - To avoid having too many things chucked into
>    config/plugin_bootstrap.php, I'd suggest to have menu configuration in a
>    separate config, eg: config/admin_menu.php.
>    - For the first parameter, I understand that we could go for unlimited

Stefano Zoffoli

unread,
Oct 11, 2011, 4:56:54 AM10/11/11
to cro...@googlegroups.com
I like it!

--
Dott. Stefano Zoffoli
Web Development & Internet Technologies

Librasoft Snc
http://www.librasoftsnc.it
Via della Luna, 13
47034 Forlimpopoli (FC)
Tel. +39 0543 424612
Fax +39 0543 424612


2011/10/11 John <hostde...@vibemidia.com>
>    array(....));
>
> Awesome!
>
> Regards,

--
You received this message because you are subscribed to the Croogo mailing list.
To post to this group, send email to cro...@googlegroups.com
To unsubscribe from this group, send email to
croogo+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/croogo?hl=en
Visit the official website at http://www.croogo.org

Fahad Ibnay Heylaal

unread,
Oct 11, 2011, 8:32:02 AM10/11/11
to cro...@googlegroups.com
On Tue, Oct 11, 2011 at 1:18 AM, Rachman Chavik <rch...@gmail.com> wrote:
Fahad,
  • What would be the format of the 'link' parameter? Router::url() compatible ?
Likely 
  • To avoid having too many things chucked into config/plugin_bootstrap.php, I'd suggest to have menu configuration in a separate config, eg: config/admin_menu.php.
You can always include() a file from bootstrap if you wish to keep things separate.
  • For the first parameter, I understand that we could go for unlimited number of children? ie:
    CroogoNav::add('content.children.new_link_alias.children.third_level.children.fourth_level', array(....)); 
Yes, unlimited. And inject anywhere.

Fahad Ibnay Heylaal

unread,
Oct 11, 2011, 8:41:38 AM10/11/11
to cro...@googlegroups.com
Involvement of database and models is not needed for admin navigation. Ordering can be maintained by the 'weight' key of links.

--
Fahad Ibnay Heylaal
http://fahad19.com


>    array(....));
>
> Awesome!
>
> Regards,

John

unread,
Oct 14, 2011, 7:16:37 AM10/14/11
to Croogo
@ FAHAD
ohh, had not understood before. +1



On 11 out, 08:41, Fahad Ibnay Heylaal <faha...@gmail.com> wrote:
> Involvement of database and models is not needed for admin navigation.
> Ordering can be maintained by the 'weight' key of links.
>
> --
> Fahad Ibnay Heylaalhttp://fahad19.com

Rachman Chavik

unread,
Nov 21, 2011, 8:54:51 AM11/21/11
to cro...@googlegroups.com
Hi guys,

FYI, I'm working on this item now on the 1.4 branch.  I will post more when it looks better.

It should be easily rebased for 2.0 later.

Rachman Chavik

unread,
Nov 22, 2011, 12:12:51 AM11/22/11
to cro...@googlegroups.com
On Monday, November 21, 2011 8:54:51 PM UTC+7, Rachman Chavik wrote:
Hi guys,

FYI, I'm working on this item now on the 1.4 branch.  I will post more when it looks better.
Reply all
Reply to author
Forward
0 new messages