Changesets can be listed by changeset number.
The Git repository is here.
Changeset 491
Jan 2024 bug tracker updates
- Comitted by: rool
- Date: Sunday January 28 09:33:07 2024 (11 months ago)
Affected files:
- rool/rails/collaboa/trunk/app/models/ticket.rb (diff)
- rool/rails/collaboa/trunk/app/models/ticket_change.rb (diff)
- rool/rails/collaboa/trunk/app/views/search/index.rhtml (diff)
- rool/rails/collaboa/trunk/public/stylesheets/screen.css (diff)
rool/rails/collaboa/trunk/app/models/ticket.rb:
prev. | current | |
belongs_to :status | ||
belongs_to :release | ||
has_many :ticket_changes, :order => 'created_at', :dependent => true | ||
8 | | |
8 | ||
attr_protected :author | ||
10 | | |
10 | ||
def before_save | ||
self.status ||= Status.find(1) | ||
self.severity ||= Severity.find(1) | ||
... | ... | |
change.attach(params[:change][:attachment]) unless params[:change][:attachment].blank? | ||
if change.empty? | ||
31 | | |
32 | | |
31 | self.errors.add_to_base 'No changes has been made' | |
32 | self.ticket_changes.delete(change) | |
change.destroy | ||
return nil | ||
else | ||
change.save | ||
end | ||
end | ||
39 | | |
39 | ||
def next | ||
Ticket.find(:first, :conditions => ['id > ?', id], :order =>'id ASC') | ||
end | ||
43 | | |
43 | ||
def previous | ||
Ticket.find(:first, :conditions => ['id < ?', id], :order => 'id desc') | ||
end | ||
47 | | |
47 | ||
class << self | ||
# Returns am array of "normalized" hashes, useful for mixing display of search result from | ||
# other resources (token finder code based on things found in Typo) | ||
... | ... | |
if !query.to_s.strip.empty? | ||
tokens = query.split.collect {|c| "%#{c.downcase}%"} | ||
findings = find( :all, | ||
55 | | |
55 | :conditions => [(["(LOWER(summary) LIKE ? OR LOWER(content) LIKE ?)"] * tokens.size).join(" AND "), | |
*tokens.collect { |token| [token] * 2 }.flatten], | ||
:order => 'created_at DESC') | ||
58 | | |
59 | | |
60 | | |
61 | | |
62 | | |
63 | | |
58 | findings.collect do |f| | |
59 | { | |
60 | :title => f.summary, | |
61 | :content => f.content, | |
62 | :link => { :controller => '/tickets', :action => 'show', :id => f.id }, | |
63 | :status => (f.status.name rescue 'Unknown') | |
64 | } | |
end | ||
else | ||
[] | ||
67 | | |
68 | end | |
end | ||
69 | | |
70 | ||
# Find a bunch of Tickets from a hash of SQL-like fragments. Silently discards | ||
# everything we don't want. Accepts +order_by+, +direction+ and +limit+ to limit/order | ||
# the results (eg from a table sort etc) | ||
... | ... | |
#order_by = 'created_at' unless %w{created_at name id}.include? order_by | ||
direction = 'DESC' unless %w{ASC DESC}.include? direction | ||
90 | | |
91 | | |
92 | | |
91 | ||
92 | find_by_sql %{SELECT tickets.*, | |
93 | status.name AS status_name, | |
severities.name AS severity_name, | ||
parts.name AS part_name, | ||
milestones.name AS milestone_name, | ||
96 | | |
97 | | |
98 | | |
99 | | |
100 | | |
101 | | |
102 | | |
97 | releases.name AS release_name | |
98 | FROM tickets | |
99 | LEFT OUTER JOIN severities ON severities.id = tickets.severity_id | |
100 | LEFT OUTER JOIN status ON status.id = tickets.status_id | |
101 | LEFT OUTER JOIN parts ON parts.id = tickets.part_id | |
102 | LEFT OUTER JOIN milestones ON milestones.id = tickets.milestone_id | |
103 | LEFT OUTER JOIN releases ON releases.id = tickets.release_id | |
#{filters.to_s unless filters.empty?} | ||
ORDER BY tickets.#{order_by} } | ||
end | ||
end | ||
107 | | |
108 | ||
protected | ||
validates_presence_of :author, :summary, :content | ||
110 | | |
111 | ||
LOG_MAP = { | ||
#'assigned_user_id' => ['Assigned', 'Unspecified', lambda{|v| User.find(v).username if v > 0}], | ||
'part_id' => ['Part', 'Unspecified', lambda{|v| Part.find(v).name if v > 0}], | ||
... | ... | |
'milestone_id' => ['Milestone', 'Unspecified', lambda{|v| Milestone.find(v).name if v > 0}], | ||
'summary' => ['Summary', nil, lambda{|v| v unless v.empty?}], | ||
} | ||
120 | | |
121 | ||
# This cool write_attribute override is courtesy of Kent Sibilev | ||
def write_attribute(name, value) | ||
@log ||= {} |
rool/rails/collaboa/trunk/app/models/ticket_change.rb:
prev. | current | |
class TicketChange < ActiveRecord::Base | ||
belongs_to :ticket | ||
serialize :log | ||
4 | | |
4 | ||
def each_log | ||
return unless self.log | ||
self.log.each do |name, (old_value, new_value)| | ||
yield [name, old_value, new_value] | ||
end | ||
end | ||
11 | | |
11 | ||
def empty? | ||
return false if self.comment && !self.comment.empty? | ||
return false if self.log && !self.log.empty? | ||
return false if self.attachment && !self.attachment.empty? | ||
true | ||
end | ||
18 | | |
18 | ||
# TODO: flesh out | ||
def attach(attachment) | ||
unless attachment.blank? | ||
... | ... | |
end | ||
end | ||
end | ||
32 | | |
32 | ||
def dump_filename | ||
File.expand_path(File.join(ATTACHMENTS_PATH, "#{self.id}-#{self.attachment}")) | ||
35 | | |
36 | | |
35 | end | |
36 | ||
def has_attachment? | ||
self.attachment && !self.attachment.empty? | ||
end | ||
40 | | |
40 | ||
class << self | ||
# Returns am array of "normalized" hashes, useful for mixing display of search result from | ||
# other resources (token finder code based on things found in Typo) | ||
... | ... | |
if !query.to_s.strip.empty? | ||
tokens = query.split.collect {|c| "%#{c.downcase}%"} | ||
findings = find( :all, | ||
48 | | |
48 | :conditions => [(["(LOWER(comment) LIKE ?)"] * tokens.size).join(" AND "), | |
*tokens.collect { |token| [token] }.flatten], | ||
:order => 'created_at DESC') | ||
51 | | |
52 | | |
53 | | |
54 | | |
55 | | |
56 | | |
51 | findings.collect do |f| | |
52 | { | |
53 | :title => "Ticket ##{f.ticket_id} comment by #{f.author}", | |
54 | :content => f.comment, | |
55 | :link => { :controller => '/tickets', :action => 'show', :id => f.ticket_id }, | |
56 | :status => (f.ticket.status.name rescue 'Unknown') | |
57 | } | |
end | ||
else | ||
[] | ||
60 | | |
61 | end | |
end | ||
end | ||
63 | | |
64 | ||
protected | ||
validates_presence_of :author | ||
rool/rails/collaboa/trunk/app/views/search/index.rhtml:
prev. | current | |
<p /> | ||
<% items.each do |item| -%> | ||
<div class="search-result"> | ||
30 | | |
30 | <h1> | |
31 | <% if ['fixed', 'wontfix', 'invalid'].include?(item[:status].downcase) %> | |
32 | <s><%= link_to item[:title], item[:link] -%></s> | |
33 | <% else %> | |
34 | <%= link_to item[:title], item[:link] -%> | |
35 | <% end %> | |
36 | <small style="font-weight: normal; font-size: 15pt;">[<%= item[:status] %>]</small> | |
37 | </h1> | |
<p> | ||
<%= hilight_search_terms(simple_format(item[:content]), @params["q"]) %> | ||
</p> |
rool/rails/collaboa/trunk/public/stylesheets/screen.css:
prev. | current | |
* Based on the Collaboa default stylesheet. | ||
*/ | ||
6 | ||
6 | @import url("/css/risc_os_open_2024.css"); | |
/* Some general properties */ | ||
... | ... | |
div#content p.milestone-details a | ||
{ | ||
22 | | |
22 | border-bottom: 1px dotted; | |
} | ||
div#ticket h1 |