##// END OF EJS Templates
Adds an helper for creating the context menu....
Jean-Philippe Lang -
r3428:bd5fe10c13b0
parent child
Show More
@@ -661,6 +661,17 module ApplicationHelper
661 661 ), :class => 'progress', :style => "width: #{width};") +
662 662 content_tag('p', legend, :class => 'pourcent')
663 663 end
664
665 def context_menu(url)
666 unless @context_menu_included
667 content_for :header_tags do
668 javascript_include_tag('context_menu') +
669 stylesheet_link_tag('context_menu')
670 end
671 @context_menu_included = true
672 end
673 javascript_tag "new ContextMenu('#{ url_for(url) }')"
674 end
664 675
665 676 def context_menu_link(name, url, options={})
666 677 options[:class] ||= ''
@@ -78,9 +78,6
78 78 <% content_for :header_tags do %>
79 79 <%= auto_discovery_link_tag(:atom, {:query_id => @query, :format => 'atom', :page => nil, :key => User.current.rss_key}, :title => l(:label_issue_plural)) %>
80 80 <%= auto_discovery_link_tag(:atom, {:action => 'changes', :query_id => @query, :format => 'atom', :page => nil, :key => User.current.rss_key}, :title => l(:label_changes_details)) %>
81 <%= javascript_include_tag 'context_menu' %>
82 <%= stylesheet_link_tag 'context_menu' %>
83 81 <% end %>
84 82
85 <div id="context-menu" style="display: none;"></div>
86 <%= javascript_tag "new ContextMenu('#{url_for(:controller => 'issues', :action => 'context_menu')}')" %>
83 <%= context_menu :controller => 'issues', :action => 'context_menu' %>
@@ -31,12 +31,6
31 31 <% end if @blocks['right'] %>
32 32 </div>
33 33
34 <% content_for :header_tags do %>
35 <%= javascript_include_tag 'context_menu' %>
36 <%= stylesheet_link_tag 'context_menu' %>
37 <% end %>
38
39 <div id="context-menu" style="display: none;"></div>
40 <%= javascript_tag "new ContextMenu('#{url_for(:controller => 'issues', :action => 'context_menu')}')" %>
34 <%= context_menu :controller => 'issues', :action => 'context_menu' %>
41 35
42 36 <% html_title(l(:label_my_page)) -%>
@@ -7,7 +7,8 ContextMenu = Class.create();
7 7 ContextMenu.prototype = {
8 8 initialize: function (url) {
9 9 this.url = url;
10
10 this.createMenu();
11
11 12 // prevent text selection in the issue list
12 13 var tables = $$('table.issues');
13 14 for (i=0; i<tables.length; i++) {
@@ -95,6 +96,15 ContextMenu.prototype = {
95 96 }
96 97 },
97 98
99 createMenu: function() {
100 if (!$('context-menu')) {
101 var menu = document.createElement("div");
102 menu.setAttribute("id", "context-menu");
103 menu.setAttribute("style", "display:none;");
104 document.getElementById("content").appendChild(menu);
105 }
106 },
107
98 108 showMenu: function(e) {
99 109 var mouse_x = Event.pointerX(e);
100 110 var mouse_y = Event.pointerY(e);
General Comments 0
You need to be logged in to leave comments. Login now