Feature #17607
More than one ContextMenu on single page
Status: | New | Start date: | ||
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | - | % Done: | 0% | |
Category: | Core Plugins | |||
Target version: | Candidate for next major release | |||
Resolution: |
Description
We have to use multiple queries on single page ( it's quite ugly code yet :) ) and we found problem - multiple context menus in one page (practically in multiple tabs), current behaviour is dimensioned for one menu. We rewrote it as Jquery plugin. We're thinking, the new version can be easy extends with other abilities (for example - handling window resizing and change position of menu elements, different events).
Example (output) javascript:
//<![CDATA[ $('#issue_list').contextMenu({ url: '/issues/context_menu''}); //]]>
Example helper:
def context_tab_menu(url, el) unless @context_tab_menu_included content_for :header_tags do javascript_include_tag('context_menu') + stylesheet_link_tag('context_menu') end if l(:direction) == 'rtl' content_for :header_tags do stylesheet_link_tag('context_menu_rtl') end end @context_tab_menu_included = true end javascript_tag "$('#{el}').contextMenu({ url: '#{ url_for(url) }'});" end
Template:
<%= context_tab_menu issues_context_menu_path, '#issue_list' %>
Note: The first element is div around form element it's because we're using ajax to refresh query result (multiple queries), we have to bind context menu handler on it.
History
#1
Updated by Etienne Massip over 6 years ago
- Target version set to Candidate for next major release