@@ -1,186 +1,186 | |||
|
1 | 1 | # redMine - project management software |
|
2 | 2 | # Copyright (C) 2006 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 | module ProjectsHelper |
|
19 | 19 | def link_to_version(version, options = {}) |
|
20 | 20 | return '' unless version && version.is_a?(Version) |
|
21 | 21 | link_to version.name, {:controller => 'projects', |
|
22 | 22 | :action => 'roadmap', |
|
23 | 23 | :id => version.project_id, |
|
24 | 24 | :completed => (version.completed? ? 1 : nil), |
|
25 | 25 | :anchor => version.name |
|
26 | 26 | }, options |
|
27 | 27 | end |
|
28 | 28 | |
|
29 | 29 | # Generates a gantt image |
|
30 | 30 | # Only defined if RMagick is avalaible |
|
31 | 31 | def gantt_image(events, date_from, months, zoom) |
|
32 | 32 | date_to = (date_from >> months)-1 |
|
33 | 33 | show_weeks = zoom > 1 |
|
34 | 34 | show_days = zoom > 2 |
|
35 | 35 | |
|
36 | 36 | subject_width = 320 |
|
37 | 37 | header_heigth = 18 |
|
38 | 38 | # width of one day in pixels |
|
39 | 39 | zoom = zoom*2 |
|
40 | 40 | g_width = (date_to - date_from + 1)*zoom |
|
41 | 41 | g_height = 20 * events.length + 20 |
|
42 | 42 | headers_heigth = (show_weeks ? 2*header_heigth : header_heigth) |
|
43 | 43 | height = g_height + headers_heigth |
|
44 | 44 | |
|
45 | 45 | imgl = Magick::ImageList.new |
|
46 | 46 | imgl.new_image(subject_width+g_width+1, height) |
|
47 | 47 | gc = Magick::Draw.new |
|
48 | 48 | |
|
49 | 49 | # Subjects |
|
50 | 50 | top = headers_heigth + 20 |
|
51 | 51 | gc.fill('black') |
|
52 | 52 | gc.stroke('transparent') |
|
53 | 53 | gc.stroke_width(1) |
|
54 | 54 | events.each do |i| |
|
55 | 55 | gc.text(4, top + 2, (i.is_a?(Issue) ? i.subject : i.name)) |
|
56 | 56 | top = top + 20 |
|
57 | 57 | end |
|
58 | 58 | |
|
59 | 59 | # Months headers |
|
60 | 60 | month_f = date_from |
|
61 | 61 | left = subject_width |
|
62 | 62 | months.times do |
|
63 | 63 | width = ((month_f >> 1) - month_f) * zoom |
|
64 | 64 | gc.fill('white') |
|
65 | 65 | gc.stroke('grey') |
|
66 | 66 | gc.stroke_width(1) |
|
67 | 67 | gc.rectangle(left, 0, left + width, height) |
|
68 | 68 | gc.fill('black') |
|
69 | 69 | gc.stroke('transparent') |
|
70 | 70 | gc.stroke_width(1) |
|
71 | 71 | gc.text(left.round + 8, 14, "#{month_f.year}-#{month_f.month}") |
|
72 | 72 | left = left + width |
|
73 | 73 | month_f = month_f >> 1 |
|
74 | 74 | end |
|
75 | 75 | |
|
76 | 76 | # Weeks headers |
|
77 | 77 | if show_weeks |
|
78 | 78 | left = subject_width |
|
79 | 79 | height = header_heigth |
|
80 | 80 | if date_from.cwday == 1 |
|
81 | 81 | # date_from is monday |
|
82 | 82 | week_f = date_from |
|
83 | 83 | else |
|
84 | 84 | # find next monday after date_from |
|
85 | 85 | week_f = date_from + (7 - date_from.cwday + 1) |
|
86 | 86 | width = (7 - date_from.cwday + 1) * zoom |
|
87 | 87 | gc.fill('white') |
|
88 | 88 | gc.stroke('grey') |
|
89 | 89 | gc.stroke_width(1) |
|
90 | 90 | gc.rectangle(left, header_heigth, left + width, 2*header_heigth + g_height-1) |
|
91 | 91 | left = left + width |
|
92 | 92 | end |
|
93 | 93 | while week_f <= date_to |
|
94 | 94 | width = (week_f + 6 <= date_to) ? 7 * zoom : (date_to - week_f + 1) * zoom |
|
95 | 95 | gc.fill('white') |
|
96 | 96 | gc.stroke('grey') |
|
97 | 97 | gc.stroke_width(1) |
|
98 | 98 | gc.rectangle(left.round, header_heigth, left.round + width, 2*header_heigth + g_height-1) |
|
99 | 99 | gc.fill('black') |
|
100 | 100 | gc.stroke('transparent') |
|
101 | 101 | gc.stroke_width(1) |
|
102 | 102 | gc.text(left.round + 2, header_heigth + 14, week_f.cweek.to_s) |
|
103 | 103 | left = left + width |
|
104 | 104 | week_f = week_f+7 |
|
105 | 105 | end |
|
106 | 106 | end |
|
107 | 107 | |
|
108 | 108 | # Days details (week-end in grey) |
|
109 | 109 | if show_days |
|
110 | 110 | left = subject_width |
|
111 | 111 | height = g_height + header_heigth - 1 |
|
112 | 112 | wday = date_from.cwday |
|
113 | 113 | (date_to - date_from + 1).to_i.times do |
|
114 | 114 | width = zoom |
|
115 | 115 | gc.fill(wday == 6 || wday == 7 ? '#eee' : 'white') |
|
116 | 116 | gc.stroke('grey') |
|
117 | 117 | gc.stroke_width(1) |
|
118 | 118 | gc.rectangle(left, 2*header_heigth, left + width, 2*header_heigth + g_height-1) |
|
119 | 119 | left = left + width |
|
120 | 120 | wday = wday + 1 |
|
121 | 121 | wday = 1 if wday > 7 |
|
122 | 122 | end |
|
123 | 123 | end |
|
124 | 124 | |
|
125 | 125 | # border |
|
126 | 126 | gc.fill('transparent') |
|
127 | 127 | gc.stroke('grey') |
|
128 | 128 | gc.stroke_width(1) |
|
129 | 129 | gc.rectangle(0, 0, subject_width+g_width, headers_heigth) |
|
130 | 130 | gc.stroke('black') |
|
131 | 131 | gc.rectangle(0, 0, subject_width+g_width, g_height+ headers_heigth-1) |
|
132 | 132 | |
|
133 | 133 | # content |
|
134 | 134 | top = headers_heigth + 20 |
|
135 | 135 | gc.stroke('transparent') |
|
136 | 136 | events.each do |i| |
|
137 | 137 | if i.is_a?(Issue) |
|
138 | 138 | i_start_date = (i.start_date >= date_from ? i.start_date : date_from ) |
|
139 | 139 | i_end_date = (i.due_date <= date_to ? i.due_date : date_to ) |
|
140 | 140 | i_done_date = i.start_date + ((i.due_date - i.start_date+1)*i.done_ratio/100).floor |
|
141 | 141 | i_done_date = (i_done_date <= date_from ? date_from : i_done_date ) |
|
142 | 142 | i_done_date = (i_done_date >= date_to ? date_to : i_done_date ) |
|
143 | 143 | i_late_date = [i_end_date, Date.today].min if i_start_date < Date.today |
|
144 | 144 | |
|
145 | 145 | i_left = subject_width + ((i_start_date - date_from)*zoom).floor |
|
146 | 146 | i_width = ((i_end_date - i_start_date + 1)*zoom).floor # total width of the issue |
|
147 | 147 | d_width = ((i_done_date - i_start_date)*zoom).floor # done width |
|
148 | 148 | l_width = i_late_date ? ((i_late_date - i_start_date+1)*zoom).floor : 0 # delay width |
|
149 | 149 | |
|
150 | 150 | gc.fill('grey') |
|
151 | 151 | gc.rectangle(i_left, top, i_left + i_width, top - 6) |
|
152 | 152 | gc.fill('red') |
|
153 | 153 | gc.rectangle(i_left, top, i_left + l_width, top - 6) if l_width > 0 |
|
154 | 154 | gc.fill('blue') |
|
155 | 155 | gc.rectangle(i_left, top, i_left + d_width, top - 6) if d_width > 0 |
|
156 | 156 | gc.fill('black') |
|
157 | 157 | gc.text(i_left + i_width + 5,top + 1, "#{i.status.name} #{i.done_ratio}%") |
|
158 | 158 | else |
|
159 | 159 | i_left = subject_width + ((i.start_date - date_from)*zoom).floor |
|
160 | 160 | gc.fill('green') |
|
161 | 161 | gc.rectangle(i_left, top, i_left + 6, top - 6) |
|
162 | 162 | gc.fill('black') |
|
163 | 163 | gc.text(i_left + 11, top + 1, i.name) |
|
164 | 164 | end |
|
165 | 165 | top = top + 20 |
|
166 | 166 | end |
|
167 | 167 | |
|
168 | 168 | # today red line |
|
169 | 169 | if Date.today >= @date_from and Date.today <= @date_to |
|
170 | 170 | gc.stroke('red') |
|
171 | 171 | x = (Date.today-@date_from+1)*zoom + subject_width |
|
172 | 172 | gc.line(x, headers_heigth, x, headers_heigth + g_height-1) |
|
173 | 173 | end |
|
174 | 174 | |
|
175 | 175 | gc.draw(imgl) |
|
176 | 176 | imgl |
|
177 | 177 | end if Object.const_defined?(:Magick) |
|
178 | 178 | |
|
179 | 179 | def new_issue_selector |
|
180 | 180 | trackers = Tracker.find(:all, :order => 'position') |
|
181 | 181 | # can't use form tag inside helper |
|
182 | 182 | content_tag('form', |
|
183 | select_tag('tracker_id', '<option></option' + options_from_collection_for_select(trackers, 'id', 'name'), :onchange => "if (this.value != '') {this.form.submit()}"), | |
|
183 | select_tag('tracker_id', '<option></option>' + options_from_collection_for_select(trackers, 'id', 'name'), :onchange => "if (this.value != '') {this.form.submit()}"), | |
|
184 | 184 | :action => url_for(:controller => 'projects', :action => 'add_issue', :id => @project), :method => 'get') |
|
185 | 185 | end |
|
186 | 186 | end |
@@ -1,86 +1,86 | |||
|
1 | 1 | <% if @query.new_record? %> |
|
2 | 2 | <div class="contextual"> |
|
3 | 3 | <%= link_to l(:label_query_plural), :controller => 'queries', :project_id => @project %> |
|
4 |
<% if authorize_for('projects', 'add_issue |
|
|
4 | <% if authorize_for('projects', 'add_issue') %>| <%= l(:label_issue_new) %>: <%= new_issue_selector %><% end %> | |
|
5 | 5 | </div> |
|
6 | 6 | <h2><%=l(:label_issue_plural)%></h2> |
|
7 | 7 | |
|
8 | 8 | <% form_tag({:action => 'list_issues'}, :id => 'query_form') do %> |
|
9 | 9 | <%= render :partial => 'queries/filters', :locals => {:query => @query} %> |
|
10 | 10 | <% end %> |
|
11 | 11 | <div class="contextual"> |
|
12 | 12 | <%= link_to_remote l(:button_apply), |
|
13 | 13 | { :url => { :controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1 }, |
|
14 | 14 | :update => "content", |
|
15 | 15 | :with => "Form.serialize('query_form')" |
|
16 | 16 | }, :class => 'icon icon-edit' %> |
|
17 | 17 | |
|
18 | 18 | <%= link_to_remote l(:button_clear), |
|
19 | 19 | { :url => {:controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1}, |
|
20 | 20 | :update => "content", |
|
21 | 21 | }, :class => 'icon icon-reload' %> |
|
22 | 22 | |
|
23 | 23 | <% if current_role.allowed_to?(:save_queries) %> |
|
24 | 24 | <%= link_to_remote l(:button_save), |
|
25 | 25 | { :url => { :controller => 'queries', :action => 'new', :project_id => @project }, |
|
26 | 26 | :method => 'get', |
|
27 | 27 | :update => "content", |
|
28 | 28 | :with => "Form.serialize('query_form')" |
|
29 | 29 | }, :class => 'icon icon-save' %> |
|
30 | 30 | <% end %> |
|
31 | 31 | </div> |
|
32 | 32 | <br /> |
|
33 | 33 | <% else %> |
|
34 | 34 | <div class="contextual"> |
|
35 | 35 | <%= link_to l(:label_query_plural), {:controller => 'queries', :project_id => @project} %> | |
|
36 | 36 | <%= link_to l(:label_issue_view_all), {:controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1} %> |
|
37 |
<% if authorize_for('projects', 'add_issue |
|
|
37 | <% if authorize_for('projects', 'add_issue') %>| <%= l(:label_issue_new) %>: <%= new_issue_selector %><% end %> | |
|
38 | 38 | </div> |
|
39 | 39 | <h2><%= @query.name %></h2> |
|
40 | 40 | <% end %> |
|
41 | 41 | <%= error_messages_for 'query' %> |
|
42 | 42 | <% if @query.valid? %> |
|
43 | 43 | <% if @issues.empty? %> |
|
44 | 44 | <p><i><%= l(:label_no_data) %></i></p> |
|
45 | 45 | <% else %> |
|
46 | 46 | |
|
47 | 47 | <% form_tag({:controller => 'projects', :action => 'move_issues', :id => @project}, :id => 'issues_form' ) do %> |
|
48 | 48 | <table class="list"> |
|
49 | 49 | <thead><tr> |
|
50 | 50 | <th></th> |
|
51 | 51 | <%= sort_header_tag("#{Issue.table_name}.id", :caption => '#') %> |
|
52 | 52 | <%= sort_header_tag("#{Issue.table_name}.tracker_id", :caption => l(:field_tracker)) %> |
|
53 | 53 | <%= sort_header_tag("#{IssueStatus.table_name}.name", :caption => l(:field_status)) %> |
|
54 | 54 | <%= sort_header_tag("#{Issue.table_name}.priority_id", :caption => l(:field_priority)) %> |
|
55 | 55 | <th><%=l(:field_subject)%></th> |
|
56 | 56 | <%= sort_header_tag("#{User.table_name}.lastname", :caption => l(:field_assigned_to)) %> |
|
57 | 57 | <%= sort_header_tag("#{Issue.table_name}.updated_on", :caption => l(:field_updated_on)) %> |
|
58 | 58 | </tr></thead> |
|
59 | 59 | <tbody> |
|
60 | 60 | <% for issue in @issues %> |
|
61 | 61 | <tr class="<%= cycle("odd", "even") %>"> |
|
62 | 62 | <th style="width:15px;"><%= check_box_tag "issue_ids[]", issue.id, false, :id => "issue_#{issue.id}" %></th> |
|
63 | 63 | <td align="center"><%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %></td> |
|
64 | 64 | <td align="center"><%= issue.tracker.name %></td> |
|
65 | 65 | <td><div class="square" style="background:#<%= issue.status.html_color %>;"></div> <%= issue.status.name %></td> |
|
66 | 66 | <td align="center"><%= issue.priority.name %></td> |
|
67 | 67 | <td><%= "#{issue.project.name} - " unless @project && @project == issue.project %><%= link_to h(issue.subject), :controller => 'issues', :action => 'show', :id => issue %></td> |
|
68 | 68 | <td align="center"><%= issue.assigned_to.name if issue.assigned_to %></td> |
|
69 | 69 | <td align="center"><%= format_time(issue.updated_on) %></td> |
|
70 | 70 | </tr> |
|
71 | 71 | <% end %> |
|
72 | 72 | </tbody> |
|
73 | 73 | </table> |
|
74 | 74 | <div class="contextual"> |
|
75 | 75 | <%= l(:label_export_to) %> |
|
76 | 76 | <%= link_to 'CSV', {:action => 'export_issues_csv', :id => @project}, :class => 'icon icon-csv' %>, |
|
77 | 77 | <%= link_to 'PDF', {:action => 'export_issues_pdf', :id => @project}, :class => 'icon icon-pdf' %> |
|
78 | 78 | </div> |
|
79 | 79 | <p><%= submit_tag l(:button_move), :class => "button-small" %> |
|
80 | 80 | |
|
81 | 81 | <%= pagination_links_full @issue_pages %> |
|
82 | 82 | [ <%= @issue_pages.current.first_item %> - <%= @issue_pages.current.last_item %> / <%= @issue_count %> ] |
|
83 | 83 | </p> |
|
84 | 84 | <% end %> |
|
85 | 85 | <% end %> |
|
86 | 86 | <% end %> |
@@ -1,71 +1,71 | |||
|
1 | 1 | <div class="contextual"> |
|
2 | 2 | <%= link_to l(:label_feed_plural), {:action => 'feeds', :id => @project}, :class => 'icon icon-feed' %> |
|
3 | 3 | </div> |
|
4 | 4 | |
|
5 | 5 | <h2><%=l(:label_overview)%></h2> |
|
6 | 6 | |
|
7 | 7 | <div class="splitcontentleft"> |
|
8 | 8 | <%= textilizable @project.description %> |
|
9 | 9 | <ul> |
|
10 | 10 | <% unless @project.homepage.blank? %><li><%=l(:field_homepage)%>: <%= auto_link @project.homepage %></li><% end %> |
|
11 | 11 | <li><%=l(:field_created_on)%>: <%= format_date(@project.created_on) %></li> |
|
12 | 12 | <% unless @project.parent.nil? %> |
|
13 | 13 | <li><%=l(:field_parent)%>: <%= link_to @project.parent.name, :controller => 'projects', :action => 'show', :id => @project.parent %></li> |
|
14 | 14 | <% end %> |
|
15 | 15 | <% for custom_value in @custom_values %> |
|
16 | 16 | <% if !custom_value.value.empty? %> |
|
17 | 17 | <li><%= custom_value.custom_field.name%>: <%=h show_value(custom_value) %></li> |
|
18 | 18 | <% end %> |
|
19 | 19 | <% end %> |
|
20 | 20 | </ul> |
|
21 | 21 | |
|
22 | 22 | <div class="box"> |
|
23 |
<div class="contextual"><% if authorize_for('projects', 'add_issue |
|
|
23 | <div class="contextual"><% if authorize_for('projects', 'add_issue') %><%= l(:label_issue_new) %>: <%= new_issue_selector %><% end %></div> | |
|
24 | 24 | <h3 class="icon22 icon22-tracker"><%=l(:label_issue_tracking)%></h3> |
|
25 | 25 | <ul> |
|
26 | 26 | <% for tracker in @trackers %> |
|
27 | 27 | <li><%= link_to tracker.name, :controller => 'projects', :action => 'list_issues', :id => @project, |
|
28 | 28 | :set_filter => 1, |
|
29 | 29 | "tracker_id" => tracker.id %>: |
|
30 | 30 | <%= @open_issues_by_tracker[tracker] || 0 %> <%= lwr(:label_open_issues, @open_issues_by_tracker[tracker] || 0) %> |
|
31 | 31 | <%= l(:label_on) %> <%= @total_issues_by_tracker[tracker] || 0 %></li> |
|
32 | 32 | <% end %> |
|
33 | 33 | </ul> |
|
34 | 34 | <p class="textcenter"><small><%= link_to l(:label_issue_view_all), :controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1 %></small></p> |
|
35 | 35 | </div> |
|
36 | 36 | </div> |
|
37 | 37 | |
|
38 | 38 | <div class="splitcontentright"> |
|
39 | 39 | <div class="box"> |
|
40 | 40 | <h3 class="icon22 icon22-users"><%=l(:label_member_plural)%></h3> |
|
41 | 41 | <% @members_by_role.keys.sort.each do |role| %> |
|
42 | 42 | <%= role.name %>: <%= @members_by_role[role].collect(&:user).sort.collect{|u| link_to_user u}.join(", ") %><br /> |
|
43 | 43 | <% end %> |
|
44 | 44 | </div> |
|
45 | 45 | |
|
46 | 46 | <% if @subprojects.any? %> |
|
47 | 47 | <div class="box"> |
|
48 | 48 | <h3 class="icon22 icon22-projects"><%=l(:label_subproject_plural)%></h3> |
|
49 | 49 | <%= @subprojects.collect{|p| link_to(p.name, :action => 'show', :id => p)}.join(", ") %> |
|
50 | 50 | </div> |
|
51 | 51 | <% end %> |
|
52 | 52 | |
|
53 | 53 | <% if @news.any? && authorize_for('projects', 'list_news') %> |
|
54 | 54 | <div class="box"> |
|
55 | 55 | <h3><%=l(:label_news_latest)%></h3> |
|
56 | 56 | <%= render :partial => 'news/news', :collection => @news %> |
|
57 | 57 | <p class="textcenter"><small><%= link_to l(:label_news_view_all), :controller => 'projects', :action => 'list_news', :id => @project %></small></p> |
|
58 | 58 | </div> |
|
59 | 59 | <% end %> |
|
60 | 60 | </div> |
|
61 | 61 | |
|
62 | 62 | <% content_for :header_tags do %> |
|
63 | 63 | <%= auto_discovery_link_tag(:rss, {:controller => 'feeds', :action => 'issues', :project_id => @project, :key => @key}, {:title => l(:label_reported_issues)}) %> |
|
64 | 64 | <%= auto_discovery_link_tag(:atom, {:controller => 'feeds', :action => 'issues', :project_id => @project, :key => @key, :format => 'atom'}, {:title => l(:label_reported_issues)}) %> |
|
65 | 65 | |
|
66 | 66 | <%= auto_discovery_link_tag(:rss, {:controller => 'feeds', :action => 'history', :project_id => @project, :key => @key }, {:title => l(:label_changes_details)}) %> |
|
67 | 67 | <%= auto_discovery_link_tag(:atom, {:controller => 'feeds', :action => 'history', :project_id => @project, :key => @key, :format => 'atom'}, {:title => l(:label_changes_details)}) %> |
|
68 | 68 | |
|
69 | 69 | <%= auto_discovery_link_tag(:rss, {:controller => 'feeds', :action => 'news', :project_id => @project, :key => @key}, {:title => l(:label_news_latest)}) %> |
|
70 | 70 | <%= auto_discovery_link_tag(:atom, {:controller => 'feeds', :action => 'news', :project_id => @project, :key => @key, :format => 'atom'}, {:title => l(:label_news_latest)}) %> |
|
71 | 71 | <% end %> |
General Comments 0
You need to be logged in to leave comments.
Login now