##// END OF EJS Templates
html5 compliance....
Jean-Philippe Lang -
r9927:c6106543e1c5
parent child
Show More
@@ -1,396 +1,396
1 # encoding: utf-8
1 # encoding: utf-8
2 #
2 #
3 # Redmine - project management software
3 # Redmine - project management software
4 # Copyright (C) 2006-2012 Jean-Philippe Lang
4 # Copyright (C) 2006-2012 Jean-Philippe Lang
5 #
5 #
6 # This program is free software; you can redistribute it and/or
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
9 # of the License, or (at your option) any later version.
10 #
10 #
11 # This program is distributed in the hope that it will be useful,
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
14 # GNU General Public License for more details.
15 #
15 #
16 # You should have received a copy of the GNU General Public License
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
19
20 module IssuesHelper
20 module IssuesHelper
21 include ApplicationHelper
21 include ApplicationHelper
22
22
23 def issue_list(issues, &block)
23 def issue_list(issues, &block)
24 ancestors = []
24 ancestors = []
25 issues.each do |issue|
25 issues.each do |issue|
26 while (ancestors.any? && !issue.is_descendant_of?(ancestors.last))
26 while (ancestors.any? && !issue.is_descendant_of?(ancestors.last))
27 ancestors.pop
27 ancestors.pop
28 end
28 end
29 yield issue, ancestors.size
29 yield issue, ancestors.size
30 ancestors << issue unless issue.leaf?
30 ancestors << issue unless issue.leaf?
31 end
31 end
32 end
32 end
33
33
34 # Renders a HTML/CSS tooltip
34 # Renders a HTML/CSS tooltip
35 #
35 #
36 # To use, a trigger div is needed. This is a div with the class of "tooltip"
36 # To use, a trigger div is needed. This is a div with the class of "tooltip"
37 # that contains this method wrapped in a span with the class of "tip"
37 # that contains this method wrapped in a span with the class of "tip"
38 #
38 #
39 # <div class="tooltip"><%= link_to_issue(issue) %>
39 # <div class="tooltip"><%= link_to_issue(issue) %>
40 # <span class="tip"><%= render_issue_tooltip(issue) %></span>
40 # <span class="tip"><%= render_issue_tooltip(issue) %></span>
41 # </div>
41 # </div>
42 #
42 #
43 def render_issue_tooltip(issue)
43 def render_issue_tooltip(issue)
44 @cached_label_status ||= l(:field_status)
44 @cached_label_status ||= l(:field_status)
45 @cached_label_start_date ||= l(:field_start_date)
45 @cached_label_start_date ||= l(:field_start_date)
46 @cached_label_due_date ||= l(:field_due_date)
46 @cached_label_due_date ||= l(:field_due_date)
47 @cached_label_assigned_to ||= l(:field_assigned_to)
47 @cached_label_assigned_to ||= l(:field_assigned_to)
48 @cached_label_priority ||= l(:field_priority)
48 @cached_label_priority ||= l(:field_priority)
49 @cached_label_project ||= l(:field_project)
49 @cached_label_project ||= l(:field_project)
50
50
51 link_to_issue(issue) + "<br /><br />".html_safe +
51 link_to_issue(issue) + "<br /><br />".html_safe +
52 "<strong>#{@cached_label_project}</strong>: #{link_to_project(issue.project)}<br />".html_safe +
52 "<strong>#{@cached_label_project}</strong>: #{link_to_project(issue.project)}<br />".html_safe +
53 "<strong>#{@cached_label_status}</strong>: #{h(issue.status.name)}<br />".html_safe +
53 "<strong>#{@cached_label_status}</strong>: #{h(issue.status.name)}<br />".html_safe +
54 "<strong>#{@cached_label_start_date}</strong>: #{format_date(issue.start_date)}<br />".html_safe +
54 "<strong>#{@cached_label_start_date}</strong>: #{format_date(issue.start_date)}<br />".html_safe +
55 "<strong>#{@cached_label_due_date}</strong>: #{format_date(issue.due_date)}<br />".html_safe +
55 "<strong>#{@cached_label_due_date}</strong>: #{format_date(issue.due_date)}<br />".html_safe +
56 "<strong>#{@cached_label_assigned_to}</strong>: #{h(issue.assigned_to)}<br />".html_safe +
56 "<strong>#{@cached_label_assigned_to}</strong>: #{h(issue.assigned_to)}<br />".html_safe +
57 "<strong>#{@cached_label_priority}</strong>: #{h(issue.priority.name)}".html_safe
57 "<strong>#{@cached_label_priority}</strong>: #{h(issue.priority.name)}".html_safe
58 end
58 end
59
59
60 def issue_heading(issue)
60 def issue_heading(issue)
61 h("#{issue.tracker} ##{issue.id}")
61 h("#{issue.tracker} ##{issue.id}")
62 end
62 end
63
63
64 def render_issue_subject_with_tree(issue)
64 def render_issue_subject_with_tree(issue)
65 s = ''
65 s = ''
66 ancestors = issue.root? ? [] : issue.ancestors.visible.all
66 ancestors = issue.root? ? [] : issue.ancestors.visible.all
67 ancestors.each do |ancestor|
67 ancestors.each do |ancestor|
68 s << '<div>' + content_tag('p', link_to_issue(ancestor))
68 s << '<div>' + content_tag('p', link_to_issue(ancestor))
69 end
69 end
70 s << '<div>'
70 s << '<div>'
71 subject = h(issue.subject)
71 subject = h(issue.subject)
72 if issue.is_private?
72 if issue.is_private?
73 subject = content_tag('span', l(:field_is_private), :class => 'private') + ' ' + subject
73 subject = content_tag('span', l(:field_is_private), :class => 'private') + ' ' + subject
74 end
74 end
75 s << content_tag('h3', subject)
75 s << content_tag('h3', subject)
76 s << '</div>' * (ancestors.size + 1)
76 s << '</div>' * (ancestors.size + 1)
77 s.html_safe
77 s.html_safe
78 end
78 end
79
79
80 def render_descendants_tree(issue)
80 def render_descendants_tree(issue)
81 s = '<form><table class="list issues">'
81 s = '<form><table class="list issues">'
82 issue_list(issue.descendants.visible.sort_by(&:lft)) do |child, level|
82 issue_list(issue.descendants.visible.sort_by(&:lft)) do |child, level|
83 s << content_tag('tr',
83 s << content_tag('tr',
84 content_tag('td', check_box_tag("ids[]", child.id, false, :id => nil), :class => 'checkbox') +
84 content_tag('td', check_box_tag("ids[]", child.id, false, :id => nil), :class => 'checkbox') +
85 content_tag('td', link_to_issue(child, :truncate => 60), :class => 'subject') +
85 content_tag('td', link_to_issue(child, :truncate => 60), :class => 'subject') +
86 content_tag('td', h(child.status)) +
86 content_tag('td', h(child.status)) +
87 content_tag('td', link_to_user(child.assigned_to)) +
87 content_tag('td', link_to_user(child.assigned_to)) +
88 content_tag('td', progress_bar(child.done_ratio, :width => '80px')),
88 content_tag('td', progress_bar(child.done_ratio, :width => '80px')),
89 :class => "issue issue-#{child.id} hascontextmenu #{level > 0 ? "idnt idnt-#{level}" : nil}")
89 :class => "issue issue-#{child.id} hascontextmenu #{level > 0 ? "idnt idnt-#{level}" : nil}")
90 end
90 end
91 s << '</table></form>'
91 s << '</table></form>'
92 s.html_safe
92 s.html_safe
93 end
93 end
94
94
95 class IssueFieldsRows
95 class IssueFieldsRows
96 include ActionView::Helpers::TagHelper
96 include ActionView::Helpers::TagHelper
97
97
98 def initialize
98 def initialize
99 @left = []
99 @left = []
100 @right = []
100 @right = []
101 end
101 end
102
102
103 def left(*args)
103 def left(*args)
104 args.any? ? @left << cells(*args) : @left
104 args.any? ? @left << cells(*args) : @left
105 end
105 end
106
106
107 def right(*args)
107 def right(*args)
108 args.any? ? @right << cells(*args) : @right
108 args.any? ? @right << cells(*args) : @right
109 end
109 end
110
110
111 def size
111 def size
112 @left.size > @right.size ? @left.size : @right.size
112 @left.size > @right.size ? @left.size : @right.size
113 end
113 end
114
114
115 def to_html
115 def to_html
116 html = ''.html_safe
116 html = ''.html_safe
117 blank = content_tag('th', '') + content_tag('td', '')
117 blank = content_tag('th', '') + content_tag('td', '')
118 size.times do |i|
118 size.times do |i|
119 left = @left[i] || blank
119 left = @left[i] || blank
120 right = @right[i] || blank
120 right = @right[i] || blank
121 html << content_tag('tr', left + right)
121 html << content_tag('tr', left + right)
122 end
122 end
123 html
123 html
124 end
124 end
125
125
126 def cells(label, text, options={})
126 def cells(label, text, options={})
127 content_tag('th', "#{label}:", options) + content_tag('td', text, options)
127 content_tag('th', "#{label}:", options) + content_tag('td', text, options)
128 end
128 end
129 end
129 end
130
130
131 def issue_fields_rows
131 def issue_fields_rows
132 r = IssueFieldsRows.new
132 r = IssueFieldsRows.new
133 yield r
133 yield r
134 r.to_html
134 r.to_html
135 end
135 end
136
136
137 def render_custom_fields_rows(issue)
137 def render_custom_fields_rows(issue)
138 return if issue.custom_field_values.empty?
138 return if issue.custom_field_values.empty?
139 ordered_values = []
139 ordered_values = []
140 half = (issue.custom_field_values.size / 2.0).ceil
140 half = (issue.custom_field_values.size / 2.0).ceil
141 half.times do |i|
141 half.times do |i|
142 ordered_values << issue.custom_field_values[i]
142 ordered_values << issue.custom_field_values[i]
143 ordered_values << issue.custom_field_values[i + half]
143 ordered_values << issue.custom_field_values[i + half]
144 end
144 end
145 s = "<tr>\n"
145 s = "<tr>\n"
146 n = 0
146 n = 0
147 ordered_values.compact.each do |value|
147 ordered_values.compact.each do |value|
148 s << "</tr>\n<tr>\n" if n > 0 && (n % 2) == 0
148 s << "</tr>\n<tr>\n" if n > 0 && (n % 2) == 0
149 s << "\t<th>#{ h(value.custom_field.name) }:</th><td>#{ simple_format_without_paragraph(h(show_value(value))) }</td>\n"
149 s << "\t<th>#{ h(value.custom_field.name) }:</th><td>#{ simple_format_without_paragraph(h(show_value(value))) }</td>\n"
150 n += 1
150 n += 1
151 end
151 end
152 s << "</tr>\n"
152 s << "</tr>\n"
153 s.html_safe
153 s.html_safe
154 end
154 end
155
155
156 def issues_destroy_confirmation_message(issues)
156 def issues_destroy_confirmation_message(issues)
157 issues = [issues] unless issues.is_a?(Array)
157 issues = [issues] unless issues.is_a?(Array)
158 message = l(:text_issues_destroy_confirmation)
158 message = l(:text_issues_destroy_confirmation)
159 descendant_count = issues.inject(0) {|memo, i| memo += (i.right - i.left - 1)/2}
159 descendant_count = issues.inject(0) {|memo, i| memo += (i.right - i.left - 1)/2}
160 if descendant_count > 0
160 if descendant_count > 0
161 issues.each do |issue|
161 issues.each do |issue|
162 next if issue.root?
162 next if issue.root?
163 issues.each do |other_issue|
163 issues.each do |other_issue|
164 descendant_count -= 1 if issue.is_descendant_of?(other_issue)
164 descendant_count -= 1 if issue.is_descendant_of?(other_issue)
165 end
165 end
166 end
166 end
167 if descendant_count > 0
167 if descendant_count > 0
168 message << "\n" + l(:text_issues_destroy_descendants_confirmation, :count => descendant_count)
168 message << "\n" + l(:text_issues_destroy_descendants_confirmation, :count => descendant_count)
169 end
169 end
170 end
170 end
171 message
171 message
172 end
172 end
173
173
174 def sidebar_queries
174 def sidebar_queries
175 unless @sidebar_queries
175 unless @sidebar_queries
176 @sidebar_queries = Query.visible.all(
176 @sidebar_queries = Query.visible.all(
177 :order => "#{Query.table_name}.name ASC",
177 :order => "#{Query.table_name}.name ASC",
178 # Project specific queries and global queries
178 # Project specific queries and global queries
179 :conditions => (@project.nil? ? ["project_id IS NULL"] : ["project_id IS NULL OR project_id = ?", @project.id])
179 :conditions => (@project.nil? ? ["project_id IS NULL"] : ["project_id IS NULL OR project_id = ?", @project.id])
180 )
180 )
181 end
181 end
182 @sidebar_queries
182 @sidebar_queries
183 end
183 end
184
184
185 def query_links(title, queries)
185 def query_links(title, queries)
186 # links to #index on issues/show
186 # links to #index on issues/show
187 url_params = controller_name == 'issues' ? {:controller => 'issues', :action => 'index', :project_id => @project} : params
187 url_params = controller_name == 'issues' ? {:controller => 'issues', :action => 'index', :project_id => @project} : params
188
188
189 content_tag('h3', h(title)) +
189 content_tag('h3', h(title)) +
190 queries.collect {|query|
190 queries.collect {|query|
191 css = 'query'
191 css = 'query'
192 css << ' selected' if query == @query
192 css << ' selected' if query == @query
193 link_to(h(query.name), url_params.merge(:query_id => query), :class => css)
193 link_to(h(query.name), url_params.merge(:query_id => query), :class => css)
194 }.join('<br />').html_safe
194 }.join('<br />').html_safe
195 end
195 end
196
196
197 def render_sidebar_queries
197 def render_sidebar_queries
198 out = ''.html_safe
198 out = ''.html_safe
199 queries = sidebar_queries.select {|q| !q.is_public?}
199 queries = sidebar_queries.select {|q| !q.is_public?}
200 out << query_links(l(:label_my_queries), queries) if queries.any?
200 out << query_links(l(:label_my_queries), queries) if queries.any?
201 queries = sidebar_queries.select {|q| q.is_public?}
201 queries = sidebar_queries.select {|q| q.is_public?}
202 out << query_links(l(:label_query_plural), queries) if queries.any?
202 out << query_links(l(:label_query_plural), queries) if queries.any?
203 out
203 out
204 end
204 end
205
205
206 # Returns the textual representation of a journal details
206 # Returns the textual representation of a journal details
207 # as an array of strings
207 # as an array of strings
208 def details_to_strings(details, no_html=false, options={})
208 def details_to_strings(details, no_html=false, options={})
209 options[:only_path] = (options[:only_path] == false ? false : true)
209 options[:only_path] = (options[:only_path] == false ? false : true)
210 strings = []
210 strings = []
211 values_by_field = {}
211 values_by_field = {}
212 details.each do |detail|
212 details.each do |detail|
213 if detail.property == 'cf'
213 if detail.property == 'cf'
214 field_id = detail.prop_key
214 field_id = detail.prop_key
215 field = CustomField.find_by_id(field_id)
215 field = CustomField.find_by_id(field_id)
216 if field && field.multiple?
216 if field && field.multiple?
217 values_by_field[field_id] ||= {:added => [], :deleted => []}
217 values_by_field[field_id] ||= {:added => [], :deleted => []}
218 if detail.old_value
218 if detail.old_value
219 values_by_field[field_id][:deleted] << detail.old_value
219 values_by_field[field_id][:deleted] << detail.old_value
220 end
220 end
221 if detail.value
221 if detail.value
222 values_by_field[field_id][:added] << detail.value
222 values_by_field[field_id][:added] << detail.value
223 end
223 end
224 next
224 next
225 end
225 end
226 end
226 end
227 strings << show_detail(detail, no_html, options)
227 strings << show_detail(detail, no_html, options)
228 end
228 end
229 values_by_field.each do |field_id, changes|
229 values_by_field.each do |field_id, changes|
230 detail = JournalDetail.new(:property => 'cf', :prop_key => field_id)
230 detail = JournalDetail.new(:property => 'cf', :prop_key => field_id)
231 if changes[:added].any?
231 if changes[:added].any?
232 detail.value = changes[:added]
232 detail.value = changes[:added]
233 strings << show_detail(detail, no_html, options)
233 strings << show_detail(detail, no_html, options)
234 elsif changes[:deleted].any?
234 elsif changes[:deleted].any?
235 detail.old_value = changes[:deleted]
235 detail.old_value = changes[:deleted]
236 strings << show_detail(detail, no_html, options)
236 strings << show_detail(detail, no_html, options)
237 end
237 end
238 end
238 end
239 strings
239 strings
240 end
240 end
241
241
242 # Returns the textual representation of a single journal detail
242 # Returns the textual representation of a single journal detail
243 def show_detail(detail, no_html=false, options={})
243 def show_detail(detail, no_html=false, options={})
244 multiple = false
244 multiple = false
245 case detail.property
245 case detail.property
246 when 'attr'
246 when 'attr'
247 field = detail.prop_key.to_s.gsub(/\_id$/, "")
247 field = detail.prop_key.to_s.gsub(/\_id$/, "")
248 label = l(("field_" + field).to_sym)
248 label = l(("field_" + field).to_sym)
249 case detail.prop_key
249 case detail.prop_key
250 when 'due_date', 'start_date'
250 when 'due_date', 'start_date'
251 value = format_date(detail.value.to_date) if detail.value
251 value = format_date(detail.value.to_date) if detail.value
252 old_value = format_date(detail.old_value.to_date) if detail.old_value
252 old_value = format_date(detail.old_value.to_date) if detail.old_value
253
253
254 when 'project_id', 'status_id', 'tracker_id', 'assigned_to_id',
254 when 'project_id', 'status_id', 'tracker_id', 'assigned_to_id',
255 'priority_id', 'category_id', 'fixed_version_id'
255 'priority_id', 'category_id', 'fixed_version_id'
256 value = find_name_by_reflection(field, detail.value)
256 value = find_name_by_reflection(field, detail.value)
257 old_value = find_name_by_reflection(field, detail.old_value)
257 old_value = find_name_by_reflection(field, detail.old_value)
258
258
259 when 'estimated_hours'
259 when 'estimated_hours'
260 value = "%0.02f" % detail.value.to_f unless detail.value.blank?
260 value = "%0.02f" % detail.value.to_f unless detail.value.blank?
261 old_value = "%0.02f" % detail.old_value.to_f unless detail.old_value.blank?
261 old_value = "%0.02f" % detail.old_value.to_f unless detail.old_value.blank?
262
262
263 when 'parent_id'
263 when 'parent_id'
264 label = l(:field_parent_issue)
264 label = l(:field_parent_issue)
265 value = "##{detail.value}" unless detail.value.blank?
265 value = "##{detail.value}" unless detail.value.blank?
266 old_value = "##{detail.old_value}" unless detail.old_value.blank?
266 old_value = "##{detail.old_value}" unless detail.old_value.blank?
267
267
268 when 'is_private'
268 when 'is_private'
269 value = l(detail.value == "0" ? :general_text_No : :general_text_Yes) unless detail.value.blank?
269 value = l(detail.value == "0" ? :general_text_No : :general_text_Yes) unless detail.value.blank?
270 old_value = l(detail.old_value == "0" ? :general_text_No : :general_text_Yes) unless detail.old_value.blank?
270 old_value = l(detail.old_value == "0" ? :general_text_No : :general_text_Yes) unless detail.old_value.blank?
271 end
271 end
272 when 'cf'
272 when 'cf'
273 custom_field = CustomField.find_by_id(detail.prop_key)
273 custom_field = CustomField.find_by_id(detail.prop_key)
274 if custom_field
274 if custom_field
275 multiple = custom_field.multiple?
275 multiple = custom_field.multiple?
276 label = custom_field.name
276 label = custom_field.name
277 value = format_value(detail.value, custom_field.field_format) if detail.value
277 value = format_value(detail.value, custom_field.field_format) if detail.value
278 old_value = format_value(detail.old_value, custom_field.field_format) if detail.old_value
278 old_value = format_value(detail.old_value, custom_field.field_format) if detail.old_value
279 end
279 end
280 when 'attachment'
280 when 'attachment'
281 label = l(:label_attachment)
281 label = l(:label_attachment)
282 end
282 end
283 call_hook(:helper_issues_show_detail_after_setting,
283 call_hook(:helper_issues_show_detail_after_setting,
284 {:detail => detail, :label => label, :value => value, :old_value => old_value })
284 {:detail => detail, :label => label, :value => value, :old_value => old_value })
285
285
286 label ||= detail.prop_key
286 label ||= detail.prop_key
287 value ||= detail.value
287 value ||= detail.value
288 old_value ||= detail.old_value
288 old_value ||= detail.old_value
289
289
290 unless no_html
290 unless no_html
291 label = content_tag('strong', label)
291 label = content_tag('strong', label)
292 old_value = content_tag("i", h(old_value)) if detail.old_value
292 old_value = content_tag("i", h(old_value)) if detail.old_value
293 old_value = content_tag("strike", old_value) if detail.old_value and detail.value.blank?
293 old_value = content_tag("del", old_value) if detail.old_value and detail.value.blank?
294 if detail.property == 'attachment' && !value.blank? && atta = Attachment.find_by_id(detail.prop_key)
294 if detail.property == 'attachment' && !value.blank? && atta = Attachment.find_by_id(detail.prop_key)
295 # Link to the attachment if it has not been removed
295 # Link to the attachment if it has not been removed
296 value = link_to_attachment(atta, :download => true, :only_path => options[:only_path])
296 value = link_to_attachment(atta, :download => true, :only_path => options[:only_path])
297 if options[:only_path] != false && atta.is_text?
297 if options[:only_path] != false && atta.is_text?
298 value += link_to(
298 value += link_to(
299 image_tag('magnifier.png'),
299 image_tag('magnifier.png'),
300 :controller => 'attachments', :action => 'show',
300 :controller => 'attachments', :action => 'show',
301 :id => atta, :filename => atta.filename
301 :id => atta, :filename => atta.filename
302 )
302 )
303 end
303 end
304 else
304 else
305 value = content_tag("i", h(value)) if value
305 value = content_tag("i", h(value)) if value
306 end
306 end
307 end
307 end
308
308
309 if detail.property == 'attr' && detail.prop_key == 'description'
309 if detail.property == 'attr' && detail.prop_key == 'description'
310 s = l(:text_journal_changed_no_detail, :label => label)
310 s = l(:text_journal_changed_no_detail, :label => label)
311 unless no_html
311 unless no_html
312 diff_link = link_to 'diff',
312 diff_link = link_to 'diff',
313 {:controller => 'journals', :action => 'diff', :id => detail.journal_id,
313 {:controller => 'journals', :action => 'diff', :id => detail.journal_id,
314 :detail_id => detail.id, :only_path => options[:only_path]},
314 :detail_id => detail.id, :only_path => options[:only_path]},
315 :title => l(:label_view_diff)
315 :title => l(:label_view_diff)
316 s << " (#{ diff_link })"
316 s << " (#{ diff_link })"
317 end
317 end
318 s.html_safe
318 s.html_safe
319 elsif detail.value.present?
319 elsif detail.value.present?
320 case detail.property
320 case detail.property
321 when 'attr', 'cf'
321 when 'attr', 'cf'
322 if detail.old_value.present?
322 if detail.old_value.present?
323 l(:text_journal_changed, :label => label, :old => old_value, :new => value).html_safe
323 l(:text_journal_changed, :label => label, :old => old_value, :new => value).html_safe
324 elsif multiple
324 elsif multiple
325 l(:text_journal_added, :label => label, :value => value).html_safe
325 l(:text_journal_added, :label => label, :value => value).html_safe
326 else
326 else
327 l(:text_journal_set_to, :label => label, :value => value).html_safe
327 l(:text_journal_set_to, :label => label, :value => value).html_safe
328 end
328 end
329 when 'attachment'
329 when 'attachment'
330 l(:text_journal_added, :label => label, :value => value).html_safe
330 l(:text_journal_added, :label => label, :value => value).html_safe
331 end
331 end
332 else
332 else
333 l(:text_journal_deleted, :label => label, :old => old_value).html_safe
333 l(:text_journal_deleted, :label => label, :old => old_value).html_safe
334 end
334 end
335 end
335 end
336
336
337 # Find the name of an associated record stored in the field attribute
337 # Find the name of an associated record stored in the field attribute
338 def find_name_by_reflection(field, id)
338 def find_name_by_reflection(field, id)
339 association = Issue.reflect_on_association(field.to_sym)
339 association = Issue.reflect_on_association(field.to_sym)
340 if association
340 if association
341 record = association.class_name.constantize.find_by_id(id)
341 record = association.class_name.constantize.find_by_id(id)
342 return record.name if record
342 return record.name if record
343 end
343 end
344 end
344 end
345
345
346 # Renders issue children recursively
346 # Renders issue children recursively
347 def render_api_issue_children(issue, api)
347 def render_api_issue_children(issue, api)
348 return if issue.leaf?
348 return if issue.leaf?
349 api.array :children do
349 api.array :children do
350 issue.children.each do |child|
350 issue.children.each do |child|
351 api.issue(:id => child.id) do
351 api.issue(:id => child.id) do
352 api.tracker(:id => child.tracker_id, :name => child.tracker.name) unless child.tracker.nil?
352 api.tracker(:id => child.tracker_id, :name => child.tracker.name) unless child.tracker.nil?
353 api.subject child.subject
353 api.subject child.subject
354 render_api_issue_children(child, api)
354 render_api_issue_children(child, api)
355 end
355 end
356 end
356 end
357 end
357 end
358 end
358 end
359
359
360 def issues_to_csv(issues, project, query, options={})
360 def issues_to_csv(issues, project, query, options={})
361 decimal_separator = l(:general_csv_decimal_separator)
361 decimal_separator = l(:general_csv_decimal_separator)
362 encoding = l(:general_csv_encoding)
362 encoding = l(:general_csv_encoding)
363 columns = (options[:columns] == 'all' ? query.available_columns : query.columns)
363 columns = (options[:columns] == 'all' ? query.available_columns : query.columns)
364
364
365 export = FCSV.generate(:col_sep => l(:general_csv_separator)) do |csv|
365 export = FCSV.generate(:col_sep => l(:general_csv_separator)) do |csv|
366 # csv header fields
366 # csv header fields
367 csv << [ "#" ] + columns.collect {|c| Redmine::CodesetUtil.from_utf8(c.caption.to_s, encoding) } +
367 csv << [ "#" ] + columns.collect {|c| Redmine::CodesetUtil.from_utf8(c.caption.to_s, encoding) } +
368 (options[:description] ? [Redmine::CodesetUtil.from_utf8(l(:field_description), encoding)] : [])
368 (options[:description] ? [Redmine::CodesetUtil.from_utf8(l(:field_description), encoding)] : [])
369
369
370 # csv lines
370 # csv lines
371 issues.each do |issue|
371 issues.each do |issue|
372 col_values = columns.collect do |column|
372 col_values = columns.collect do |column|
373 s = if column.is_a?(QueryCustomFieldColumn)
373 s = if column.is_a?(QueryCustomFieldColumn)
374 cv = issue.custom_field_values.detect {|v| v.custom_field_id == column.custom_field.id}
374 cv = issue.custom_field_values.detect {|v| v.custom_field_id == column.custom_field.id}
375 show_value(cv)
375 show_value(cv)
376 else
376 else
377 value = column.value(issue)
377 value = column.value(issue)
378 if value.is_a?(Date)
378 if value.is_a?(Date)
379 format_date(value)
379 format_date(value)
380 elsif value.is_a?(Time)
380 elsif value.is_a?(Time)
381 format_time(value)
381 format_time(value)
382 elsif value.is_a?(Float)
382 elsif value.is_a?(Float)
383 ("%.2f" % value).gsub('.', decimal_separator)
383 ("%.2f" % value).gsub('.', decimal_separator)
384 else
384 else
385 value
385 value
386 end
386 end
387 end
387 end
388 s.to_s
388 s.to_s
389 end
389 end
390 csv << [ issue.id.to_s ] + col_values.collect {|c| Redmine::CodesetUtil.from_utf8(c.to_s, encoding) } +
390 csv << [ issue.id.to_s ] + col_values.collect {|c| Redmine::CodesetUtil.from_utf8(c.to_s, encoding) } +
391 (options[:description] ? [Redmine::CodesetUtil.from_utf8(issue.description, encoding)] : [])
391 (options[:description] ? [Redmine::CodesetUtil.from_utf8(issue.description, encoding)] : [])
392 end
392 end
393 end
393 end
394 export
394 export
395 end
395 end
396 end
396 end
@@ -1,18 +1,18
1 <% if defined?(container) && container && container.saved_attachments %>
1 <% if defined?(container) && container && container.saved_attachments %>
2 <% container.saved_attachments.each_with_index do |attachment, i| %>
2 <% container.saved_attachments.each_with_index do |attachment, i| %>
3 <span class="icon icon-attachment" style="display:block; line-height:1.5em;">
3 <span class="icon icon-attachment" style="display:block; line-height:1.5em;">
4 <%= h(attachment.filename) %> (<%= number_to_human_size(attachment.filesize) %>)
4 <%= h(attachment.filename) %> (<%= number_to_human_size(attachment.filesize) %>)
5 <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.id}.#{attachment.digest}" %>
5 <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.id}.#{attachment.digest}" %>
6 </span>
6 </span>
7 <% end %>
7 <% end %>
8 <% end %>
8 <% end %>
9 <span id="attachments_fields">
9 <span id="attachments_fields">
10 <span>
10 <span>
11 <%= file_field_tag 'attachments[1][file]', :size => 30, :id => nil, :class => 'file',
11 <%= file_field_tag 'attachments[1][file]', :id => nil, :class => 'file',
12 :onchange => "checkFileSize(this, #{Setting.attachment_max_size.to_i.kilobytes}, '#{escape_javascript(l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)))}');" -%>
12 :onchange => "checkFileSize(this, #{Setting.attachment_max_size.to_i.kilobytes}, '#{escape_javascript(l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)))}');" -%>
13 <%= text_field_tag 'attachments[1][description]', '', :id => nil, :class => 'description', :maxlength => 255, :placeholder => l(:label_optional_description) %>
13 <%= text_field_tag 'attachments[1][description]', '', :id => nil, :class => 'description', :maxlength => 255, :placeholder => l(:label_optional_description) %>
14 <%= link_to_function(image_tag('delete.png'), 'removeFileField(this)', :title => (l(:button_delete))) %>
14 <%= link_to_function(image_tag('delete.png'), 'removeFileField(this)', :title => (l(:button_delete))) %>
15 </span>
15 </span>
16 </span>
16 </span>
17 <span class="add_attachment"><%= link_to l(:label_add_another_file), '#', :onclick => 'addFileField(); return false;', :class => 'add_attachment' %>
17 <span class="add_attachment"><%= link_to l(:label_add_another_file), '#', :onclick => 'addFileField(); return false;', :class => 'add_attachment' %>
18 (<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)</span>
18 (<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)</span>
@@ -1,198 +1,199
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2012 Jean-Philippe Lang
2 # Copyright (C) 2006-2012 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.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class IssuesHelperTest < ActionView::TestCase
20 class IssuesHelperTest < ActionView::TestCase
21 include ApplicationHelper
21 include ApplicationHelper
22 include IssuesHelper
22 include IssuesHelper
23 include CustomFieldsHelper
23 include CustomFieldsHelper
24 include ERB::Util
24 include ERB::Util
25
25
26 fixtures :projects, :trackers, :issue_statuses, :issues,
26 fixtures :projects, :trackers, :issue_statuses, :issues,
27 :enumerations, :users, :issue_categories,
27 :enumerations, :users, :issue_categories,
28 :projects_trackers,
28 :projects_trackers,
29 :roles,
29 :roles,
30 :member_roles,
30 :member_roles,
31 :members,
31 :members,
32 :enabled_modules,
32 :enabled_modules,
33 :workflows,
33 :workflows,
34 :custom_fields,
34 :custom_fields,
35 :attachments
35 :attachments,
36 :versions
36
37
37 def setup
38 def setup
38 super
39 super
39 set_language_if_valid('en')
40 set_language_if_valid('en')
40 User.current = nil
41 User.current = nil
41 end
42 end
42
43
43 def test_issue_heading
44 def test_issue_heading
44 assert_equal "Bug #1", issue_heading(Issue.find(1))
45 assert_equal "Bug #1", issue_heading(Issue.find(1))
45 end
46 end
46
47
47 def test_issues_destroy_confirmation_message_with_one_root_issue
48 def test_issues_destroy_confirmation_message_with_one_root_issue
48 assert_equal l(:text_issues_destroy_confirmation), issues_destroy_confirmation_message(Issue.find(1))
49 assert_equal l(:text_issues_destroy_confirmation), issues_destroy_confirmation_message(Issue.find(1))
49 end
50 end
50
51
51 def test_issues_destroy_confirmation_message_with_an_arrayt_of_root_issues
52 def test_issues_destroy_confirmation_message_with_an_arrayt_of_root_issues
52 assert_equal l(:text_issues_destroy_confirmation), issues_destroy_confirmation_message(Issue.find([1, 2]))
53 assert_equal l(:text_issues_destroy_confirmation), issues_destroy_confirmation_message(Issue.find([1, 2]))
53 end
54 end
54
55
55 def test_issues_destroy_confirmation_message_with_one_parent_issue
56 def test_issues_destroy_confirmation_message_with_one_parent_issue
56 Issue.find(2).update_attribute :parent_issue_id, 1
57 Issue.find(2).update_attribute :parent_issue_id, 1
57 assert_equal l(:text_issues_destroy_confirmation) + "\n" + l(:text_issues_destroy_descendants_confirmation, :count => 1),
58 assert_equal l(:text_issues_destroy_confirmation) + "\n" + l(:text_issues_destroy_descendants_confirmation, :count => 1),
58 issues_destroy_confirmation_message(Issue.find(1))
59 issues_destroy_confirmation_message(Issue.find(1))
59 end
60 end
60
61
61 def test_issues_destroy_confirmation_message_with_one_parent_issue_and_its_child
62 def test_issues_destroy_confirmation_message_with_one_parent_issue_and_its_child
62 Issue.find(2).update_attribute :parent_issue_id, 1
63 Issue.find(2).update_attribute :parent_issue_id, 1
63 assert_equal l(:text_issues_destroy_confirmation), issues_destroy_confirmation_message(Issue.find([1, 2]))
64 assert_equal l(:text_issues_destroy_confirmation), issues_destroy_confirmation_message(Issue.find([1, 2]))
64 end
65 end
65
66
66 context "IssuesHelper#show_detail" do
67 context "IssuesHelper#show_detail" do
67 context "with no_html" do
68 context "with no_html" do
68 should 'show a changing attribute' do
69 should 'show a changing attribute' do
69 @detail = JournalDetail.new(:property => 'attr', :old_value => '40', :value => '100', :prop_key => 'done_ratio')
70 @detail = JournalDetail.new(:property => 'attr', :old_value => '40', :value => '100', :prop_key => 'done_ratio')
70 assert_equal "% Done changed from 40 to 100", show_detail(@detail, true)
71 assert_equal "% Done changed from 40 to 100", show_detail(@detail, true)
71 end
72 end
72
73
73 should 'show a new attribute' do
74 should 'show a new attribute' do
74 @detail = JournalDetail.new(:property => 'attr', :old_value => nil, :value => '100', :prop_key => 'done_ratio')
75 @detail = JournalDetail.new(:property => 'attr', :old_value => nil, :value => '100', :prop_key => 'done_ratio')
75 assert_equal "% Done set to 100", show_detail(@detail, true)
76 assert_equal "% Done set to 100", show_detail(@detail, true)
76 end
77 end
77
78
78 should 'show a deleted attribute' do
79 should 'show a deleted attribute' do
79 @detail = JournalDetail.new(:property => 'attr', :old_value => '50', :value => nil, :prop_key => 'done_ratio')
80 @detail = JournalDetail.new(:property => 'attr', :old_value => '50', :value => nil, :prop_key => 'done_ratio')
80 assert_equal "% Done deleted (50)", show_detail(@detail, true)
81 assert_equal "% Done deleted (50)", show_detail(@detail, true)
81 end
82 end
82 end
83 end
83
84
84 context "with html" do
85 context "with html" do
85 should 'show a changing attribute with HTML highlights' do
86 should 'show a changing attribute with HTML highlights' do
86 @detail = JournalDetail.new(:property => 'attr', :old_value => '40', :value => '100', :prop_key => 'done_ratio')
87 @detail = JournalDetail.new(:property => 'attr', :old_value => '40', :value => '100', :prop_key => 'done_ratio')
87 html = show_detail(@detail, false)
88 html = show_detail(@detail, false)
88
89
89 assert_include '<strong>% Done</strong>', html
90 assert_include '<strong>% Done</strong>', html
90 assert_include '<i>40</i>', html
91 assert_include '<i>40</i>', html
91 assert_include '<i>100</i>', html
92 assert_include '<i>100</i>', html
92 end
93 end
93
94
94 should 'show a new attribute with HTML highlights' do
95 should 'show a new attribute with HTML highlights' do
95 @detail = JournalDetail.new(:property => 'attr', :old_value => nil, :value => '100', :prop_key => 'done_ratio')
96 @detail = JournalDetail.new(:property => 'attr', :old_value => nil, :value => '100', :prop_key => 'done_ratio')
96 html = show_detail(@detail, false)
97 html = show_detail(@detail, false)
97
98
98 assert_include '<strong>% Done</strong>', html
99 assert_include '<strong>% Done</strong>', html
99 assert_include '<i>100</i>', html
100 assert_include '<i>100</i>', html
100 end
101 end
101
102
102 should 'show a deleted attribute with HTML highlights' do
103 should 'show a deleted attribute with HTML highlights' do
103 @detail = JournalDetail.new(:property => 'attr', :old_value => '50', :value => nil, :prop_key => 'done_ratio')
104 @detail = JournalDetail.new(:property => 'attr', :old_value => '50', :value => nil, :prop_key => 'done_ratio')
104 html = show_detail(@detail, false)
105 html = show_detail(@detail, false)
105
106
106 assert_include '<strong>% Done</strong>', html
107 assert_include '<strong>% Done</strong>', html
107 assert_include '<strike><i>50</i></strike>', html
108 assert_include '<del><i>50</i></del>', html
108 end
109 end
109 end
110 end
110
111
111 context "with a start_date attribute" do
112 context "with a start_date attribute" do
112 should "format the current date" do
113 should "format the current date" do
113 @detail = JournalDetail.new(:property => 'attr', :old_value => '2010-01-01', :value => '2010-01-31', :prop_key => 'start_date')
114 @detail = JournalDetail.new(:property => 'attr', :old_value => '2010-01-01', :value => '2010-01-31', :prop_key => 'start_date')
114 assert_match "01/31/2010", show_detail(@detail, true)
115 assert_match "01/31/2010", show_detail(@detail, true)
115 end
116 end
116
117
117 should "format the old date" do
118 should "format the old date" do
118 @detail = JournalDetail.new(:property => 'attr', :old_value => '2010-01-01', :value => '2010-01-31', :prop_key => 'start_date')
119 @detail = JournalDetail.new(:property => 'attr', :old_value => '2010-01-01', :value => '2010-01-31', :prop_key => 'start_date')
119 assert_match "01/01/2010", show_detail(@detail, true)
120 assert_match "01/01/2010", show_detail(@detail, true)
120 end
121 end
121 end
122 end
122
123
123 context "with a due_date attribute" do
124 context "with a due_date attribute" do
124 should "format the current date" do
125 should "format the current date" do
125 @detail = JournalDetail.new(:property => 'attr', :old_value => '2010-01-01', :value => '2010-01-31', :prop_key => 'due_date')
126 @detail = JournalDetail.new(:property => 'attr', :old_value => '2010-01-01', :value => '2010-01-31', :prop_key => 'due_date')
126 assert_match "01/31/2010", show_detail(@detail, true)
127 assert_match "01/31/2010", show_detail(@detail, true)
127 end
128 end
128
129
129 should "format the old date" do
130 should "format the old date" do
130 @detail = JournalDetail.new(:property => 'attr', :old_value => '2010-01-01', :value => '2010-01-31', :prop_key => 'due_date')
131 @detail = JournalDetail.new(:property => 'attr', :old_value => '2010-01-01', :value => '2010-01-31', :prop_key => 'due_date')
131 assert_match "01/01/2010", show_detail(@detail, true)
132 assert_match "01/01/2010", show_detail(@detail, true)
132 end
133 end
133 end
134 end
134
135
135 should "show old and new values with a project attribute" do
136 should "show old and new values with a project attribute" do
136 detail = JournalDetail.new(:property => 'attr', :prop_key => 'project_id', :old_value => 1, :value => 2)
137 detail = JournalDetail.new(:property => 'attr', :prop_key => 'project_id', :old_value => 1, :value => 2)
137 assert_match 'eCookbook', show_detail(detail, true)
138 assert_match 'eCookbook', show_detail(detail, true)
138 assert_match 'OnlineStore', show_detail(detail, true)
139 assert_match 'OnlineStore', show_detail(detail, true)
139 end
140 end
140
141
141 should "show old and new values with a issue status attribute" do
142 should "show old and new values with a issue status attribute" do
142 detail = JournalDetail.new(:property => 'attr', :prop_key => 'status_id', :old_value => 1, :value => 2)
143 detail = JournalDetail.new(:property => 'attr', :prop_key => 'status_id', :old_value => 1, :value => 2)
143 assert_match 'New', show_detail(detail, true)
144 assert_match 'New', show_detail(detail, true)
144 assert_match 'Assigned', show_detail(detail, true)
145 assert_match 'Assigned', show_detail(detail, true)
145 end
146 end
146
147
147 should "show old and new values with a tracker attribute" do
148 should "show old and new values with a tracker attribute" do
148 detail = JournalDetail.new(:property => 'attr', :prop_key => 'tracker_id', :old_value => 1, :value => 2)
149 detail = JournalDetail.new(:property => 'attr', :prop_key => 'tracker_id', :old_value => 1, :value => 2)
149 assert_match 'Bug', show_detail(detail, true)
150 assert_match 'Bug', show_detail(detail, true)
150 assert_match 'Feature request', show_detail(detail, true)
151 assert_match 'Feature request', show_detail(detail, true)
151 end
152 end
152
153
153 should "show old and new values with a assigned to attribute" do
154 should "show old and new values with a assigned to attribute" do
154 detail = JournalDetail.new(:property => 'attr', :prop_key => 'assigned_to_id', :old_value => 1, :value => 2)
155 detail = JournalDetail.new(:property => 'attr', :prop_key => 'assigned_to_id', :old_value => 1, :value => 2)
155 assert_match 'redMine Admin', show_detail(detail, true)
156 assert_match 'redMine Admin', show_detail(detail, true)
156 assert_match 'John Smith', show_detail(detail, true)
157 assert_match 'John Smith', show_detail(detail, true)
157 end
158 end
158
159
159 should "show old and new values with a priority attribute" do
160 should "show old and new values with a priority attribute" do
160 detail = JournalDetail.new(:property => 'attr', :prop_key => 'priority_id', :old_value => 4, :value => 5)
161 detail = JournalDetail.new(:property => 'attr', :prop_key => 'priority_id', :old_value => 4, :value => 5)
161 assert_match 'Low', show_detail(detail, true)
162 assert_match 'Low', show_detail(detail, true)
162 assert_match 'Normal', show_detail(detail, true)
163 assert_match 'Normal', show_detail(detail, true)
163 end
164 end
164
165
165 should "show old and new values with a category attribute" do
166 should "show old and new values with a category attribute" do
166 detail = JournalDetail.new(:property => 'attr', :prop_key => 'category_id', :old_value => 1, :value => 2)
167 detail = JournalDetail.new(:property => 'attr', :prop_key => 'category_id', :old_value => 1, :value => 2)
167 assert_match 'Printing', show_detail(detail, true)
168 assert_match 'Printing', show_detail(detail, true)
168 assert_match 'Recipes', show_detail(detail, true)
169 assert_match 'Recipes', show_detail(detail, true)
169 end
170 end
170
171
171 should "show old and new values with a fixed version attribute" do
172 should "show old and new values with a fixed version attribute" do
172 detail = JournalDetail.new(:property => 'attr', :prop_key => 'fixed_version_id', :old_value => 1, :value => 2)
173 detail = JournalDetail.new(:property => 'attr', :prop_key => 'fixed_version_id', :old_value => 1, :value => 2)
173 assert_match '0.1', show_detail(detail, true)
174 assert_match '0.1', show_detail(detail, true)
174 assert_match '1.0', show_detail(detail, true)
175 assert_match '1.0', show_detail(detail, true)
175 end
176 end
176
177
177 should "show old and new values with a estimated hours attribute" do
178 should "show old and new values with a estimated hours attribute" do
178 detail = JournalDetail.new(:property => 'attr', :prop_key => 'estimated_hours', :old_value => '5', :value => '6.3')
179 detail = JournalDetail.new(:property => 'attr', :prop_key => 'estimated_hours', :old_value => '5', :value => '6.3')
179 assert_match '5.00', show_detail(detail, true)
180 assert_match '5.00', show_detail(detail, true)
180 assert_match '6.30', show_detail(detail, true)
181 assert_match '6.30', show_detail(detail, true)
181 end
182 end
182
183
183 should "show old and new values with a custom field" do
184 should "show old and new values with a custom field" do
184 detail = JournalDetail.new(:property => 'cf', :prop_key => '1', :old_value => 'MySQL', :value => 'PostgreSQL')
185 detail = JournalDetail.new(:property => 'cf', :prop_key => '1', :old_value => 'MySQL', :value => 'PostgreSQL')
185 assert_equal 'Database changed from MySQL to PostgreSQL', show_detail(detail, true)
186 assert_equal 'Database changed from MySQL to PostgreSQL', show_detail(detail, true)
186 end
187 end
187
188
188 should "show added file" do
189 should "show added file" do
189 detail = JournalDetail.new(:property => 'attachment', :prop_key => '1', :old_value => nil, :value => 'error281.txt')
190 detail = JournalDetail.new(:property => 'attachment', :prop_key => '1', :old_value => nil, :value => 'error281.txt')
190 assert_match 'error281.txt', show_detail(detail, true)
191 assert_match 'error281.txt', show_detail(detail, true)
191 end
192 end
192
193
193 should "show removed file" do
194 should "show removed file" do
194 detail = JournalDetail.new(:property => 'attachment', :prop_key => '1', :old_value => 'error281.txt', :value => nil)
195 detail = JournalDetail.new(:property => 'attachment', :prop_key => '1', :old_value => 'error281.txt', :value => nil)
195 assert_match 'error281.txt', show_detail(detail, true)
196 assert_match 'error281.txt', show_detail(detail, true)
196 end
197 end
197 end
198 end
198 end
199 end
General Comments 0
You need to be logged in to leave comments. Login now