如何允许用户修改前端菜单?

时间:2022-09-11 10:35:24

I am writing a backend/admin area for a website. The users want the ability to modify their menu's on the website.

我正在为网站编写后端/管理区域。用户希望能够修改网站上的菜单。

  • These menus can be hierachical no more than 3 levels deep.
  • 这些菜单的层次结构不超过3层。

  • Do you allow users to do this?
  • 你允许用户这样做吗?

  • How do you store the hierarchy?
  • 你如何存储层次结构?

  • How do you programmatically display the menu?
  • 你如何以编程方式显示菜单?

  • How do you make it easy for users to create hierarchies - some sort of jQuery drag/drop?
  • 如何让用户轻松创建层次结构 - 某种jQuery拖放?

Look forward to your replies.

期待您的回复。

4 个解决方案

#1


Do you allow users to do this? No, but admins on some sites. (Though none built with MVC or jQuery.)

你允许用户这样做吗?不,但在一些网站上的管理员。 (虽然没有使用MVC或jQuery构建。)

How do you store the heirarchy? In a table, with a parent-field.

你如何存储层次结构?在表中,使用父字段。

How do you programmatically display the menu? I iterate throught the table and output HTML.

你如何以编程方式显示菜单?我遍历表并输出HTML。

How do you make it easy for users to create heirarchies - some sort of jQuery drag/drop? Make menu-editing page, where you output the menu in the content-area of your page, and then use something like jQuery sortable plugin to move things around, and custom code to delete and insert new items.

如何让用户轻松创建heirarchies - 某种jQuery拖放?制作菜单编辑页面,在页面的内容区域中输出菜单,然后使用jQuery可排序插件等移动内容,以及删除和插入新项目的自定义代码。

#2


These menus can be heirachical no more than 3 levels deep. OK

这些菜单可以是heirachical不超过3级。好

Do you allow users to do this? Not generally, but I can see cases where this might be useful.

你允许用户这样做吗?一般情况下,但我可以看到这可能有用的情况。

How do you store the heirarchy? In a table in the database, by user ID. You also need a column in the table to implement the hierarchy, and another table to contain the menu options and base URLs.

你如何存储层次结构?在数据库的表中,按用户ID。您还需要表中的列来实现层次结构,还需要另一个表来包含菜单选项和基本URL。

How do you programmatically display the menu? That's a tricky one. You have to find a way to push the menu hierarchy into the page from the controller. JSON seems a likely candidate. Something from jQuery UI should be able to pick up this JSON and render a menu for you.

你如何以编程方式显示菜单?这是一个棘手的问题。您必须找到一种方法将菜单层次结构从控制器推入页面。 JSON似乎很有可能成为候选人。来自jQuery UI的东西应该能够获取此JSON并为您呈现菜单。

How do you make it easy for users to create heirarchies - some sort of jQuery drag/drop? jQuery UI has a Drag-drop feature.

如何让用户轻松创建heirarchies - 某种jQuery拖放? jQuery UI具有拖放功能。

Good Luck!

#3


Jon,

Have a look at this link for additional ideas:

有关其他想法,请查看此链接:

http://www.webappers.com/2007/09/05/smooth-and-clean-fastfind-menu-jquery-plugin/

FastFind Menu Script is a javascript menu created by ActiveSpotLight under the BSD License. It pulls a content feed as data to populate the menu, this can be static or dynamic. The version they use internally uses JSON/XML as data feeds. This script allows for nested menus, based on dynamic Ajax responses. The menu can also be dragged/dropped by using the jQuery Interface Library.

FastFind菜单脚本是由ActiveSpotLight在BSD许可下创建的javascript菜单。它将内容提要作为数据填充以填充菜单,这可以是静态的或动态的。他们在内部使用的版本使用JSON / XML作为数据馈送。此脚本允许基于动态Ajax响应的嵌套菜单。也可以使用jQuery接口库拖放菜单。

#4


You ask a lot of questions man ;)

你问了很多问题的人;)

You obviously know about jQuery, hence the tag... jQuery will make your life so easy. Please take a look at jQuery UI, that will solve all your problems: http://jqueryui.com/

你显然知道jQuery,因此标签...... jQuery会让你的生活变得如此简单。请查看jQuery UI,它将解决您的所有问题:http://jqueryui.com/

#1


Do you allow users to do this? No, but admins on some sites. (Though none built with MVC or jQuery.)

你允许用户这样做吗?不,但在一些网站上的管理员。 (虽然没有使用MVC或jQuery构建。)

How do you store the heirarchy? In a table, with a parent-field.

你如何存储层次结构?在表中,使用父字段。

How do you programmatically display the menu? I iterate throught the table and output HTML.

你如何以编程方式显示菜单?我遍历表并输出HTML。

How do you make it easy for users to create heirarchies - some sort of jQuery drag/drop? Make menu-editing page, where you output the menu in the content-area of your page, and then use something like jQuery sortable plugin to move things around, and custom code to delete and insert new items.

如何让用户轻松创建heirarchies - 某种jQuery拖放?制作菜单编辑页面,在页面的内容区域中输出菜单,然后使用jQuery可排序插件等移动内容,以及删除和插入新项目的自定义代码。

#2


These menus can be heirachical no more than 3 levels deep. OK

这些菜单可以是heirachical不超过3级。好

Do you allow users to do this? Not generally, but I can see cases where this might be useful.

你允许用户这样做吗?一般情况下,但我可以看到这可能有用的情况。

How do you store the heirarchy? In a table in the database, by user ID. You also need a column in the table to implement the hierarchy, and another table to contain the menu options and base URLs.

你如何存储层次结构?在数据库的表中,按用户ID。您还需要表中的列来实现层次结构,还需要另一个表来包含菜单选项和基本URL。

How do you programmatically display the menu? That's a tricky one. You have to find a way to push the menu hierarchy into the page from the controller. JSON seems a likely candidate. Something from jQuery UI should be able to pick up this JSON and render a menu for you.

你如何以编程方式显示菜单?这是一个棘手的问题。您必须找到一种方法将菜单层次结构从控制器推入页面。 JSON似乎很有可能成为候选人。来自jQuery UI的东西应该能够获取此JSON并为您呈现菜单。

How do you make it easy for users to create heirarchies - some sort of jQuery drag/drop? jQuery UI has a Drag-drop feature.

如何让用户轻松创建heirarchies - 某种jQuery拖放? jQuery UI具有拖放功能。

Good Luck!

#3


Jon,

Have a look at this link for additional ideas:

有关其他想法,请查看此链接:

http://www.webappers.com/2007/09/05/smooth-and-clean-fastfind-menu-jquery-plugin/

FastFind Menu Script is a javascript menu created by ActiveSpotLight under the BSD License. It pulls a content feed as data to populate the menu, this can be static or dynamic. The version they use internally uses JSON/XML as data feeds. This script allows for nested menus, based on dynamic Ajax responses. The menu can also be dragged/dropped by using the jQuery Interface Library.

FastFind菜单脚本是由ActiveSpotLight在BSD许可下创建的javascript菜单。它将内容提要作为数据填充以填充菜单,这可以是静态的或动态的。他们在内部使用的版本使用JSON / XML作为数据馈送。此脚本允许基于动态Ajax响应的嵌套菜单。也可以使用jQuery接口库拖放菜单。

#4


You ask a lot of questions man ;)

你问了很多问题的人;)

You obviously know about jQuery, hence the tag... jQuery will make your life so easy. Please take a look at jQuery UI, that will solve all your problems: http://jqueryui.com/

你显然知道jQuery,因此标签...... jQuery会让你的生活变得如此简单。请查看jQuery UI,它将解决您的所有问题:http://jqueryui.com/