Make queries resources fully conform to common behavior (removed additonal routes) (#9108).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7657 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Etienne Massip 2011-10-26 18:00:56 +00:00
parent a47979bcc2
commit ad9e486077
5 changed files with 6 additions and 9 deletions

View File

@ -1,7 +1,7 @@
<div class="contextual">
<% if !@query.new_record? && @query.editable_by?(User.current) %>
<%= link_to l(:button_edit), @query.project_id ? edit_project_query_path(:project_id => @query.project, :id => @query) : edit_query_path(@query), :class => 'icon icon-edit' %>
<%= link_to l(:button_delete), @query.project_id ? project_query_path(:project_id => @query.project, :id => @query) : query_path(@query), :confirm => l(:text_are_you_sure), :method => :delete, :class => 'icon icon-del' %>
<%= link_to l(:button_edit), edit_query_path(@query), :class => 'icon icon-edit' %>
<%= link_to l(:button_delete), query_path(@query), :confirm => l(:text_are_you_sure), :method => :delete, :class => 'icon icon-del' %>
<% end %>
</div>
@ -38,7 +38,7 @@
<%= link_to_function l(:button_apply), 'submit_query_form("query_form")', :class => 'icon icon-checked' %>
<%= link_to l(:button_clear), { :set_filter => 1, :project_id => @project }, :class => 'icon icon-reload' %>
<% if @query.new_record? && User.current.allowed_to?(:save_queries, @project, :global => true) %>
<%= link_to_function l(:button_save), "$('query_form').action='#{ @project ? new_project_query_path(@project) : new_query_path }'; submit_query_form('query_form')", :class => 'icon icon-save' %>
<%= link_to_function l(:button_save), "$('query_form').action='#{ @project ? new_project_query_path : new_query_path }'; submit_query_form('query_form')", :class => 'icon icon-save' %>
<% end %>
</p>
<% end %>

View File

@ -1,6 +1,6 @@
<h2><%= l(:label_query) %></h2>
<% form_tag(@query.project_id ? project_query_path(:project_id => @query.project, :id => @query) : query_path(@query), :onsubmit => 'selectAllOptions("selected_columns");', :method => :put) do %>
<% form_tag(query_path(@query), :onsubmit => 'selectAllOptions("selected_columns");', :method => :put) do %>
<%= render :partial => 'form', :locals => {:query => @query} %>
<%= submit_tag l(:button_save) %>
<% end %>

View File

@ -1,6 +1,6 @@
<h2><%= l(:label_query_new) %></h2>
<% form_tag(@project ? project_queries_path(:project_id => @project) : queries_path, :onsubmit => 'selectAllOptions("selected_columns");') do %>
<% form_tag(@project ? project_queries_path : queries_path, :onsubmit => 'selectAllOptions("selected_columns");') do %>
<%= render :partial => 'form', :locals => {:query => @query} %>
<%= submit_tag l(:button_save) %>
<% end %>

View File

@ -156,7 +156,7 @@ ActionController::Routing::Routes.draw do |map|
project.resources :versions, :shallow => true, :collection => {:close_completed => :put}, :member => {:status_by => :post}
project.resources :news, :shallow => true
project.resources :time_entries, :controller => 'timelog', :path_prefix => 'projects/:project_id'
project.resources :queries, :except => [:show]
project.resources :queries, :only => [:new, :create]
project.wiki_start_page 'wiki', :controller => 'wiki', :action => 'show', :conditions => {:method => :get}
project.wiki_index 'wiki/index', :controller => 'wiki', :action => 'index', :conditions => {:method => :get}

View File

@ -222,13 +222,10 @@ class RoutingTest < ActionController::IntegrationTest
should_route :post, "/projects/redmine/queries", :controller => 'queries', :action => 'create', :project_id => 'redmine'
should_route :get, "/queries/1/edit", :controller => 'queries', :action => 'edit', :id => '1'
should_route :get, "/projects/redmine/queries/1/edit", :controller => 'queries', :action => 'edit', :id => '1', :project_id => 'redmine'
should_route :put, "/queries/1", :controller => 'queries', :action => 'update', :id => '1'
should_route :put, "/projects/redmine/queries/1", :controller => 'queries', :action => 'update', :id => '1', :project_id => 'redmine'
should_route :delete, "/queries/1", :controller => 'queries', :action => 'destroy', :id => '1'
should_route :delete, "/projects/redmine/queries/1", :controller => 'queries', :action => 'destroy', :id => '1', :project_id => 'redmine'
end
context "repositories" do