##// END OF EJS Templates
Different icon for closed issues in search result (#992)....
Jean-Philippe Lang -
r2254:1ca69f2af1eb
parent child
Show More
@@ -1,280 +1,281
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 class Issue < ActiveRecord::Base
19 19 belongs_to :project
20 20 belongs_to :tracker
21 21 belongs_to :status, :class_name => 'IssueStatus', :foreign_key => 'status_id'
22 22 belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
23 23 belongs_to :assigned_to, :class_name => 'User', :foreign_key => 'assigned_to_id'
24 24 belongs_to :fixed_version, :class_name => 'Version', :foreign_key => 'fixed_version_id'
25 25 belongs_to :priority, :class_name => 'Enumeration', :foreign_key => 'priority_id'
26 26 belongs_to :category, :class_name => 'IssueCategory', :foreign_key => 'category_id'
27 27
28 28 has_many :journals, :as => :journalized, :dependent => :destroy
29 29 has_many :time_entries, :dependent => :delete_all
30 30 has_and_belongs_to_many :changesets, :order => "#{Changeset.table_name}.committed_on ASC, #{Changeset.table_name}.id ASC"
31 31
32 32 has_many :relations_from, :class_name => 'IssueRelation', :foreign_key => 'issue_from_id', :dependent => :delete_all
33 33 has_many :relations_to, :class_name => 'IssueRelation', :foreign_key => 'issue_to_id', :dependent => :delete_all
34 34
35 35 acts_as_attachable :after_remove => :attachment_removed
36 36 acts_as_customizable
37 37 acts_as_watchable
38 38 acts_as_searchable :columns => ['subject', "#{table_name}.description", "#{Journal.table_name}.notes"],
39 39 :include => [:project, :journals],
40 40 # sort by id so that limited eager loading doesn't break with postgresql
41 41 :order_column => "#{table_name}.id"
42 42 acts_as_event :title => Proc.new {|o| "#{o.tracker.name} ##{o.id}: #{o.subject}"},
43 :url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.id}}
43 :url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.id}},
44 :type => Proc.new {|o| 'issue' + (o.closed? ? ' closed' : '') }
44 45
45 46 acts_as_activity_provider :find_options => {:include => [:project, :author, :tracker]},
46 47 :author_key => :author_id
47 48
48 49 validates_presence_of :subject, :priority, :project, :tracker, :author, :status
49 50 validates_length_of :subject, :maximum => 255
50 51 validates_inclusion_of :done_ratio, :in => 0..100
51 52 validates_numericality_of :estimated_hours, :allow_nil => true
52 53
53 54 def after_initialize
54 55 if new_record?
55 56 # set default values for new records only
56 57 self.status ||= IssueStatus.default
57 58 self.priority ||= Enumeration.default('IPRI')
58 59 end
59 60 end
60 61
61 62 # Overrides Redmine::Acts::Customizable::InstanceMethods#available_custom_fields
62 63 def available_custom_fields
63 64 (project && tracker) ? project.all_issue_custom_fields.select {|c| tracker.custom_fields.include? c } : []
64 65 end
65 66
66 67 def copy_from(arg)
67 68 issue = arg.is_a?(Issue) ? arg : Issue.find(arg)
68 69 self.attributes = issue.attributes.dup
69 70 self.custom_values = issue.custom_values.collect {|v| v.clone}
70 71 self
71 72 end
72 73
73 74 # Move an issue to a new project and tracker
74 75 def move_to(new_project, new_tracker = nil)
75 76 transaction do
76 77 if new_project && project_id != new_project.id
77 78 # delete issue relations
78 79 unless Setting.cross_project_issue_relations?
79 80 self.relations_from.clear
80 81 self.relations_to.clear
81 82 end
82 83 # issue is moved to another project
83 84 # reassign to the category with same name if any
84 85 new_category = category.nil? ? nil : new_project.issue_categories.find_by_name(category.name)
85 86 self.category = new_category
86 87 self.fixed_version = nil
87 88 self.project = new_project
88 89 end
89 90 if new_tracker
90 91 self.tracker = new_tracker
91 92 end
92 93 if save
93 94 # Manually update project_id on related time entries
94 95 TimeEntry.update_all("project_id = #{new_project.id}", {:issue_id => id})
95 96 else
96 97 rollback_db_transaction
97 98 return false
98 99 end
99 100 end
100 101 return true
101 102 end
102 103
103 104 def priority_id=(pid)
104 105 self.priority = nil
105 106 write_attribute(:priority_id, pid)
106 107 end
107 108
108 109 def estimated_hours=(h)
109 110 write_attribute :estimated_hours, (h.is_a?(String) ? h.to_hours : h)
110 111 end
111 112
112 113 def validate
113 114 if self.due_date.nil? && @attributes['due_date'] && !@attributes['due_date'].empty?
114 115 errors.add :due_date, :activerecord_error_not_a_date
115 116 end
116 117
117 118 if self.due_date and self.start_date and self.due_date < self.start_date
118 119 errors.add :due_date, :activerecord_error_greater_than_start_date
119 120 end
120 121
121 122 if start_date && soonest_start && start_date < soonest_start
122 123 errors.add :start_date, :activerecord_error_invalid
123 124 end
124 125 end
125 126
126 127 def validate_on_create
127 128 errors.add :tracker_id, :activerecord_error_invalid unless project.trackers.include?(tracker)
128 129 end
129 130
130 131 def before_create
131 132 # default assignment based on category
132 133 if assigned_to.nil? && category && category.assigned_to
133 134 self.assigned_to = category.assigned_to
134 135 end
135 136 end
136 137
137 138 def before_save
138 139 if @current_journal
139 140 # attributes changes
140 141 (Issue.column_names - %w(id description)).each {|c|
141 142 @current_journal.details << JournalDetail.new(:property => 'attr',
142 143 :prop_key => c,
143 144 :old_value => @issue_before_change.send(c),
144 145 :value => send(c)) unless send(c)==@issue_before_change.send(c)
145 146 }
146 147 # custom fields changes
147 148 custom_values.each {|c|
148 149 next if (@custom_values_before_change[c.custom_field_id]==c.value ||
149 150 (@custom_values_before_change[c.custom_field_id].blank? && c.value.blank?))
150 151 @current_journal.details << JournalDetail.new(:property => 'cf',
151 152 :prop_key => c.custom_field_id,
152 153 :old_value => @custom_values_before_change[c.custom_field_id],
153 154 :value => c.value)
154 155 }
155 156 @current_journal.save
156 157 end
157 158 # Save the issue even if the journal is not saved (because empty)
158 159 true
159 160 end
160 161
161 162 def after_save
162 163 # Reload is needed in order to get the right status
163 164 reload
164 165
165 166 # Update start/due dates of following issues
166 167 relations_from.each(&:set_issue_to_dates)
167 168
168 169 # Close duplicates if the issue was closed
169 170 if @issue_before_change && !@issue_before_change.closed? && self.closed?
170 171 duplicates.each do |duplicate|
171 172 # Reload is need in case the duplicate was updated by a previous duplicate
172 173 duplicate.reload
173 174 # Don't re-close it if it's already closed
174 175 next if duplicate.closed?
175 176 # Same user and notes
176 177 duplicate.init_journal(@current_journal.user, @current_journal.notes)
177 178 duplicate.update_attribute :status, self.status
178 179 end
179 180 end
180 181 end
181 182
182 183 def init_journal(user, notes = "")
183 184 @current_journal ||= Journal.new(:journalized => self, :user => user, :notes => notes)
184 185 @issue_before_change = self.clone
185 186 @issue_before_change.status = self.status
186 187 @custom_values_before_change = {}
187 188 self.custom_values.each {|c| @custom_values_before_change.store c.custom_field_id, c.value }
188 189 # Make sure updated_on is updated when adding a note.
189 190 updated_on_will_change!
190 191 @current_journal
191 192 end
192 193
193 194 # Return true if the issue is closed, otherwise false
194 195 def closed?
195 196 self.status.is_closed?
196 197 end
197 198
198 199 # Returns true if the issue is overdue
199 200 def overdue?
200 201 !due_date.nil? && (due_date < Date.today)
201 202 end
202 203
203 204 # Users the issue can be assigned to
204 205 def assignable_users
205 206 project.assignable_users
206 207 end
207 208
208 209 # Returns an array of status that user is able to apply
209 210 def new_statuses_allowed_to(user)
210 211 statuses = status.find_new_statuses_allowed_to(user.role_for_project(project), tracker)
211 212 statuses << status unless statuses.empty?
212 213 statuses.uniq.sort
213 214 end
214 215
215 216 # Returns the mail adresses of users that should be notified for the issue
216 217 def recipients
217 218 recipients = project.recipients
218 219 # Author and assignee are always notified unless they have been locked
219 220 recipients << author.mail if author && author.active?
220 221 recipients << assigned_to.mail if assigned_to && assigned_to.active?
221 222 recipients.compact.uniq
222 223 end
223 224
224 225 def spent_hours
225 226 @spent_hours ||= time_entries.sum(:hours) || 0
226 227 end
227 228
228 229 def relations
229 230 (relations_from + relations_to).sort
230 231 end
231 232
232 233 def all_dependent_issues
233 234 dependencies = []
234 235 relations_from.each do |relation|
235 236 dependencies << relation.issue_to
236 237 dependencies += relation.issue_to.all_dependent_issues
237 238 end
238 239 dependencies
239 240 end
240 241
241 242 # Returns an array of issues that duplicate this one
242 243 def duplicates
243 244 relations_to.select {|r| r.relation_type == IssueRelation::TYPE_DUPLICATES}.collect {|r| r.issue_from}
244 245 end
245 246
246 247 # Returns the due date or the target due date if any
247 248 # Used on gantt chart
248 249 def due_before
249 250 due_date || (fixed_version ? fixed_version.effective_date : nil)
250 251 end
251 252
252 253 def duration
253 254 (start_date && due_date) ? due_date - start_date : 0
254 255 end
255 256
256 257 def soonest_start
257 258 @soonest_start ||= relations_to.collect{|relation| relation.successor_soonest_start}.compact.min
258 259 end
259 260
260 261 def self.visible_by(usr)
261 262 with_scope(:find => { :conditions => Project.visible_by(usr) }) do
262 263 yield
263 264 end
264 265 end
265 266
266 267 def to_s
267 268 "#{tracker} ##{id}: #{subject}"
268 269 end
269 270
270 271 private
271 272
272 273 # Callback on attachment deletion
273 274 def attachment_removed(obj)
274 275 journal = init_journal(User.current)
275 276 journal.details << JournalDetail.new(:property => 'attachment',
276 277 :prop_key => obj.id,
277 278 :old_value => obj.filename)
278 279 journal.save
279 280 end
280 281 end
@@ -1,682 +1,685
1 1 body { font-family: Verdana, sans-serif; font-size: 12px; color:#484848; margin: 0; padding: 0; min-width: 900px; }
2 2
3 3 h1, h2, h3, h4 { font-family: "Trebuchet MS", Verdana, sans-serif;}
4 4 h1 {margin:0; padding:0; font-size: 24px;}
5 5 h2, .wiki h1 {font-size: 20px;padding: 2px 10px 1px 0px;margin: 0 0 10px 0; border-bottom: 1px solid #bbbbbb; color: #444;}
6 6 h3, .wiki h2 {font-size: 16px;padding: 2px 10px 1px 0px;margin: 0 0 10px 0; border-bottom: 1px solid #bbbbbb; color: #444;}
7 7 h4, .wiki h3 {font-size: 13px;padding: 2px 10px 1px 0px;margin-bottom: 5px; border-bottom: 1px dotted #bbbbbb; color: #444;}
8 8
9 9 /***** Layout *****/
10 10 #wrapper {background: white;}
11 11
12 12 #top-menu {background: #2C4056; color: #fff; height:1.8em; font-size: 0.8em; padding: 2px 2px 0px 6px;}
13 13 #top-menu ul {margin: 0; padding: 0;}
14 14 #top-menu li {
15 15 float:left;
16 16 list-style-type:none;
17 17 margin: 0px 0px 0px 0px;
18 18 padding: 0px 0px 0px 0px;
19 19 white-space:nowrap;
20 20 }
21 21 #top-menu a {color: #fff; padding-right: 8px; font-weight: bold;}
22 22 #top-menu #loggedas { float: right; margin-right: 0.5em; color: #fff; }
23 23
24 24 #account {float:right;}
25 25
26 26 #header {height:5.3em;margin:0;background-color:#507AAA;color:#f8f8f8; padding: 4px 8px 0px 6px; position:relative;}
27 27 #header a {color:#f8f8f8;}
28 28 #quick-search {float:right;}
29 29
30 30 #main-menu {position: absolute; bottom: 0px; left:6px; margin-right: -500px;}
31 31 #main-menu ul {margin: 0; padding: 0;}
32 32 #main-menu li {
33 33 float:left;
34 34 list-style-type:none;
35 35 margin: 0px 2px 0px 0px;
36 36 padding: 0px 0px 0px 0px;
37 37 white-space:nowrap;
38 38 }
39 39 #main-menu li a {
40 40 display: block;
41 41 color: #fff;
42 42 text-decoration: none;
43 43 font-weight: bold;
44 44 margin: 0;
45 45 padding: 4px 10px 4px 10px;
46 46 }
47 47 #main-menu li a:hover {background:#759FCF; color:#fff;}
48 48 #main-menu li a.selected, #main-menu li a.selected:hover {background:#fff; color:#555;}
49 49
50 50 #main {background-color:#EEEEEE;}
51 51
52 52 #sidebar{ float: right; width: 17%; position: relative; z-index: 9; min-height: 600px; padding: 0; margin: 0;}
53 53 * html #sidebar{ width: 17%; }
54 54 #sidebar h3{ font-size: 14px; margin-top:14px; color: #666; }
55 55 #sidebar hr{ width: 100%; margin: 0 auto; height: 1px; background: #ccc; border: 0; }
56 56 * html #sidebar hr{ width: 95%; position: relative; left: -6px; color: #ccc; }
57 57
58 58 #content { width: 80%; background-color: #fff; margin: 0px; border-right: 1px solid #ddd; padding: 6px 10px 10px 10px; z-index: 10; }
59 59 * html #content{ width: 80%; padding-left: 0; margin-top: 0px; padding: 6px 10px 10px 10px;}
60 60 html>body #content { min-height: 600px; }
61 61 * html body #content { height: 600px; } /* IE */
62 62
63 63 #main.nosidebar #sidebar{ display: none; }
64 64 #main.nosidebar #content{ width: auto; border-right: 0; }
65 65
66 66 #footer {clear: both; border-top: 1px solid #bbb; font-size: 0.9em; color: #aaa; padding: 5px; text-align:center; background:#fff;}
67 67
68 68 #login-form table {margin-top:5em; padding:1em; margin-left: auto; margin-right: auto; border: 2px solid #FDBF3B; background-color:#FFEBC1; }
69 69 #login-form table td {padding: 6px;}
70 70 #login-form label {font-weight: bold;}
71 71
72 72 .clear:after{ content: "."; display: block; height: 0; clear: both; visibility: hidden; }
73 73
74 74 /***** Links *****/
75 75 a, a:link, a:visited{ color: #2A5685; text-decoration: none; }
76 76 a:hover, a:active{ color: #c61a1a; text-decoration: underline;}
77 77 a img{ border: 0; }
78 78
79 79 a.issue.closed { text-decoration: line-through; }
80 80
81 81 /***** Tables *****/
82 82 table.list { border: 1px solid #e4e4e4; border-collapse: collapse; width: 100%; margin-bottom: 4px; }
83 83 table.list th { background-color:#EEEEEE; padding: 4px; white-space:nowrap; }
84 84 table.list td { vertical-align: top; }
85 85 table.list td.id { width: 2%; text-align: center;}
86 86 table.list td.checkbox { width: 15px; padding: 0px;}
87 87
88 88 tr.issue { text-align: center; white-space: nowrap; }
89 89 tr.issue td.subject, tr.issue td.category, td.assigned_to { white-space: normal; }
90 90 tr.issue td.subject { text-align: left; }
91 91 tr.issue td.done_ratio table.progress { margin-left:auto; margin-right: auto;}
92 92
93 93 tr.entry { border: 1px solid #f8f8f8; }
94 94 tr.entry td { white-space: nowrap; }
95 95 tr.entry td.filename { width: 30%; }
96 96 tr.entry td.size { text-align: right; font-size: 90%; }
97 97 tr.entry td.revision, tr.entry td.author { text-align: center; }
98 98 tr.entry td.age { text-align: right; }
99 99
100 100 tr.entry span.expander {background-image: url(../images/bullet_toggle_plus.png); padding-left: 8px; margin-left: 0; cursor: pointer;}
101 101 tr.entry.open span.expander {background-image: url(../images/bullet_toggle_minus.png);}
102 102 tr.entry.file td.filename a { margin-left: 16px; }
103 103
104 104 tr.changeset td.author { text-align: center; width: 15%; }
105 105 tr.changeset td.committed_on { text-align: center; width: 15%; }
106 106
107 107 tr.message { height: 2.6em; }
108 108 tr.message td.last_message { font-size: 80%; }
109 109 tr.message.locked td.subject a { background-image: url(../images/locked.png); }
110 110 tr.message.sticky td.subject a { background-image: url(../images/sticky.png); font-weight: bold; }
111 111
112 112 tr.user td { width:13%; }
113 113 tr.user td.email { width:18%; }
114 114 tr.user td { white-space: nowrap; }
115 115 tr.user.locked, tr.user.registered { color: #aaa; }
116 116 tr.user.locked a, tr.user.registered a { color: #aaa; }
117 117
118 118 tr.time-entry { text-align: center; white-space: nowrap; }
119 119 tr.time-entry td.subject, tr.time-entry td.comments { text-align: left; white-space: normal; }
120 120 td.hours { text-align: right; font-weight: bold; padding-right: 0.5em; }
121 121 td.hours .hours-dec { font-size: 0.9em; }
122 122
123 123 table.plugins td { vertical-align: middle; }
124 124 table.plugins td.configure { text-align: right; padding-right: 1em; }
125 125 table.plugins span.name { font-weight: bold; display: block; margin-bottom: 6px; }
126 126 table.plugins span.description { display: block; font-size: 0.9em; }
127 127 table.plugins span.url { display: block; font-size: 0.9em; }
128 128
129 129 table.list tbody tr:hover { background-color:#ffffdd; }
130 130 table td {padding:2px;}
131 131 table p {margin:0;}
132 132 .odd {background-color:#f6f7f8;}
133 133 .even {background-color: #fff;}
134 134
135 135 .highlight { background-color: #FCFD8D;}
136 136 .highlight.token-1 { background-color: #faa;}
137 137 .highlight.token-2 { background-color: #afa;}
138 138 .highlight.token-3 { background-color: #aaf;}
139 139
140 140 .box{
141 141 padding:6px;
142 142 margin-bottom: 10px;
143 143 background-color:#f6f6f6;
144 144 color:#505050;
145 145 line-height:1.5em;
146 146 border: 1px solid #e4e4e4;
147 147 }
148 148
149 149 div.square {
150 150 border: 1px solid #999;
151 151 float: left;
152 152 margin: .3em .4em 0 .4em;
153 153 overflow: hidden;
154 154 width: .6em; height: .6em;
155 155 }
156 156 .contextual {float:right; white-space: nowrap; line-height:1.4em;margin-top:5px; padding-left: 10px; font-size:0.9em;}
157 157 .contextual input {font-size:0.9em;}
158 158
159 159 .splitcontentleft{float:left; width:49%;}
160 160 .splitcontentright{float:right; width:49%;}
161 161 form {display: inline;}
162 162 input, select {vertical-align: middle; margin-top: 1px; margin-bottom: 1px;}
163 163 fieldset {border: 1px solid #e4e4e4; margin:0;}
164 164 legend {color: #484848;}
165 165 hr { width: 100%; height: 1px; background: #ccc; border: 0;}
166 166 blockquote { font-style: italic; border-left: 3px solid #e0e0e0; padding-left: 0.6em; margin-left: 2.4em;}
167 167 blockquote blockquote { margin-left: 0;}
168 168 textarea.wiki-edit { width: 99%; }
169 169 li p {margin-top: 0;}
170 170 div.issue {background:#ffffdd; padding:6px; margin-bottom:6px;border: 1px solid #d7d7d7;}
171 171 p.breadcrumb { font-size: 0.9em; margin: 4px 0 4px 0;}
172 172 p.subtitle { font-size: 0.9em; margin: -6px 0 12px 0; font-style: italic; }
173 173 p.footnote { font-size: 0.9em; margin-top: 0px; margin-bottom: 0px; }
174 174
175 175 fieldset#filters, fieldset#date-range { padding: 0.7em; margin-bottom: 8px; }
176 176 fieldset#filters p { margin: 1.2em 0 0.8em 2px; }
177 177 fieldset#filters table { border-collapse: collapse; }
178 178 fieldset#filters table td { padding: 0; vertical-align: middle; }
179 179 fieldset#filters tr.filter { height: 2em; }
180 180 fieldset#filters td.add-filter { text-align: right; vertical-align: top; }
181 181 .buttons { font-size: 0.9em; }
182 182
183 183 div#issue-changesets {float:right; width:45%; margin-left: 1em; margin-bottom: 1em; background: #fff; padding-left: 1em; font-size: 90%;}
184 184 div#issue-changesets .changeset { padding: 4px;}
185 185 div#issue-changesets .changeset { border-bottom: 1px solid #ddd; }
186 186 div#issue-changesets p { margin-top: 0; margin-bottom: 1em;}
187 187
188 188 div#activity dl, #search-results { margin-left: 2em; }
189 189 div#activity dd, #search-results dd { margin-bottom: 1em; padding-left: 18px; font-size: 0.9em; }
190 190 div#activity dt, #search-results dt { margin-bottom: 0px; padding-left: 20px; line-height: 18px; background-position: 0 50%; background-repeat: no-repeat; }
191 191 div#activity dt.me .time { border-bottom: 1px solid #999; }
192 192 div#activity dt .time { color: #777; font-size: 80%; }
193 193 div#activity dd .description, #search-results dd .description { font-style: italic; }
194 194 div#activity span.project:after, #search-results span.project:after { content: " -"; }
195 195 div#activity dd span.description, #search-results dd span.description { display:block; }
196 196
197 197 #search-results dd { margin-bottom: 1em; padding-left: 20px; margin-left:0px; }
198
198 199 div#search-results-counts {float:right;}
199 200 div#search-results-counts ul { margin-top: 0.5em; }
200 201 div#search-results-counts li { list-style-type:none; float: left; margin-left: 1em; }
201 202
202 203 dt.issue { background-image: url(../images/ticket.png); }
203 204 dt.issue-edit { background-image: url(../images/ticket_edit.png); }
204 205 dt.issue-closed { background-image: url(../images/ticket_checked.png); }
205 206 dt.issue-note { background-image: url(../images/ticket_note.png); }
206 207 dt.changeset { background-image: url(../images/changeset.png); }
207 208 dt.news { background-image: url(../images/news.png); }
208 209 dt.message { background-image: url(../images/message.png); }
209 210 dt.reply { background-image: url(../images/comments.png); }
210 211 dt.wiki-page { background-image: url(../images/wiki_edit.png); }
211 212 dt.attachment { background-image: url(../images/attachment.png); }
212 213 dt.document { background-image: url(../images/document.png); }
213 214 dt.project { background-image: url(../images/projects.png); }
214 215
216 #search-results dt.issue.closed { background-image: url(../images/ticket_checked.png); }
217
215 218 div#roadmap fieldset.related-issues { margin-bottom: 1em; }
216 219 div#roadmap fieldset.related-issues ul { margin-top: 0.3em; margin-bottom: 0.3em; }
217 220 div#roadmap .wiki h1:first-child { display: none; }
218 221 div#roadmap .wiki h1 { font-size: 120%; }
219 222 div#roadmap .wiki h2 { font-size: 110%; }
220 223
221 224 div#version-summary { float:right; width:380px; margin-left: 16px; margin-bottom: 16px; background-color: #fff; }
222 225 div#version-summary fieldset { margin-bottom: 1em; }
223 226 div#version-summary .total-hours { text-align: right; }
224 227
225 228 table#time-report td.hours, table#time-report th.period, table#time-report th.total { text-align: right; padding-right: 0.5em; }
226 229 table#time-report tbody tr { font-style: italic; color: #777; }
227 230 table#time-report tbody tr.last-level { font-style: normal; color: #555; }
228 231 table#time-report tbody tr.total { font-style: normal; font-weight: bold; color: #555; background-color:#EEEEEE; }
229 232 table#time-report .hours-dec { font-size: 0.9em; }
230 233
231 234 ul.properties {padding:0; font-size: 0.9em; color: #777;}
232 235 ul.properties li {list-style-type:none;}
233 236 ul.properties li span {font-style:italic;}
234 237
235 238 .total-hours { font-size: 110%; font-weight: bold; }
236 239 .total-hours span.hours-int { font-size: 120%; }
237 240
238 241 .autoscroll {overflow-x: auto; padding:1px; margin-bottom: 1.2em;}
239 242 #user_firstname, #user_lastname, #user_mail, #my_account_form select { width: 90%; }
240 243
241 244 .pagination {font-size: 90%}
242 245 p.pagination {margin-top:8px;}
243 246
244 247 /***** Tabular forms ******/
245 248 .tabular p{
246 249 margin: 0;
247 250 padding: 5px 0 8px 0;
248 251 padding-left: 180px; /*width of left column containing the label elements*/
249 252 height: 1%;
250 253 clear:left;
251 254 }
252 255
253 256 html>body .tabular p {overflow:hidden;}
254 257
255 258 .tabular label{
256 259 font-weight: bold;
257 260 float: left;
258 261 text-align: right;
259 262 margin-left: -180px; /*width of left column*/
260 263 width: 175px; /*width of labels. Should be smaller than left column to create some right
261 264 margin*/
262 265 }
263 266
264 267 .tabular label.floating{
265 268 font-weight: normal;
266 269 margin-left: 0px;
267 270 text-align: left;
268 271 width: 270px;
269 272 }
270 273
271 274 input#time_entry_comments { width: 90%;}
272 275
273 276 #preview fieldset {margin-top: 1em; background: url(../images/draft.png)}
274 277
275 278 .tabular.settings p{ padding-left: 300px; }
276 279 .tabular.settings label{ margin-left: -300px; width: 295px; }
277 280
278 281 .required {color: #bb0000;}
279 282 .summary {font-style: italic;}
280 283
281 284 #attachments_fields input[type=text] {margin-left: 8px; }
282 285
283 286 div.attachments { margin-top: 12px; }
284 287 div.attachments p { margin:4px 0 2px 0; }
285 288 div.attachments img { vertical-align: middle; }
286 289 div.attachments span.author { font-size: 0.9em; color: #888; }
287 290
288 291 p.other-formats { text-align: right; font-size:0.9em; color: #666; }
289 292 .other-formats span + span:before { content: "| "; }
290 293
291 294 a.feed { background: url(../images/feed.png) no-repeat 1px 50%; padding: 2px 0px 3px 16px; }
292 295
293 296 /***** Flash & error messages ****/
294 297 #errorExplanation, div.flash, .nodata, .warning {
295 298 padding: 4px 4px 4px 30px;
296 299 margin-bottom: 12px;
297 300 font-size: 1.1em;
298 301 border: 2px solid;
299 302 }
300 303
301 304 div.flash {margin-top: 8px;}
302 305
303 306 div.flash.error, #errorExplanation {
304 307 background: url(../images/false.png) 8px 5px no-repeat;
305 308 background-color: #ffe3e3;
306 309 border-color: #dd0000;
307 310 color: #550000;
308 311 }
309 312
310 313 div.flash.notice {
311 314 background: url(../images/true.png) 8px 5px no-repeat;
312 315 background-color: #dfffdf;
313 316 border-color: #9fcf9f;
314 317 color: #005f00;
315 318 }
316 319
317 320 div.flash.warning {
318 321 background: url(../images/warning.png) 8px 5px no-repeat;
319 322 background-color: #FFEBC1;
320 323 border-color: #FDBF3B;
321 324 color: #A6750C;
322 325 text-align: left;
323 326 }
324 327
325 328 .nodata, .warning {
326 329 text-align: center;
327 330 background-color: #FFEBC1;
328 331 border-color: #FDBF3B;
329 332 color: #A6750C;
330 333 }
331 334
332 335 #errorExplanation ul { font-size: 0.9em;}
333 336
334 337 /***** Ajax indicator ******/
335 338 #ajax-indicator {
336 339 position: absolute; /* fixed not supported by IE */
337 340 background-color:#eee;
338 341 border: 1px solid #bbb;
339 342 top:35%;
340 343 left:40%;
341 344 width:20%;
342 345 font-weight:bold;
343 346 text-align:center;
344 347 padding:0.6em;
345 348 z-index:100;
346 349 filter:alpha(opacity=50);
347 350 opacity: 0.5;
348 351 }
349 352
350 353 html>body #ajax-indicator { position: fixed; }
351 354
352 355 #ajax-indicator span {
353 356 background-position: 0% 40%;
354 357 background-repeat: no-repeat;
355 358 background-image: url(../images/loading.gif);
356 359 padding-left: 26px;
357 360 vertical-align: bottom;
358 361 }
359 362
360 363 /***** Calendar *****/
361 364 table.cal {border-collapse: collapse; width: 100%; margin: 0px 0 6px 0;border: 1px solid #d7d7d7;}
362 365 table.cal thead th {width: 14%;}
363 366 table.cal tbody tr {height: 100px;}
364 367 table.cal th { background-color:#EEEEEE; padding: 4px; }
365 368 table.cal td {border: 1px solid #d7d7d7; vertical-align: top; font-size: 0.9em;}
366 369 table.cal td p.day-num {font-size: 1.1em; text-align:right;}
367 370 table.cal td.odd p.day-num {color: #bbb;}
368 371 table.cal td.today {background:#ffffdd;}
369 372 table.cal td.today p.day-num {font-weight: bold;}
370 373
371 374 /***** Tooltips ******/
372 375 .tooltip{position:relative;z-index:24;}
373 376 .tooltip:hover{z-index:25;color:#000;}
374 377 .tooltip span.tip{display: none; text-align:left;}
375 378
376 379 div.tooltip:hover span.tip{
377 380 display:block;
378 381 position:absolute;
379 382 top:12px; left:24px; width:270px;
380 383 border:1px solid #555;
381 384 background-color:#fff;
382 385 padding: 4px;
383 386 font-size: 0.8em;
384 387 color:#505050;
385 388 }
386 389
387 390 /***** Progress bar *****/
388 391 table.progress {
389 392 border: 1px solid #D7D7D7;
390 393 border-collapse: collapse;
391 394 border-spacing: 0pt;
392 395 empty-cells: show;
393 396 text-align: center;
394 397 float:left;
395 398 margin: 1px 6px 1px 0px;
396 399 }
397 400
398 401 table.progress td { height: 0.9em; }
399 402 table.progress td.closed { background: #BAE0BA none repeat scroll 0%; }
400 403 table.progress td.done { background: #DEF0DE none repeat scroll 0%; }
401 404 table.progress td.open { background: #FFF none repeat scroll 0%; }
402 405 p.pourcent {font-size: 80%;}
403 406 p.progress-info {clear: left; font-style: italic; font-size: 80%;}
404 407
405 408 /***** Tabs *****/
406 409 #content .tabs {height: 2.6em; border-bottom: 1px solid #bbbbbb; margin-bottom:1.2em; position:relative;}
407 410 #content .tabs ul {margin:0; position:absolute; bottom:-2px; padding-left:1em;}
408 411 #content .tabs>ul { bottom:-1px; } /* others */
409 412 #content .tabs ul li {
410 413 float:left;
411 414 list-style-type:none;
412 415 white-space:nowrap;
413 416 margin-right:8px;
414 417 background:#fff;
415 418 }
416 419 #content .tabs ul li a{
417 420 display:block;
418 421 font-size: 0.9em;
419 422 text-decoration:none;
420 423 line-height:1.3em;
421 424 padding:4px 6px 4px 6px;
422 425 border: 1px solid #ccc;
423 426 border-bottom: 1px solid #bbbbbb;
424 427 background-color: #eeeeee;
425 428 color:#777;
426 429 font-weight:bold;
427 430 }
428 431
429 432 #content .tabs ul li a:hover {
430 433 background-color: #ffffdd;
431 434 text-decoration:none;
432 435 }
433 436
434 437 #content .tabs ul li a.selected {
435 438 background-color: #fff;
436 439 border: 1px solid #bbbbbb;
437 440 border-bottom: 1px solid #fff;
438 441 }
439 442
440 443 #content .tabs ul li a.selected:hover {
441 444 background-color: #fff;
442 445 }
443 446
444 447 /***** Diff *****/
445 448 .diff_out { background: #fcc; }
446 449 .diff_in { background: #cfc; }
447 450
448 451 /***** Wiki *****/
449 452 div.wiki table {
450 453 border: 1px solid #505050;
451 454 border-collapse: collapse;
452 455 margin-bottom: 1em;
453 456 }
454 457
455 458 div.wiki table, div.wiki td, div.wiki th {
456 459 border: 1px solid #bbb;
457 460 padding: 4px;
458 461 }
459 462
460 463 div.wiki .external {
461 464 background-position: 0% 60%;
462 465 background-repeat: no-repeat;
463 466 padding-left: 12px;
464 467 background-image: url(../images/external.png);
465 468 }
466 469
467 470 div.wiki a.new {
468 471 color: #b73535;
469 472 }
470 473
471 474 div.wiki pre {
472 475 margin: 1em 1em 1em 1.6em;
473 476 padding: 2px;
474 477 background-color: #fafafa;
475 478 border: 1px solid #dadada;
476 479 width:95%;
477 480 overflow-x: auto;
478 481 }
479 482
480 483 div.wiki ul.toc {
481 484 background-color: #ffffdd;
482 485 border: 1px solid #e4e4e4;
483 486 padding: 4px;
484 487 line-height: 1.2em;
485 488 margin-bottom: 12px;
486 489 margin-right: 12px;
487 490 margin-left: 0;
488 491 display: table
489 492 }
490 493 * html div.wiki ul.toc { width: 50%; } /* IE6 doesn't autosize div */
491 494
492 495 div.wiki ul.toc.right { float: right; margin-left: 12px; margin-right: 0; width: auto; }
493 496 div.wiki ul.toc.left { float: left; margin-right: 12px; margin-left: 0; width: auto; }
494 497 div.wiki ul.toc li { list-style-type:none;}
495 498 div.wiki ul.toc li.heading2 { margin-left: 6px; }
496 499 div.wiki ul.toc li.heading3 { margin-left: 12px; font-size: 0.8em; }
497 500
498 501 div.wiki ul.toc a {
499 502 font-size: 0.9em;
500 503 font-weight: normal;
501 504 text-decoration: none;
502 505 color: #606060;
503 506 }
504 507 div.wiki ul.toc a:hover { color: #c61a1a; text-decoration: underline;}
505 508
506 509 a.wiki-anchor { display: none; margin-left: 6px; text-decoration: none; }
507 510 a.wiki-anchor:hover { color: #aaa !important; text-decoration: none; }
508 511 h1:hover a.wiki-anchor, h2:hover a.wiki-anchor, h3:hover a.wiki-anchor { display: inline; color: #ddd; }
509 512
510 513 /***** My page layout *****/
511 514 .block-receiver {
512 515 border:1px dashed #c0c0c0;
513 516 margin-bottom: 20px;
514 517 padding: 15px 0 15px 0;
515 518 }
516 519
517 520 .mypage-box {
518 521 margin:0 0 20px 0;
519 522 color:#505050;
520 523 line-height:1.5em;
521 524 }
522 525
523 526 .handle {
524 527 cursor: move;
525 528 }
526 529
527 530 a.close-icon {
528 531 display:block;
529 532 margin-top:3px;
530 533 overflow:hidden;
531 534 width:12px;
532 535 height:12px;
533 536 background-repeat: no-repeat;
534 537 cursor:pointer;
535 538 background-image:url('../images/close.png');
536 539 }
537 540
538 541 a.close-icon:hover {
539 542 background-image:url('../images/close_hl.png');
540 543 }
541 544
542 545 /***** Gantt chart *****/
543 546 .gantt_hdr {
544 547 position:absolute;
545 548 top:0;
546 549 height:16px;
547 550 border-top: 1px solid #c0c0c0;
548 551 border-bottom: 1px solid #c0c0c0;
549 552 border-right: 1px solid #c0c0c0;
550 553 text-align: center;
551 554 overflow: hidden;
552 555 }
553 556
554 557 .task {
555 558 position: absolute;
556 559 height:8px;
557 560 font-size:0.8em;
558 561 color:#888;
559 562 padding:0;
560 563 margin:0;
561 564 line-height:0.8em;
562 565 }
563 566
564 567 .task_late { background:#f66 url(../images/task_late.png); border: 1px solid #f66; }
565 568 .task_done { background:#66f url(../images/task_done.png); border: 1px solid #66f; }
566 569 .task_todo { background:#aaa url(../images/task_todo.png); border: 1px solid #aaa; }
567 570 .milestone { background-image:url(../images/milestone.png); background-repeat: no-repeat; border: 0; }
568 571
569 572 /***** Icons *****/
570 573 .icon {
571 574 background-position: 0% 40%;
572 575 background-repeat: no-repeat;
573 576 padding-left: 20px;
574 577 padding-top: 2px;
575 578 padding-bottom: 3px;
576 579 }
577 580
578 581 .icon22 {
579 582 background-position: 0% 40%;
580 583 background-repeat: no-repeat;
581 584 padding-left: 26px;
582 585 line-height: 22px;
583 586 vertical-align: middle;
584 587 }
585 588
586 589 .icon-add { background-image: url(../images/add.png); }
587 590 .icon-edit { background-image: url(../images/edit.png); }
588 591 .icon-copy { background-image: url(../images/copy.png); }
589 592 .icon-del { background-image: url(../images/delete.png); }
590 593 .icon-move { background-image: url(../images/move.png); }
591 594 .icon-save { background-image: url(../images/save.png); }
592 595 .icon-cancel { background-image: url(../images/cancel.png); }
593 596 .icon-file { background-image: url(../images/file.png); }
594 597 .icon-folder { background-image: url(../images/folder.png); }
595 598 .open .icon-folder { background-image: url(../images/folder_open.png); }
596 599 .icon-package { background-image: url(../images/package.png); }
597 600 .icon-home { background-image: url(../images/home.png); }
598 601 .icon-user { background-image: url(../images/user.png); }
599 602 .icon-mypage { background-image: url(../images/user_page.png); }
600 603 .icon-admin { background-image: url(../images/admin.png); }
601 604 .icon-projects { background-image: url(../images/projects.png); }
602 605 .icon-help { background-image: url(../images/help.png); }
603 606 .icon-attachment { background-image: url(../images/attachment.png); }
604 607 .icon-index { background-image: url(../images/index.png); }
605 608 .icon-history { background-image: url(../images/history.png); }
606 609 .icon-time { background-image: url(../images/time.png); }
607 610 .icon-stats { background-image: url(../images/stats.png); }
608 611 .icon-warning { background-image: url(../images/warning.png); }
609 612 .icon-fav { background-image: url(../images/fav.png); }
610 613 .icon-fav-off { background-image: url(../images/fav_off.png); }
611 614 .icon-reload { background-image: url(../images/reload.png); }
612 615 .icon-lock { background-image: url(../images/locked.png); }
613 616 .icon-unlock { background-image: url(../images/unlock.png); }
614 617 .icon-checked { background-image: url(../images/true.png); }
615 618 .icon-details { background-image: url(../images/zoom_in.png); }
616 619 .icon-report { background-image: url(../images/report.png); }
617 620 .icon-comment { background-image: url(../images/comment.png); }
618 621
619 622 .icon22-projects { background-image: url(../images/22x22/projects.png); }
620 623 .icon22-users { background-image: url(../images/22x22/users.png); }
621 624 .icon22-tracker { background-image: url(../images/22x22/tracker.png); }
622 625 .icon22-role { background-image: url(../images/22x22/role.png); }
623 626 .icon22-workflow { background-image: url(../images/22x22/workflow.png); }
624 627 .icon22-options { background-image: url(../images/22x22/options.png); }
625 628 .icon22-notifications { background-image: url(../images/22x22/notifications.png); }
626 629 .icon22-authent { background-image: url(../images/22x22/authent.png); }
627 630 .icon22-info { background-image: url(../images/22x22/info.png); }
628 631 .icon22-comment { background-image: url(../images/22x22/comment.png); }
629 632 .icon22-package { background-image: url(../images/22x22/package.png); }
630 633 .icon22-settings { background-image: url(../images/22x22/settings.png); }
631 634 .icon22-plugin { background-image: url(../images/22x22/plugin.png); }
632 635
633 636 img.gravatar {
634 637 padding: 2px;
635 638 border: solid 1px #d5d5d5;
636 639 background: #fff;
637 640 }
638 641
639 642 div.issue img.gravatar {
640 643 float: right;
641 644 margin: 0 0 0 1em;
642 645 padding: 5px;
643 646 }
644 647
645 648 div.issue table img.gravatar {
646 649 height: 14px;
647 650 width: 14px;
648 651 padding: 2px;
649 652 float: left;
650 653 margin: 0 0.5em 0 0;
651 654 }
652 655
653 656 #history img.gravatar {
654 657 padding: 3px;
655 658 margin: 0 1.5em 1em 0;
656 659 float: left;
657 660 }
658 661
659 662 td.username img.gravatar {
660 663 float: left;
661 664 margin: 0 1em 0 0;
662 665 }
663 666
664 667 #activity dt img.gravatar {
665 668 float: left;
666 669 margin: 0 1em 1em 0;
667 670 }
668 671
669 672 #activity dt,
670 673 .journal {
671 674 clear: left;
672 675 }
673 676
674 677 h2 img { vertical-align:middle; }
675 678
676 679
677 680 /***** Media print specific styles *****/
678 681 @media print {
679 682 #top-menu, #header, #main-menu, #sidebar, #footer, .contextual, .other-formats { display:none; }
680 683 #main { background: #fff; }
681 684 #content { width: 99%; margin: 0; padding: 0; border: 0; background: #fff; overflow: visible !important;}
682 685 }
@@ -1,111 +1,128
1 1 ---
2 2 issues_001:
3 3 created_on: <%= 3.days.ago.to_date.to_s(:db) %>
4 4 project_id: 1
5 5 updated_on: <%= 1.day.ago.to_date.to_s(:db) %>
6 6 priority_id: 4
7 7 subject: Can't print recipes
8 8 id: 1
9 9 fixed_version_id:
10 10 category_id: 1
11 11 description: Unable to print recipes
12 12 tracker_id: 1
13 13 assigned_to_id:
14 14 author_id: 2
15 15 status_id: 1
16 16 start_date: <%= 1.day.ago.to_date.to_s(:db) %>
17 17 due_date: <%= 10.day.from_now.to_date.to_s(:db) %>
18 18 issues_002:
19 19 created_on: 2006-07-19 21:04:21 +02:00
20 20 project_id: 1
21 21 updated_on: 2006-07-19 21:09:50 +02:00
22 22 priority_id: 5
23 23 subject: Add ingredients categories
24 24 id: 2
25 25 fixed_version_id: 2
26 26 category_id:
27 27 description: Ingredients of the recipe should be classified by categories
28 28 tracker_id: 2
29 29 assigned_to_id: 3
30 30 author_id: 2
31 31 status_id: 2
32 32 start_date: <%= 2.day.ago.to_date.to_s(:db) %>
33 33 due_date:
34 34 issues_003:
35 35 created_on: 2006-07-19 21:07:27 +02:00
36 36 project_id: 1
37 37 updated_on: 2006-07-19 21:07:27 +02:00
38 38 priority_id: 4
39 39 subject: Error 281 when updating a recipe
40 40 id: 3
41 41 fixed_version_id:
42 42 category_id:
43 43 description: Error 281 is encountered when saving a recipe
44 44 tracker_id: 1
45 45 assigned_to_id: 3
46 46 author_id: 2
47 47 status_id: 1
48 48 start_date: <%= 1.day.from_now.to_date.to_s(:db) %>
49 49 due_date: <%= 40.day.ago.to_date.to_s(:db) %>
50 50 issues_004:
51 51 created_on: <%= 5.days.ago.to_date.to_s(:db) %>
52 52 project_id: 2
53 53 updated_on: <%= 2.days.ago.to_date.to_s(:db) %>
54 54 priority_id: 4
55 55 subject: Issue on project 2
56 56 id: 4
57 57 fixed_version_id:
58 58 category_id:
59 59 description: Issue on project 2
60 60 tracker_id: 1
61 61 assigned_to_id:
62 62 author_id: 2
63 63 status_id: 1
64 64 issues_005:
65 65 created_on: <%= 5.days.ago.to_date.to_s(:db) %>
66 66 project_id: 3
67 67 updated_on: <%= 2.days.ago.to_date.to_s(:db) %>
68 68 priority_id: 4
69 69 subject: Subproject issue
70 70 id: 5
71 71 fixed_version_id:
72 72 category_id:
73 73 description: This is an issue on a cookbook subproject
74 74 tracker_id: 1
75 75 assigned_to_id:
76 76 author_id: 2
77 77 status_id: 1
78 78 issues_006:
79 79 created_on: <%= 1.minute.ago.to_date.to_s(:db) %>
80 80 project_id: 5
81 81 updated_on: <%= 1.minute.ago.to_date.to_s(:db) %>
82 82 priority_id: 4
83 83 subject: Issue of a private subproject
84 84 id: 6
85 85 fixed_version_id:
86 86 category_id:
87 87 description: This is an issue of a private subproject of cookbook
88 88 tracker_id: 1
89 89 assigned_to_id:
90 90 author_id: 2
91 91 status_id: 1
92 92 start_date: <%= Date.today.to_s(:db) %>
93 93 due_date: <%= 1.days.from_now.to_date.to_s(:db) %>
94 94 issues_007:
95 95 created_on: <%= 10.days.ago.to_date.to_s(:db) %>
96 96 project_id: 1
97 97 updated_on: <%= 10.days.ago.to_date.to_s(:db) %>
98 98 priority_id: 3
99 99 subject: Issue due today
100 100 id: 7
101 101 fixed_version_id:
102 102 category_id:
103 103 description: This is an issue that is due today
104 104 tracker_id: 1
105 105 assigned_to_id:
106 106 author_id: 2
107 107 status_id: 1
108 108 start_date: <%= 10.days.ago.to_s(:db) %>
109 109 due_date: <%= Date.today.to_s(:db) %>
110 110 lock_version: 0
111 issues_008:
112 created_on: <%= 10.days.ago.to_date.to_s(:db) %>
113 project_id: 1
114 updated_on: <%= 10.days.ago.to_date.to_s(:db) %>
115 priority_id: 3
116 subject: Closed issue
117 id: 8
118 fixed_version_id:
119 category_id:
120 description: This is a closed issue.
121 tracker_id: 1
122 assigned_to_id:
123 author_id: 2
124 status_id: 5
125 start_date:
126 due_date:
127 lock_version: 0
111 128 No newline at end of file
@@ -1,130 +1,141
1 1 require File.dirname(__FILE__) + '/../test_helper'
2 2 require 'search_controller'
3 3
4 4 # Re-raise errors caught by the controller.
5 5 class SearchController; def rescue_action(e) raise e end; end
6 6
7 7 class SearchControllerTest < Test::Unit::TestCase
8 8 fixtures :projects, :enabled_modules, :roles, :users,
9 9 :issues, :trackers, :issue_statuses,
10 10 :custom_fields, :custom_values,
11 11 :repositories, :changesets
12 12
13 13 def setup
14 14 @controller = SearchController.new
15 15 @request = ActionController::TestRequest.new
16 16 @response = ActionController::TestResponse.new
17 17 User.current = nil
18 18 end
19 19
20 20 def test_search_for_projects
21 21 get :index
22 22 assert_response :success
23 23 assert_template 'index'
24 24
25 25 get :index, :q => "cook"
26 26 assert_response :success
27 27 assert_template 'index'
28 28 assert assigns(:results).include?(Project.find(1))
29 29 end
30 30
31 31 def test_search_all_projects
32 32 get :index, :q => 'recipe subproject commit', :submit => 'Search'
33 33 assert_response :success
34 34 assert_template 'index'
35 35
36 36 assert assigns(:results).include?(Issue.find(2))
37 37 assert assigns(:results).include?(Issue.find(5))
38 38 assert assigns(:results).include?(Changeset.find(101))
39 39 assert_tag :dt, :attributes => { :class => /issue/ },
40 40 :child => { :tag => 'a', :content => /Add ingredients categories/ },
41 41 :sibling => { :tag => 'dd', :content => /should be classified by categories/ }
42 42
43 43 assert assigns(:results_by_type).is_a?(Hash)
44 44 assert_equal 4, assigns(:results_by_type)['changesets']
45 45 assert_tag :a, :content => 'Changesets (4)'
46 46 end
47 47
48 def test_search_issues
49 get :index, :q => 'issue', :issues => 1
50 assert_response :success
51 assert_template 'index'
52
53 assert assigns(:results).include?(Issue.find(8))
54 assert assigns(:results).include?(Issue.find(5))
55 assert_tag :dt, :attributes => { :class => /issue closed/ },
56 :child => { :tag => 'a', :content => /Closed/ }
57 end
58
48 59 def test_search_project_and_subprojects
49 60 get :index, :id => 1, :q => 'recipe subproject', :scope => 'subprojects', :submit => 'Search'
50 61 assert_response :success
51 62 assert_template 'index'
52 63 assert assigns(:results).include?(Issue.find(1))
53 64 assert assigns(:results).include?(Issue.find(5))
54 65 end
55 66
56 67 def test_search_without_searchable_custom_fields
57 68 CustomField.update_all "searchable = #{ActiveRecord::Base.connection.quoted_false}"
58 69
59 70 get :index, :id => 1
60 71 assert_response :success
61 72 assert_template 'index'
62 73 assert_not_nil assigns(:project)
63 74
64 75 get :index, :id => 1, :q => "can"
65 76 assert_response :success
66 77 assert_template 'index'
67 78 end
68 79
69 80 def test_search_with_searchable_custom_fields
70 81 get :index, :id => 1, :q => "stringforcustomfield"
71 82 assert_response :success
72 83 results = assigns(:results)
73 84 assert_not_nil results
74 85 assert_equal 1, results.size
75 86 assert results.include?(Issue.find(3))
76 87 end
77 88
78 89 def test_search_all_words
79 90 # 'all words' is on by default
80 91 get :index, :id => 1, :q => 'recipe updating saving'
81 92 results = assigns(:results)
82 93 assert_not_nil results
83 94 assert_equal 1, results.size
84 95 assert results.include?(Issue.find(3))
85 96 end
86 97
87 98 def test_search_one_of_the_words
88 99 get :index, :id => 1, :q => 'recipe updating saving', :submit => 'Search'
89 100 results = assigns(:results)
90 101 assert_not_nil results
91 102 assert_equal 3, results.size
92 103 assert results.include?(Issue.find(3))
93 104 end
94 105
95 106 def test_search_titles_only_without_result
96 107 get :index, :id => 1, :q => 'recipe updating saving', :all_words => '1', :titles_only => '1', :submit => 'Search'
97 108 results = assigns(:results)
98 109 assert_not_nil results
99 110 assert_equal 0, results.size
100 111 end
101 112
102 113 def test_search_titles_only
103 114 get :index, :id => 1, :q => 'recipe', :titles_only => '1', :submit => 'Search'
104 115 results = assigns(:results)
105 116 assert_not_nil results
106 117 assert_equal 2, results.size
107 118 end
108 119
109 120 def test_search_with_invalid_project_id
110 121 get :index, :id => 195, :q => 'recipe'
111 122 assert_response 404
112 123 assert_nil assigns(:results)
113 124 end
114 125
115 126 def test_quick_jump_to_issue
116 127 # issue of a public project
117 128 get :index, :q => "3"
118 129 assert_redirected_to 'issues/show/3'
119 130
120 131 # issue of a private project
121 132 get :index, :q => "4"
122 133 assert_response :success
123 134 assert_template 'index'
124 135 end
125 136
126 137 def test_tokens_with_quotes
127 138 get :index, :id => 1, :q => '"good bye" hello "bye bye"'
128 139 assert_equal ["good bye", "hello", "bye bye"], assigns(:tokens)
129 140 end
130 141 end
General Comments 0
You need to be logged in to leave comments. Login now