@@ -87,8 +87,11 class VersionsController < ApplicationController | |||
|
87 | 87 | end |
|
88 | 88 | end |
|
89 | 89 | end |
|
90 | ||
|
90 | ||
|
91 | 91 | def edit |
|
92 | end | |
|
93 | ||
|
94 | def update | |
|
92 | 95 | if request.post? && params[:version] |
|
93 | 96 | attributes = params[:version].dup |
|
94 | 97 | attributes.delete('sharing') unless @version.allowed_sharings.include?(attributes['sharing']) |
@@ -1,6 +1,6 | |||
|
1 | 1 | <h2><%=l(:label_version)%></h2> |
|
2 | 2 | |
|
3 |
<% labelled_tabular_form_for :version, @version, :url => { :action => ' |
|
|
3 | <% labelled_tabular_form_for :version, @version, :url => { :action => 'update', :id => @version } do |f| %> | |
|
4 | 4 | <%= render :partial => 'form', :locals => { :f => f } %> |
|
5 | 5 | <%= submit_tag l(:button_save) %> |
|
6 | 6 | <% end %> |
@@ -235,7 +235,10 ActionController::Routing::Routes.draw do |map| | |||
|
235 | 235 | map.with_options :controller => 'versions' do |versions| |
|
236 | 236 | versions.connect 'projects/:project_id/versions/new', :action => 'new' |
|
237 | 237 | versions.connect 'projects/:project_id/roadmap', :action => 'index' |
|
238 | versions.connect 'versions/:action/:id', :conditions => {:method => :get} | |
|
239 | ||
|
238 | 240 | versions.with_options :conditions => {:method => :post} do |version_actions| |
|
241 | version_actions.connect 'versions/update/:id', :action => 'update' | |
|
239 | 242 | version_actions.connect 'projects/:project_id/versions/close_completed', :action => 'close_completed' |
|
240 | 243 | end |
|
241 | 244 | end |
@@ -50,7 +50,7 Redmine::AccessControl.map do |map| | |||
|
50 | 50 | map.permission :edit_project, {:projects => [:settings, :edit, :update]}, :require => :member |
|
51 | 51 | map.permission :select_project_modules, {:projects => :modules}, :require => :member |
|
52 | 52 | map.permission :manage_members, {:projects => :settings, :members => [:new, :edit, :destroy, :autocomplete_for_member]}, :require => :member |
|
53 | map.permission :manage_versions, {:projects => :settings, :versions => [:new, :edit, :close_completed, :destroy]}, :require => :member | |
|
53 | map.permission :manage_versions, {:projects => :settings, :versions => [:new, :edit, :update, :close_completed, :destroy]}, :require => :member | |
|
54 | 54 | map.permission :add_subprojects, {:projects => [:new, :create]}, :require => :member |
|
55 | 55 | |
|
56 | 56 | map.project_module :issue_tracking do |map| |
@@ -113,9 +113,9 class VersionsControllerTest < ActionController::TestCase | |||
|
113 | 113 | assert_not_nil Version.find_by_status('closed') |
|
114 | 114 | end |
|
115 | 115 | |
|
116 |
def test_post_ |
|
|
116 | def test_post_update | |
|
117 | 117 | @request.session[:user_id] = 2 |
|
118 |
post : |
|
|
118 | post :update, :id => 2, | |
|
119 | 119 | :version => { :name => 'New version name', |
|
120 | 120 | :effective_date => Date.today.strftime("%Y-%m-%d")} |
|
121 | 121 | assert_redirected_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => 'ecookbook' |
@@ -252,10 +252,16 class RoutingTest < ActionController::IntegrationTest | |||
|
252 | 252 | should_route :post, "/users/567/memberships/12/destroy", :controller => 'users', :action => 'destroy_membership', :id => '567', :membership_id => '12' |
|
253 | 253 | end |
|
254 | 254 | |
|
255 | # TODO: should they all be scoped under /projects/:project_id ? | |
|
255 | 256 | context "versions" do |
|
256 | 257 | should_route :get, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo' |
|
258 | should_route :get, "/versions/show/1", :controller => 'versions', :action => 'show', :id => '1' | |
|
259 | should_route :get, "/versions/edit/1", :controller => 'versions', :action => 'edit', :id => '1' | |
|
257 | 260 | |
|
258 | 261 | should_route :post, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo' |
|
262 | should_route :post, "/versions/update/1", :controller => 'versions', :action => 'update', :id => '1' | |
|
263 | ||
|
264 | should_route :delete, "/versions/destroy/1", :controller => 'versions', :action => 'destroy', :id => '1' | |
|
259 | 265 | end |
|
260 | 266 | |
|
261 | 267 | context "wiki (singular, project's pages)" do |
General Comments 0
You need to be logged in to leave comments.
Login now