git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6183 e93f8b46-1217-0410-a6f0-8f06a7374b81tags/1.3.0
@@ -102,7 +102,7 @@ class VersionsController < ApplicationController | |||
} | |||
end | |||
format.api do | |||
render :action => 'show', :status => :created, :location => project_version_url(@project, @version) | |||
render :action => 'show', :status => :created, :location => version_url(@version) | |||
end | |||
end | |||
else |
@@ -20,8 +20,8 @@ | |||
<td><%= link_to_if_authorized(h(version.wiki_page_title), {:controller => 'wiki', :action => 'show', :project_id => version.project, :id => Wiki.titleize(version.wiki_page_title)}) || h(version.wiki_page_title) unless version.wiki_page_title.blank? || version.project.wiki.nil? %></td> | |||
<td class="buttons"> | |||
<% if version.project == @project && User.current.allowed_to?(:manage_versions, @project) %> | |||
<%= link_to l(:button_edit), edit_project_version_path(@project, version), :class => 'icon icon-edit' %> | |||
<%= link_to l(:button_delete), project_version_path(@project, version), :confirm => l(:text_are_you_sure), :method => :delete, :class => 'icon icon-del' %> | |||
<%= link_to l(:button_edit), edit_version_path(version), :class => 'icon icon-edit' %> | |||
<%= link_to l(:button_delete), version_path(version), :confirm => l(:text_are_you_sure), :method => :delete, :class => 'icon icon-del' %> | |||
<% end %> | |||
</td> | |||
</tr> |
@@ -5,7 +5,7 @@ | |||
select_tag('status_by', | |||
status_by_options_for_select(criteria), | |||
:id => 'status_by_select', | |||
:onchange => remote_function(:url => status_by_project_version_path(version.project, version), | |||
:onchange => remote_function(:url => status_by_version_path(version), | |||
:with => "Form.serialize('status_by_form')"))) %> | |||
</legend> | |||
<% if counts.empty? %> |
@@ -1,6 +1,6 @@ | |||
<h2><%=l(:label_version)%></h2> | |||
<% labelled_tabular_form_for :version, @version, :url => project_version_path(@project, @version), :html => {:method => :put} do |f| %> | |||
<% labelled_tabular_form_for :version, @version, :url => version_path(@version), :html => {:method => :put} do |f| %> | |||
<%= render :partial => 'form', :locals => { :f => f } %> | |||
<%= submit_tag l(:button_save) %> | |||
<% end %> |
@@ -1,7 +1,7 @@ | |||
<div class="contextual"> | |||
<%= link_to(l(:button_edit), edit_project_version_path(@version.project, @version), :class => 'icon icon-edit') if User.current.allowed_to?(:manage_versions, @version.project) %> | |||
<%= link_to(l(:button_edit), edit_version_path(@version), :class => 'icon icon-edit') if User.current.allowed_to?(:manage_versions, @version.project) %> | |||
<%= link_to_if_authorized(l(:button_edit_associated_wikipage, :page_title => @version.wiki_page_title), {:controller => 'wiki', :action => 'edit', :project_id => @version.project, :id => Wiki.titleize(@version.wiki_page_title)}, :class => 'icon icon-edit') unless @version.wiki_page_title.blank? || @version.project.wiki.nil? %> | |||
<%= link_to(l(:button_delete), project_version_path(@version.project, @version, :back_url => url_for(:controller => 'versions', :action => 'index', :project_id => @version.project)), | |||
<%= link_to(l(:button_delete), version_path(@version, :back_url => url_for(:controller => 'versions', :action => 'index', :project_id => @version.project)), | |||
:confirm => l(:text_are_you_sure), :method => :delete, :class => 'icon icon-del') if User.current.allowed_to?(:manage_versions, @version.project) %> | |||
<%= call_hook(:view_versions_show_contextual, { :version => @version, :project => @project }) %> | |||
</div> |
@@ -152,7 +152,7 @@ ActionController::Routing::Routes.draw do |map| | |||
} do |project| | |||
project.resource :project_enumerations, :as => 'enumerations', :only => [:update, :destroy] | |||
project.resources :files, :only => [:index, :new, :create] | |||
project.resources :versions, :collection => {:close_completed => :put}, :member => {:status_by => :post} | |||
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' | |||
@@ -74,10 +74,10 @@ class ApiTest::VersionsTest < ActionController::IntegrationTest | |||
end | |||
end | |||
context "/projects/:project_id/versions/:id" do | |||
context "/versions/:id" do | |||
context "GET" do | |||
should "return the version" do | |||
get '/projects/1/versions/2.xml' | |||
get '/versions/2.xml' | |||
assert_response :success | |||
assert_equal 'application/xml', @response.content_type | |||
@@ -95,7 +95,7 @@ class ApiTest::VersionsTest < ActionController::IntegrationTest | |||
context "PUT" do | |||
should "update the version" do | |||
put '/projects/1/versions/2.xml', {:version => {:name => 'API update'}}, :authorization => credentials('jsmith') | |||
put '/versions/2.xml', {:version => {:name => 'API update'}}, :authorization => credentials('jsmith') | |||
assert_response :ok | |||
assert_equal 'API update', Version.find(2).name | |||
@@ -105,7 +105,7 @@ class ApiTest::VersionsTest < ActionController::IntegrationTest | |||
context "DELETE" do | |||
should "destroy the version" do | |||
assert_difference 'Version.count', -1 do | |||
delete '/projects/1/versions/3.xml', {}, :authorization => credentials('jsmith') | |||
delete '/versions/3.xml', {}, :authorization => credentials('jsmith') | |||
end | |||
assert_response :ok |
@@ -337,22 +337,22 @@ class RoutingTest < ActionController::IntegrationTest | |||
should_route :post, "/projects/foo/versions.xml", :controller => 'versions', :action => 'create', :project_id => 'foo', :format => 'xml' | |||
should_route :post, "/projects/foo/versions.json", :controller => 'versions', :action => 'create', :project_id => 'foo', :format => 'json' | |||
should_route :get, "/projects/foo/versions/1", :controller => 'versions', :action => 'show', :project_id => 'foo', :id => '1' | |||
should_route :get, "/projects/foo/versions/1.xml", :controller => 'versions', :action => 'show', :project_id => 'foo', :id => '1', :format => 'xml' | |||
should_route :get, "/projects/foo/versions/1.json", :controller => 'versions', :action => 'show', :project_id => 'foo', :id => '1', :format => 'json' | |||
should_route :get, "/versions/1", :controller => 'versions', :action => 'show', :id => '1' | |||
should_route :get, "/versions/1.xml", :controller => 'versions', :action => 'show', :id => '1', :format => 'xml' | |||
should_route :get, "/versions/1.json", :controller => 'versions', :action => 'show', :id => '1', :format => 'json' | |||
should_route :get, "/projects/foo/versions/1/edit", :controller => 'versions', :action => 'edit', :project_id => 'foo', :id => '1' | |||
should_route :get, "/versions/1/edit", :controller => 'versions', :action => 'edit', :id => '1' | |||
should_route :put, "/projects/foo/versions/1", :controller => 'versions', :action => 'update', :project_id => 'foo', :id => '1' | |||
should_route :put, "/projects/foo/versions/1.xml", :controller => 'versions', :action => 'update', :project_id => 'foo', :id => '1', :format => 'xml' | |||
should_route :put, "/projects/foo/versions/1.json", :controller => 'versions', :action => 'update', :project_id => 'foo', :id => '1', :format => 'json' | |||
should_route :put, "/versions/1", :controller => 'versions', :action => 'update', :id => '1' | |||
should_route :put, "/versions/1.xml", :controller => 'versions', :action => 'update', :id => '1', :format => 'xml' | |||
should_route :put, "/versions/1.json", :controller => 'versions', :action => 'update', :id => '1', :format => 'json' | |||
should_route :delete, "/projects/foo/versions/1", :controller => 'versions', :action => 'destroy', :project_id => 'foo', :id => '1' | |||
should_route :delete, "/projects/foo/versions/1.xml", :controller => 'versions', :action => 'destroy', :project_id => 'foo', :id => '1', :format => 'xml' | |||
should_route :delete, "/projects/foo/versions/1.json", :controller => 'versions', :action => 'destroy', :project_id => 'foo', :id => '1', :format => 'json' | |||
should_route :delete, "/versions/1", :controller => 'versions', :action => 'destroy', :id => '1' | |||
should_route :delete, "/versions/1.xml", :controller => 'versions', :action => 'destroy', :id => '1', :format => 'xml' | |||
should_route :delete, "/versions/1.json", :controller => 'versions', :action => 'destroy', :id => '1', :format => 'json' | |||
should_route :put, "/projects/foo/versions/close_completed", :controller => 'versions', :action => 'close_completed', :project_id => 'foo' | |||
should_route :post, "/projects/foo/versions/1/status_by", :controller => 'versions', :action => 'status_by', :project_id => 'foo', :id => '1' | |||
should_route :post, "/versions/1/status_by", :controller => 'versions', :action => 'status_by', :id => '1' | |||
end | |||
context "wiki (singular, project's pages)" do |