Use canonical resources route for query menu items, use local project variable in workpackages#index

pull/643/head
Till Breuer 11 years ago committed by Till Breuer
parent 7e8f9e9239
commit bf3923aa04
  1. 2
      app/controllers/work_packages_controller.rb
  2. 6
      app/views/work_packages/index.html.erb
  3. 2
      config/routes.rb

@ -391,7 +391,7 @@ class WorkPackagesController < ApplicationController
work_package.add_time_entry(attributes)
end
# Override method from menu_controller mix in to select query menu items which aren't currently dsitinguished by their action names
# Override method from menu_controller mix in to select query menu items, which aren't currently distinguished by their action names
def current_menu_item
if !@current_menu_item_determined && action_name == 'index' && @query.persisted? && current = @query.query_menu_item.try(:name)
@current_menu_item_determined = true

@ -34,12 +34,12 @@ See doc/COPYRIGHT.rdoc for more details.
<%= li_unless_nil link_to(l(:button_delete), {:controller => '/queries', :action => 'destroy', :id => query}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del') %>
<% end %>
<% content_for :action_menu_more do %>
<% if query.is_public? ? (current_user.allowed_to?(:manage_public_queries, @project) || current_user.admin?) : current_user.allowed_to?(:save_queries, @project, :global => true) %>
<% if query.is_public? ? (current_user.allowed_to?(:manage_public_queries, project) || current_user.admin?) : current_user.allowed_to?(:save_queries, project, :global => true) %>
<% if query_menu_item = query.query_menu_item %>
<%# TODO Add query menu item configuration page %>
<%= li_unless_nil(link_to(l(:button_delete_menu_entry), query_menu_item_path(@project, query, :id => query_menu_item.id), :method => :delete)) %>
<%= li_unless_nil link_to(l(:button_delete_menu_entry), query_menu_item_path(project, query, query_menu_item), :method => :delete) %>
<% else %>
<%= li_unless_nil(link_to(l(:button_add_menu_entry), query_menu_item_path(@project, query), :method => :create)) %>
<%= li_unless_nil(link_to(l(:button_add_menu_entry), query_menu_items_path(project, query), :method => :create)) %>
<% end %>
<% end %>
<% end %>

@ -126,7 +126,7 @@ OpenProject::Application.routes.draw do
end
scope "projects/:project_id/query/:query_id" do
resource :query_menu_item, :except => [:show]
resources :query_menu_items, :except => [:show]
end
get 'projects/:project_id/wiki/new' => 'wiki#new', :as => 'wiki_new'

Loading…
Cancel
Save