##// END OF EJS Templates
Merged r4082 from trunk....
Eric Davis -
r4029:46fc87839668
parent child
Show More
@@ -1,54 +1,54
1 <h2><%=l(:label_roadmap)%></h2>
1 <h2><%=l(:label_roadmap)%></h2>
2
2
3 <% if @versions.empty? %>
3 <% if @versions.empty? %>
4 <p class="nodata"><%= l(:label_no_data) %></p>
4 <p class="nodata"><%= l(:label_no_data) %></p>
5 <% else %>
5 <% else %>
6 <div id="roadmap">
6 <div id="roadmap">
7 <% @versions.each do |version| %>
7 <% @versions.each do |version| %>
8 <h3 class="version"><%= tag 'a', :name => version.name %><%= link_to_version version %></h3>
8 <h3 class="version"><%= tag 'a', :name => version.name %><%= link_to_version version %></h3>
9 <%= render :partial => 'versions/overview', :locals => {:version => version} %>
9 <%= render :partial => 'versions/overview', :locals => {:version => version} %>
10 <%= render(:partial => "wiki/content", :locals => {:content => version.wiki_page.content}) if version.wiki_page %>
10 <%= render(:partial => "wiki/content", :locals => {:content => version.wiki_page.content}) if version.wiki_page %>
11
11
12 <% if (issues = @issues_by_version[version]) && issues.size > 0 %>
12 <% if (issues = @issues_by_version[version]) && issues.size > 0 %>
13 <% form_tag({}) do -%>
13 <% form_tag({}) do -%>
14 <table class="list related-issues">
14 <table class="list related-issues">
15 <caption><%= l(:label_related_issues) %></caption>
15 <caption><%= l(:label_related_issues) %></caption>
16 <%- issues.each do |issue| -%>
16 <%- issues.each do |issue| -%>
17 <tr class="hascontextmenu">
17 <tr class="hascontextmenu">
18 <td class="checkbox"><%= check_box_tag 'ids[]', issue.id %></td>
18 <td class="checkbox"><%= check_box_tag 'ids[]', issue.id %></td>
19 <td><%= link_to_issue(issue, :project => (@project != issue.project)) %></td>
19 <td><%= link_to_issue(issue, :project => (@project != issue.project)) %></td>
20 </tr>
20 </tr>
21 <%- end -%>
21 <%- end -%>
22 </table>
22 </table>
23 <% end %>
23 <% end %>
24 <% end %>
24 <% end %>
25 <%= call_hook :view_projects_roadmap_version_bottom, :version => version %>
25 <%= call_hook :view_projects_roadmap_version_bottom, :version => version %>
26 <% end %>
26 <% end %>
27 </div>
27 </div>
28 <% end %>
28 <% end %>
29
29
30 <% content_for :sidebar do %>
30 <% content_for :sidebar do %>
31 <% form_tag({}, :method => :get) do %>
31 <% form_tag({}, :method => :get) do %>
32 <h3><%= l(:label_roadmap) %></h3>
32 <h3><%= l(:label_roadmap) %></h3>
33 <% @trackers.each do |tracker| %>
33 <% @trackers.each do |tracker| %>
34 <label><%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s), :id => nil %>
34 <label><%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s), :id => nil %>
35 <%=h tracker.name %></label><br />
35 <%=h tracker.name %></label><br />
36 <% end %>
36 <% end %>
37 <br />
37 <br />
38 <label for="completed"><%= check_box_tag "completed", 1, params[:completed] %> <%= l(:label_show_completed_versions) %></label>
38 <label for="completed"><%= check_box_tag "completed", 1, params[:completed] %> <%= l(:label_show_completed_versions) %></label>
39 <% if @project.descendants.active.any? %>
39 <% if @project.descendants.active.any? %>
40 <%= hidden_field_tag 'with_subprojects', 0 %>
40 <%= hidden_field_tag 'with_subprojects', 0 %>
41 <br /><label><%= check_box_tag 'with_subprojects', 1, @with_subprojects %> <%=l(:label_subproject_plural)%></label>
41 <br /><label><%= check_box_tag 'with_subprojects', 1, @with_subprojects %> <%=l(:label_subproject_plural)%></label>
42 <% end %>
42 <% end %>
43 <p><%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %></p>
43 <p><%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %></p>
44 <% end %>
44 <% end %>
45
45
46 <h3><%= l(:label_version_plural) %></h3>
46 <h3><%= l(:label_version_plural) %></h3>
47 <% @versions.each do |version| %>
47 <% @versions.each do |version| %>
48 <%= link_to format_version_name(version), "##{version.name}" %><br />
48 <%= link_to format_version_name(version), "##{version.name}" %><br />
49 <% end %>
49 <% end %>
50 <% end %>
50 <% end %>
51
51
52 <% html_title(l(:label_roadmap)) %>
52 <% html_title(l(:label_roadmap)) %>
53
53
54 <%= context_menu :controller => 'issues', :action => 'context_menu' %>
54 <%= context_menu issues_context_menu_path %>
@@ -1,137 +1,139
1 # redMine - project management software
1 # redMine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 require File.dirname(__FILE__) + '/../test_helper'
18 require File.dirname(__FILE__) + '/../test_helper'
19 require 'versions_controller'
19 require 'versions_controller'
20
20
21 # Re-raise errors caught by the controller.
21 # Re-raise errors caught by the controller.
22 class VersionsController; def rescue_action(e) raise e end; end
22 class VersionsController; def rescue_action(e) raise e end; end
23
23
24 class VersionsControllerTest < ActionController::TestCase
24 class VersionsControllerTest < ActionController::TestCase
25 fixtures :projects, :versions, :issues, :users, :roles, :members, :member_roles, :enabled_modules
25 fixtures :projects, :versions, :issues, :users, :roles, :members, :member_roles, :enabled_modules
26
26
27 def setup
27 def setup
28 @controller = VersionsController.new
28 @controller = VersionsController.new
29 @request = ActionController::TestRequest.new
29 @request = ActionController::TestRequest.new
30 @response = ActionController::TestResponse.new
30 @response = ActionController::TestResponse.new
31 User.current = nil
31 User.current = nil
32 end
32 end
33
33
34 def test_index
34 def test_index
35 get :index, :project_id => 1
35 get :index, :project_id => 1
36 assert_response :success
36 assert_response :success
37 assert_template 'index'
37 assert_template 'index'
38 assert_not_nil assigns(:versions)
38 assert_not_nil assigns(:versions)
39 # Version with no date set appears
39 # Version with no date set appears
40 assert assigns(:versions).include?(Version.find(3))
40 assert assigns(:versions).include?(Version.find(3))
41 # Completed version doesn't appear
41 # Completed version doesn't appear
42 assert !assigns(:versions).include?(Version.find(1))
42 assert !assigns(:versions).include?(Version.find(1))
43 # Context menu on issues
44 assert_select "script", :text => Regexp.new(Regexp.escape("new ContextMenu('/issues/context_menu')"))
43 end
45 end
44
46
45 def test_index_with_completed_versions
47 def test_index_with_completed_versions
46 get :index, :project_id => 1, :completed => 1
48 get :index, :project_id => 1, :completed => 1
47 assert_response :success
49 assert_response :success
48 assert_template 'index'
50 assert_template 'index'
49 assert_not_nil assigns(:versions)
51 assert_not_nil assigns(:versions)
50 # Version with no date set appears
52 # Version with no date set appears
51 assert assigns(:versions).include?(Version.find(3))
53 assert assigns(:versions).include?(Version.find(3))
52 # Completed version appears
54 # Completed version appears
53 assert assigns(:versions).include?(Version.find(1))
55 assert assigns(:versions).include?(Version.find(1))
54 end
56 end
55
57
56 def test_index_showing_subprojects_versions
58 def test_index_showing_subprojects_versions
57 @subproject_version = Version.generate!(:project => Project.find(3))
59 @subproject_version = Version.generate!(:project => Project.find(3))
58 get :index, :project_id => 1, :with_subprojects => 1
60 get :index, :project_id => 1, :with_subprojects => 1
59 assert_response :success
61 assert_response :success
60 assert_template 'index'
62 assert_template 'index'
61 assert_not_nil assigns(:versions)
63 assert_not_nil assigns(:versions)
62
64
63 assert assigns(:versions).include?(Version.find(4)), "Shared version not found"
65 assert assigns(:versions).include?(Version.find(4)), "Shared version not found"
64 assert assigns(:versions).include?(@subproject_version), "Subproject version not found"
66 assert assigns(:versions).include?(@subproject_version), "Subproject version not found"
65 end
67 end
66
68
67 def test_show
69 def test_show
68 get :show, :id => 2
70 get :show, :id => 2
69 assert_response :success
71 assert_response :success
70 assert_template 'show'
72 assert_template 'show'
71 assert_not_nil assigns(:version)
73 assert_not_nil assigns(:version)
72
74
73 assert_tag :tag => 'h2', :content => /1.0/
75 assert_tag :tag => 'h2', :content => /1.0/
74 end
76 end
75
77
76 def test_new
78 def test_new
77 @request.session[:user_id] = 2 # manager
79 @request.session[:user_id] = 2 # manager
78 assert_difference 'Version.count' do
80 assert_difference 'Version.count' do
79 post :new, :project_id => '1', :version => {:name => 'test_add_version'}
81 post :new, :project_id => '1', :version => {:name => 'test_add_version'}
80 end
82 end
81 assert_redirected_to '/projects/ecookbook/settings/versions'
83 assert_redirected_to '/projects/ecookbook/settings/versions'
82 version = Version.find_by_name('test_add_version')
84 version = Version.find_by_name('test_add_version')
83 assert_not_nil version
85 assert_not_nil version
84 assert_equal 1, version.project_id
86 assert_equal 1, version.project_id
85 end
87 end
86
88
87 def test_new_from_issue_form
89 def test_new_from_issue_form
88 @request.session[:user_id] = 2 # manager
90 @request.session[:user_id] = 2 # manager
89 assert_difference 'Version.count' do
91 assert_difference 'Version.count' do
90 xhr :post, :new, :project_id => '1', :version => {:name => 'test_add_version_from_issue_form'}
92 xhr :post, :new, :project_id => '1', :version => {:name => 'test_add_version_from_issue_form'}
91 end
93 end
92 assert_response :success
94 assert_response :success
93 assert_select_rjs :replace, 'issue_fixed_version_id'
95 assert_select_rjs :replace, 'issue_fixed_version_id'
94 version = Version.find_by_name('test_add_version_from_issue_form')
96 version = Version.find_by_name('test_add_version_from_issue_form')
95 assert_not_nil version
97 assert_not_nil version
96 assert_equal 1, version.project_id
98 assert_equal 1, version.project_id
97 end
99 end
98
100
99 def test_get_edit
101 def test_get_edit
100 @request.session[:user_id] = 2
102 @request.session[:user_id] = 2
101 get :edit, :id => 2
103 get :edit, :id => 2
102 assert_response :success
104 assert_response :success
103 assert_template 'edit'
105 assert_template 'edit'
104 end
106 end
105
107
106 def test_close_completed
108 def test_close_completed
107 Version.update_all("status = 'open'")
109 Version.update_all("status = 'open'")
108 @request.session[:user_id] = 2
110 @request.session[:user_id] = 2
109 post :close_completed, :project_id => 'ecookbook'
111 post :close_completed, :project_id => 'ecookbook'
110 assert_redirected_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => 'ecookbook'
112 assert_redirected_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => 'ecookbook'
111 assert_not_nil Version.find_by_status('closed')
113 assert_not_nil Version.find_by_status('closed')
112 end
114 end
113
115
114 def test_post_edit
116 def test_post_edit
115 @request.session[:user_id] = 2
117 @request.session[:user_id] = 2
116 post :edit, :id => 2,
118 post :edit, :id => 2,
117 :version => { :name => 'New version name',
119 :version => { :name => 'New version name',
118 :effective_date => Date.today.strftime("%Y-%m-%d")}
120 :effective_date => Date.today.strftime("%Y-%m-%d")}
119 assert_redirected_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => 'ecookbook'
121 assert_redirected_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => 'ecookbook'
120 version = Version.find(2)
122 version = Version.find(2)
121 assert_equal 'New version name', version.name
123 assert_equal 'New version name', version.name
122 assert_equal Date.today, version.effective_date
124 assert_equal Date.today, version.effective_date
123 end
125 end
124
126
125 def test_destroy
127 def test_destroy
126 @request.session[:user_id] = 2
128 @request.session[:user_id] = 2
127 post :destroy, :id => 3
129 post :destroy, :id => 3
128 assert_redirected_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => 'ecookbook'
130 assert_redirected_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => 'ecookbook'
129 assert_nil Version.find_by_id(3)
131 assert_nil Version.find_by_id(3)
130 end
132 end
131
133
132 def test_issue_status_by
134 def test_issue_status_by
133 xhr :get, :status_by, :id => 2
135 xhr :get, :status_by, :id => 2
134 assert_response :success
136 assert_response :success
135 assert_template '_issue_counts'
137 assert_template '_issue_counts'
136 end
138 end
137 end
139 end
General Comments 0
You need to be logged in to leave comments. Login now