Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 24
- Log:
Initial import of Collaboa 0.5.6 from downloaded Tarball. Collaboa is
a Ruby On Rails based bug tracker and SVN repository browsing tool.
- Author:
- adh
- Date:
- Mon Jul 24 21:54:39 +0100 2006
- Size:
- 2882 Bytes
1 | class TicketsController < ApplicationController |
2 | helper :sort |
3 | include SortHelper |
4 | before_filter :login_required |
5 | |
6 | def index |
7 | # Redirect to a "default" filter once we've added so we can save filters |
8 | redirect_to :action => 'filter', :status => 1 |
9 | end |
10 | |
11 | def filter |
12 | sort_init('created_at', 'desc') |
13 | sort_update |
14 | |
15 | @milestones = Milestone.find(:all) |
16 | @parts = Part.find(:all) |
17 | @severities = Severity.find(:all, :order => 'position DESC') |
18 | @status = Status.find(:all) |
19 | logger.info "sort_clause: #{sort_clause}" |
20 | @tickets = Ticket.find_by_filter(params, sort_clause) |
21 | render :action => 'index' |
22 | end |
23 | |
24 | def show |
25 | @milestones = Milestone.find(:all) |
26 | @parts = Part.find(:all) |
27 | @severities = Severity.find(:all, :order => 'position DESC') |
28 | @releases = Release.find(:all) |
29 | @status = Status.find(:all) |
30 | |
31 | begin |
32 | @ticket = Ticket.find(params[:id], :include => [ :severity, :part, :status, :milestone ]) |
33 | rescue ActiveRecord::RecordNotFound |
34 | render :text => "Unknown ticket number" and return |
35 | end |
36 | |
37 | @change = TicketChange.new |
38 | @change.author = cookies['author'] |
39 | |
40 | @change.attributes = params[:change] |
41 | @ticket.attributes = params[:ticket] |
42 | |
43 | if request.post? && (@change.valid? && @ticket.valid?) |
44 | @change.author = params[:change][:author] |
45 | if @ticket.save(params) |
46 | set_author_cookie(@change.author) |
47 | redirect_to :action => 'show', :id => @ticket.id |
48 | end |
49 | end |
50 | end |
51 | |
52 | def attachment |
53 | @change = TicketChange.find(params[:id]) |
54 | unless @change.has_attachment? |
55 | redirect_to :action => 'show', :id => @change.ticket_id |
56 | else |
57 | begin |
58 | fullpath = @change.attachment_fsname |
59 | send_file(fullpath, :filename => @change.attachment,:type => @change.content_type, :disposition => 'inline') |
60 | rescue |
61 | render :text => "Could not find an attachment for this id" |
62 | end |
63 | end |
64 | end |
65 | |
66 | def new |
67 | @milestones = Milestone.find(:all, :conditions => "completed = 0") |
68 | @parts = Part.find(:all) |
69 | @severities = Severity.find(:all, :order => 'position DESC') |
70 | @releases = Release.find(:all) |
71 | |
72 | @ticket = Ticket.new |
73 | @ticket.author ||= cookies['author'] |
74 | |
75 | if request.post? |
76 | @ticket = Ticket.new(params[:ticket]) |
77 | @ticket.author = params[:ticket][:author] |
78 | @ticket.author_host = request.remote_ip |
79 | @ticket.status = Status.find_by_name('Open') |
80 | |
81 | set_author_cookie(@ticket.author) |
82 | |
83 | if @ticket.save |
84 | redirect_to :action => 'show', :id => @ticket.id |
85 | end |
86 | end |
87 | end |
88 | |
89 | private |
90 | def set_author_cookie(author) |
91 | cookies['author'] = { 'value' => author, 'expires' => 4.weeks.from_now } |
92 | end |
93 | |
94 | def authorize?(user) |
95 | if action_name == 'new' |
96 | user.create_tickets? |
97 | else |
98 | user.view_tickets? |
99 | end |
100 | end |
101 | |
102 | end |