Actions
Feature #17607
openMore than one ContextMenu on single page
Status:
New
Priority:
Normal
Assignee:
-
Category:
Core Plugins
Target version:
Start date:
Due date:
% Done:
0%
Estimated time:
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.
Files
Updated by Etienne Massip over 10 years ago
- Target version set to Candidate for next major release
Actions