diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 593b5a4cc..ff877f18f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -661,6 +661,17 @@ module ApplicationHelper ), :class => 'progress', :style => "width: #{width};") + content_tag('p', legend, :class => 'pourcent') 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={}) options[:class] ||= '' diff --git a/app/views/issues/index.rhtml b/app/views/issues/index.rhtml index eac177c89..66bba490d 100644 --- a/app/views/issues/index.rhtml +++ b/app/views/issues/index.rhtml @@ -78,9 +78,6 @@ <% 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, {: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 %> -
-<%= javascript_tag "new ContextMenu('#{url_for(:controller => 'issues', :action => 'context_menu')}')" %> +<%= context_menu :controller => 'issues', :action => 'context_menu' %> diff --git a/app/views/my/page.rhtml b/app/views/my/page.rhtml index 4d4c921b6..608e23326 100644 --- a/app/views/my/page.rhtml +++ b/app/views/my/page.rhtml @@ -31,12 +31,6 @@ <% end if @blocks['right'] %> -<% content_for :header_tags do %> - <%= javascript_include_tag 'context_menu' %> - <%= stylesheet_link_tag 'context_menu' %> -<% end %> - - -<%= javascript_tag "new ContextMenu('#{url_for(:controller => 'issues', :action => 'context_menu')}')" %> +<%= context_menu :controller => 'issues', :action => 'context_menu' %> <% html_title(l(:label_my_page)) -%> diff --git a/public/javascripts/context_menu.js b/public/javascripts/context_menu.js index dac5076e2..bd3b72618 100644 --- a/public/javascripts/context_menu.js +++ b/public/javascripts/context_menu.js @@ -7,7 +7,8 @@ ContextMenu = Class.create(); ContextMenu.prototype = { initialize: function (url) { this.url = url; - + this.createMenu(); + // prevent text selection in the issue list var tables = $$('table.issues'); for (i=0; i