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