Adds an helper for creating the context menu.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3542 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
12759fd416
commit
bd5fe10c13
@ -661,6 +661,17 @@ module ApplicationHelper
|
|||||||
), :class => 'progress', :style => "width: #{width};") +
|
), :class => 'progress', :style => "width: #{width};") +
|
||||||
content_tag('p', legend, :class => 'pourcent')
|
content_tag('p', legend, :class => 'pourcent')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def context_menu(url)
|
||||||
|
unless @context_menu_included
|
||||||
|
content_for :header_tags do
|
||||||
|
javascript_include_tag('context_menu') +
|
||||||
|
stylesheet_link_tag('context_menu')
|
||||||
|
end
|
||||||
|
@context_menu_included = true
|
||||||
|
end
|
||||||
|
javascript_tag "new ContextMenu('#{ url_for(url) }')"
|
||||||
|
end
|
||||||
|
|
||||||
def context_menu_link(name, url, options={})
|
def context_menu_link(name, url, options={})
|
||||||
options[:class] ||= ''
|
options[:class] ||= ''
|
||||||
|
@ -78,9 +78,6 @@
|
|||||||
<% content_for :header_tags do %>
|
<% content_for :header_tags do %>
|
||||||
<%= auto_discovery_link_tag(:atom, {:query_id => @query, :format => 'atom', :page => nil, :key => User.current.rss_key}, :title => l(:label_issue_plural)) %>
|
<%= auto_discovery_link_tag(:atom, {:query_id => @query, :format => 'atom', :page => nil, :key => User.current.rss_key}, :title => l(:label_issue_plural)) %>
|
||||||
<%= auto_discovery_link_tag(:atom, {:action => 'changes', :query_id => @query, :format => 'atom', :page => nil, :key => User.current.rss_key}, :title => l(:label_changes_details)) %>
|
<%= auto_discovery_link_tag(:atom, {:action => 'changes', :query_id => @query, :format => 'atom', :page => nil, :key => User.current.rss_key}, :title => l(:label_changes_details)) %>
|
||||||
<%= javascript_include_tag 'context_menu' %>
|
|
||||||
<%= stylesheet_link_tag 'context_menu' %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div id="context-menu" style="display: none;"></div>
|
<%= context_menu :controller => 'issues', :action => 'context_menu' %>
|
||||||
<%= javascript_tag "new ContextMenu('#{url_for(:controller => 'issues', :action => 'context_menu')}')" %>
|
|
||||||
|
@ -31,12 +31,6 @@
|
|||||||
<% end if @blocks['right'] %>
|
<% end if @blocks['right'] %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% content_for :header_tags do %>
|
<%= context_menu :controller => 'issues', :action => 'context_menu' %>
|
||||||
<%= javascript_include_tag 'context_menu' %>
|
|
||||||
<%= stylesheet_link_tag 'context_menu' %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<div id="context-menu" style="display: none;"></div>
|
|
||||||
<%= javascript_tag "new ContextMenu('#{url_for(:controller => 'issues', :action => 'context_menu')}')" %>
|
|
||||||
|
|
||||||
<% html_title(l(:label_my_page)) -%>
|
<% html_title(l(:label_my_page)) -%>
|
||||||
|
@ -7,7 +7,8 @@ ContextMenu = Class.create();
|
|||||||
ContextMenu.prototype = {
|
ContextMenu.prototype = {
|
||||||
initialize: function (url) {
|
initialize: function (url) {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
|
this.createMenu();
|
||||||
|
|
||||||
// prevent text selection in the issue list
|
// prevent text selection in the issue list
|
||||||
var tables = $$('table.issues');
|
var tables = $$('table.issues');
|
||||||
for (i=0; i<tables.length; i++) {
|
for (i=0; i<tables.length; i++) {
|
||||||
@ -95,6 +96,15 @@ ContextMenu.prototype = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
createMenu: function() {
|
||||||
|
if (!$('context-menu')) {
|
||||||
|
var menu = document.createElement("div");
|
||||||
|
menu.setAttribute("id", "context-menu");
|
||||||
|
menu.setAttribute("style", "display:none;");
|
||||||
|
document.getElementById("content").appendChild(menu);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
showMenu: function(e) {
|
showMenu: function(e) {
|
||||||
var mouse_x = Event.pointerX(e);
|
var mouse_x = Event.pointerX(e);
|
||||||
var mouse_y = Event.pointerY(e);
|
var mouse_y = Event.pointerY(e);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user