多级选项卡式界面的控制器、操作助手或视图助手
此问题与此处提出的有关最佳实践的问题相关用于处理选项卡式界面。它引用了一篇标题为“Why the Zend Framework Actionstack is Evil”的博客文章,其中概述了您应该对将重用的元素使用部分和视图帮助器。这很好,直到元素必须处理一些输入,在这种情况下,视图助手不是答案。这就是您使用操作助手的地方,Matthew Weier O'Phinney 在他的题为“使用操作助手实现可重用小部件”的博客文章中讨论了这个用例。
阅读这些观点后,我似乎对界面的最佳操作方案更加困惑。该网站将由三个主要选项卡组成:“案例”、“员工”和“案例”。部门。这些选项卡中的每一个都将遵循类似的布局,包括选择器/搜索表、(案例|员工|部门)摘要,然后是具有垂直选项卡菜单的另一个区域。主选项卡将具有一些相同的垂直选项卡项目,除了显示的信息之外。
问题是如何围绕这个界面构建视图、助手和控制器。我正在考虑建立一个索引、案例、工作人员和部门主管。创建一个操作助手,它将重用每个主要选项卡的视图,但使用请求数据来确定当前选择的选项卡(案例|员工|部门)。使用单独的选项卡控制器处理垂直选项卡内容的 jQuery ajax 请求,并将输出委托给视图助手,该视图助手将重用公共视图。还可以使用单独的选项卡控制器来处理 jQuery ajax CRUD 操作。
这是最好的方法吗,还是有更好更有效的方法?
This question is related to the question asked here, regarding the best practice for handling tabbed interfaces. It made reference to a blog post titled, Why the Zend Framework Actionstack is Evil, which outlined that you should use partials and view helpers for elements that will be reused. This is fine until the element has to handle some input, in which case view helpers are not the answer. This is where you use action helpers, Matthew Weier O'Phinney talks about a use case for this in his blog post titled, Using Action Helpers To Implement Re-Usable Widgets.
After reading these viewpoints I seem to be more confused on the best course of action for my interface. The site will consist of three major tabs, Cases, Staff, & Departments. Each of these tabs will follow a similar layout consisting of a selector/search table, a (Case|Staff|Department) summary, and then another area with vertical tab menu. The main tabs will have some vertical tab items that are identical except for the information being displayed.
The question is how do I structure the views, helpers and controllers around this interface. I was thinking of having an index, case, staff and department controller. Creating an action helper which will reuse a view for each major tab, but use the request data to determine the currently selected (Case|Staff|Department). Using the individual tab controllers to handle jQuery ajax requests for the vertical tab content and delegate the output to a view helper which will reuse a common view. And also use the individual tab controllers to handle jQuery ajax crud operations.
Is this the best way to do this, or are there better more efficient methods?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会为三个主要选项卡中的每一个创建单独的控制器。您描述的垂直选项卡将对应于这些控制器上的操作。
为了渲染所有这些导航选项卡 - 顶级和垂直 - 听起来答案是......
Zend_Navigation
(更多信息)。您可以将所有结构化导航数据(可能从 INI 文件或 XML 文件甚至结构化数组中读取)放入单个
Zend_Navigation
容器中,然后呈现“活动”分支。I'd create separate controllers for each of your three main tabs. The vertical tabs you describe would correspond to actions on those controllers.
For rendering all those navigation tabs - top-level and the verticals - it sounds like the answer is....
Zend_Navigation
(more info).You can place all the structured navigation data - probably read from a INI file or from an XML file or even from a structured array - into a single
Zend_Navigation
container and then render the "active" branch.