ARCHIVED
!注意“归档”
This chapter has not been updated for the current version of Orchard, and has been ARCHIVED.
Navigation and search are an essential part of CMS applications. This specification aims at defining the default navigation menu generation experience.
导航和搜索是CMS应用程序的重要组成部分。该规范旨在定义默认导航菜单生成体验。
Scenarios
方案
The application contains one main menu by default
该应用程序默认包含一个主菜单
The application comes preconfigured with one static menu that is present in the header include of the default templates.
该应用程序预先配置了一个静态菜单,该菜单包含在默认模板的标题中。
The current implementation only allows one global flat menu for the whole site.
当前实现仅允许整个站点的一个全局平面菜单。
A menu item consists of a name, description, and target route/url
菜单项由名称,描述和目标路径/ URL组成
The name and description can have their default values extracted from the object being pointed to if available, and can be overridden on the menu item.
如果可用,名称和描述可以从指向的对象中提取其默认值,并且可以在菜单项上覆盖。
The choice of the target route or URL is made through a URL editor that should eventually become standard and shared for other components to use (for the moment it's just a textbox with validation).
目标路径或URL的选择是通过URL编辑器进行的,该编辑器最终应成为标准并共享供其他组件使用(目前它只是一个带验证的文本框)。
Menu items can either point to a statically determined URL, or they can be attached to a routable content item, in which case the URL is not editable but is instead provided by the item's routable aspect.
菜单项可以指向静态确定的URL,也可以附加到可路由的内容项,在这种情况下,URL不可编辑,而是由项的可路由方面提供。
An administrator can manage the set of menus and menu items from the application's admin panel
管理员可以从应用程序的管理面板管理菜单和菜单项集
The application currently supports only one menu, without support for nested menus.
该应用程序目前仅支持一个菜单,不支持嵌套菜单。
The administrator can create new named menus and modify or delete existing ones.
管理员可以创建新的命名菜单并修改或删除现有菜单。
An administrator can add, enable/disable, reorder, nest and delete menu items within a menu.
管理员可以在菜单中添加,启用/禁用,重新排序,嵌套和删除菜单项。
The main menu display is determined by a menu template included in the header template, so the markup is customizable by a theme author
主菜单显示由包含在标题模板中的菜单模板确定,因此标记可由主题作者自定义
Displaying the menu is done by including a partial view and giving it a specific named menu as the model. That partial view can be modified and overridden by themes.
显示菜单是通过包括部分视图并为其指定特定的命名菜单来完成的。部分视图可以被主题修改和覆盖。
In the current implementation, there is only one menu, and the partial view is simply named menu.ascx.
在当前实现中,只有一个菜单,部分视图简称为menu.ascx。
The application may optionally contain one or more sub-menus to be displayed within application sidebar zones
应用程序可以可选地包含要在应用程序侧栏区域内显示的一个或多个子菜单
Those "sub-menus" actually are other named menus. Until we build widgets, these other menus will have to be manually added to templates.
那些“子菜单”实际上是其他命名菜单。在我们构建小部件之前,必须手动将这些其他菜单添加到模板中。
Not implemented.
未实现。
A navigation menu displays contextual links for every content item
导航菜单显示每个内容项的上下文链接
Such a dynamic menu may be implemented as a helper API that asks all content providers to give parents, children (optionally hierarchical to a specified depth) and siblings from a given content item. The results of this call could then get rendered by a partial view using it as the model.
这样的动态菜单可以实现为帮助API,其要求所有内容提供者给予父母,孩子(可选地分层到指定的深度)和来自给定内容项的兄弟姐妹。然后,使用它作为模型,可以通过局部视图呈现此调用的结果。
Not implemented.
未实现。
A user can choose to add a page or post to a menu as part of the page/post editing interface
用户可以选择将页面或帖子添加到菜单中作为页面/帖子编辑界面的一部分
This should be on by default for pages, off by default for posts.
对于页面,默认情况下应该启用此选项,默认情况下关闭帖子。
The UI to add an item to a menu consists of a checkbox ("Included in navigation menu") and a name textbox that is pre-filled by default with the title of the item.
将项目添加到菜单的UI包含一个复选框(“包含在导航菜单中”)和一个名称文本框,默认情况下预先填充该项目的标题。
A menu widget can be configured to display the contents of a menu
菜单小部件可以配置为显示菜单的内容
See Widgets section for more detail. This is essentially the same scenario as above, except that the partial view is encapsulated into a widget. Will be implemented when the widget infrastructure exists.
有关详细信息,请参阅小部件部分。除了将局部视图封装到窗口小部件中之外,这基本上与上面的场景相同。将在窗口小部件基础结构存在时实现。
Not implemented.
未实现。
The menu widget may be configured to show a static or dynamic set of items
菜单小部件可以被配置为显示静态或动态的项目集
The dynamic behavior is to display only the parent/children of the currently displayed item.
动态行为是仅显示当前显示项的父/子。
Not implemented. Only one static menu at the moment.
未实现。目前只有一个静态菜单。
The main menu and menu widget have progressive expand/collapse behavior
主菜单和菜单小部件具有渐进式扩展/折叠行为
The menu widget has a setting for the depth at which it represents the site hierarchy. When JavaScript is not enabled, the sub-menus have a statically defined CSS class that hides them (the downlevel experience could actually be CSS dynamic menus). When JavaScript is enabled, better expansion logic can be added, using a jQuery plug-in preferably (developing a complete JavaScript menu is not a trivial task and could become a project in itself. We should concentrate first on the core scenario).
菜单小部件具有表示站点层次结构的深度设置。当未启用JavaScript时,子菜单具有静态定义的CSS类(隐藏它们)(下层体验实际上可能是CSS动态菜单)。当启用JavaScript时,可以添加更好的扩展逻辑,最好使用jQuery插件(开发完整的JavaScript菜单不是一项简单的任务,可以自己成为一个项目。我们应该首先关注核心场景)。
Not implemented.
未实现。
The application exposes an API for accessing menus and menu items that can be called from user code in a template/view
该应用程序公开了一个API,用于访问可以从模板/视图中的用户代码调用的菜单和菜单项
The API that asks content providers to contribute menu hierarchies knowing the current item could also take a menu name. This way, the "static" named menus could just be a special, default case of dynamic menus.
要求内容提供商提供菜单层次结构的API,知道当前项目也可以采用菜单名称。这样,“静态”命名菜单可能只是动态菜单的特殊默认情况。
Not implemented.
未实现。
Permissions
权限
The owner in this context is the site owner.
此上下文中的所有者是网站所有者。
Permission | Anon. | Authentic. | Owner | Admin. | Author | Editor
许可|匿名。 |真实。 |所有者|管理员。 |作者|编辑
---------------------- | ----- | ---------- | ----- | ------ | ------ | ------
- | ----- | ---------- | ----- | ------ | ------ | ------
Manage navigation menu | No | No | Yes | Yes | No | No
管理导航菜单|没有|没有|是的|是的|没有|没有