Commit d93241fc85636634ca3a2c0c0a946ebfd4f80575

Added ticket filter
Cleaned up ticket fixtures

Commit diff

app/controllers/tickets_controller.rb

 
66 @title, @url_suffix = Project.tab_settings(PRJ_TAB_TICKETS)
77 render :action => "ac_project_index"
88 end
9
10 def create
11 if !params[:id]
12 @title, @url_suffix = Project.tab_settings(PRJ_TAB_TICKETS)
13 render :action => "ac_project_index"
14 end
15 end
16
917
1018end
toggle raw diff

app/helpers/application_helper.rb

 
183183 def div_content_close
184184 %Q{</div>}
185185 end
186
187 def div_function_open
188 %Q{<div id='function'>}
189 end
190
191 def div_function_close
192 %Q{</div>}
193 end #
194186
195187 def div_rightcolumn_open
196188 %Q{<div id='rightcolumn'>}
toggle raw diff

app/helpers/projects_helper.rb

 
121121 out << actionbox_complex(:allow_shortcuts => true, :new_milestone => true, :completed_milestones => true)
122122 when PRJ_TAB_TICKETS
123123 out << actionbox_complex(:allow_shortcuts => true, :new_ticket => true)
124 out << actionbox_ticket_filter
124 out << render(:partial => "ac_right_ticket_filter")
125125 when PRJ_TAB_ARTICLES
126126 out << actionbox_complex(:allow_shortcuts => true, :new_article => true)
127127 when PRJ_TAB_FORUM
134134 out
135135 end
136136
137 #TODO need to find a better place for these (partial?)
138 def actionbox_ticket_filter
139 out = ""
140 out << %Q{<table class='right_default_table' cellspacing=0px>}
141 out << %Q{<tr><th>Ticket Filter</th></tr>}
142
143 out << %Q{<tr><td>Type:</td></tr>}
144
145 out << %Q{<tr><td>&nbsp;&nbsp;<small><input type=checkbox>Defect</small></td></tr>}
146 out << %Q{<tr><td>&nbsp;&nbsp;<input type=checkbox>Enhancement</td></tr>}
147 out << %Q{<tr><td>&nbsp;&nbsp;<input type=checkbox>Task</td></tr>}
148
149 out << %Q{<tr><td>Status:</td></tr>}
150 out << %Q{<tr><td>&nbsp;&nbsp;<input type=checkbox>Proposed</td></tr>}
151 out << %Q{<tr><td>&nbsp;&nbsp;<input type=checkbox>Open</td></tr>}
152 out << %Q{<tr><td>&nbsp;&nbsp;<input type=checkbox>Closed</td></tr>}
153
154 out << %Q{<tr><td>Impact:</td></tr>}
155 out << %Q{<tr><td>&nbsp;&nbsp;<input type=checkbox>Low</td></tr>}
156 out << %Q{<tr><td>&nbsp;&nbsp;<input type=checkbox>High</td></tr>}
157 out << %Q{<tr><td>&nbsp;&nbsp;<input type=checkbox>Security</td></tr>}
158
159 out << %Q{<tr><td>Priority:</td></tr>}
160 out << %Q{<tr><td>&nbsp;&nbsp;<input type=checkbox>None</td></tr>}
161 out << %Q{<tr><td>&nbsp;&nbsp;<input type=checkbox>Low</td></tr>}
162 out << %Q{<tr><td>&nbsp;&nbsp;<input type=checkbox>High</td></tr>}
163 out << %Q{<tr><td>&nbsp;&nbsp;<input type=checkbox>Critical</td></tr>}
164
165 out << %Q{</table>}
166 out
167 end
168
137
169138 def render_project_roadmap
170
171139 #get all milestones for a project
172140 #order by date desc
173141 #if there is a version linked, show that next to milestone
143143 @milestones = Milestone.roadmap(@project.id, current_user)
144144 if @milestones.size > 0 then
145145 for milestone in @milestones
146
147146 # milestone title
148147 out << "<h3>"
149148 out << format_date_ddbbyy(milestone.due_date)
150149 out << " - " << milestone.name << " (" << milestone.status.to_s.capitalize << ")"
151150 out << "</h3>"
152
153151 # milestone progress bar
154152 out << "<table class='progress'>"
155153 out << "<tr>"
157157 out << "</table>"
158158
159159
160 # tickets for milestone
161 @tickets = Ticket.find_by_milestone(milestone.id)
162 if @tickets.size > 0 then
163 # tasks list
164 out << "<table class='public' width='100%'>"
165 out << "<tr>"
166 out << "<th>Task</th>"
167 out << "<th>Assignee</th>"
168 out << "<th>Status</th>"
169 out << "<th>Impact</th>"
170 out << "<th>Priority</th>"
171 out << "</tr>"
172 #
173 for ticket in @tickets
174 out << "<tr>"
175 out << "<td>" << ticket.title << "</td>"
176 out << "<td>" << ticket.assignee.fullname << "</td>"
177 out << "<td>" << ticket.status.to_s.capitalize << "</td>"
178 out << "<td>" << ticket.impact.to_s.capitalize << "</td>"
179 out << "<td>" << ticket.priority.to_s.capitalize << "</td>"
180 out << "</tr>"
181 end
182 out << "</table>"
183 out << "<br />"
184 end
185160 end
186161 end
187162 out
188163 end
189164
165
166
190167 def format_life_cycle (ls)
191168 case ls
192169 when :pre_alpha
toggle raw diff

app/helpers/tickets_helper.rb

 
33 include ProjectsHelper
44
55 def render_project_tickets
6 out = ""
7 @tickets = Ticket.filtered(params[:ticket] ? params[:ticket] : "")
8 if @tickets.size > 0 then
9 # tasks list
10 out << "<table class='public' width='100%'>"
11 out << "<tr>"
12 out << "<th></th>"
13 out << "<th>Task</th>"
14 out << "<th>Assignee</th>"
15 out << "<th>Type</th>"
16 out << "<th>Status</th>"
17 out << "<th>Impact</th>"
18 out << "<th>Priority</th>"
19 out << "</tr>"
20 #
21 for ticket in @tickets
22 out << "<tr>"
23 out << "<td>" << ticket.name << "</td>"
24 out << "<td>" << ticket.title << "</td>"
25 out << "<td>" << ticket.fullname << "</td>"
26 out << "<td>" << ticket.ttype.to_s.capitalize << "</td>"
27 out << "<td>" << ticket.status.to_s.capitalize << "</td>"
28 out << "<td>" << ticket.impact.to_s.capitalize << "</td>"
29 out << "<td>" << ticket.priority.to_s.capitalize << "</td>"
30 out << "</tr>"
31 end
32 out << "</table>"
33 out << "<br />"
34 end
35 out
636 end
737
8
38 def ticket_value_checked? (v)
39 params[:ticket][v] == "1" ? "checked" : "" if params[:ticket]
40 end
41
42
43
944end
toggle raw diff

app/models/ticket.rb

 
1212 end
1313
1414 #
15 def self.find_by_milestone(milestone_id)
16 find(:all, :conditions => ["milestone_id = '#{milestone_id}'"], :order => "due_date DESC")
15# def self.find_by_milestone(milestone_id)
16# find(:all, :conditions => ["milestone_id = '#{milestone_id}'"], :order => "due_date DESC")
17# end
18
19 def self.qconcat (filters, types, lstart)
20 s = ""
21 types.each do |t|
22 if filters[t] == "1"
23 s << ", " if s.length > 0
24 s << "'" << t.to_s[lstart..t.to_s.length] << "'"
25 end
26 end
27 s.size > 0 ? s : nil
28 end
29
30 #
31 def self.filtered(filters = {})
32
33 ttype = qconcat(filters, [:ttype_defect, :ttype_enhancement, :ttype_task], 6)
34 status = qconcat(filters, [:status_proposed, :status_open, :status_closed], 7)
35 impact = qconcat(filters, [:impact_low, :impact_high, :impact_security], 7)
36 priority = qconcat(filters, [:priority_none, :priority_low, :priority_high, :priority_critical], 9)
37
38 w = "WHERE true "
39 w << "AND tickets.ttype IN (#{ttype})\n" if ttype
40 w << "AND tickets.status IN (#{status})\n" if status
41 w << "AND tickets.impact IN (#{impact})\n" if impact
42 w << "AND tickets.priority IN (#{priority})\n" if priority
43 #w << "AND tickets.audience IN (#{audience})\n"
44
45 find_by_sql("SELECT tickets.title,
46 tickets.ttype,
47 tickets.status,
48 tickets.impact,
49 tickets.priority,
50 tickets.audience,
51 users.fullname AS fullname,
52 milestones.name AS name
53 FROM tickets
54 JOIN users ON tickets.assignee_id = users.id
55 LEFT JOIN milestones ON tickets.milestone_id = milestones.id
56 #{w}
57 ORDER BY milestones.due_date DESC, priority")
1758 end
59
60
1861
1962 #
2063
toggle raw diff

app/views/activities/_ac_right_actionbox_post_message.html.erb

 
88 <%= f.text_area(:activity, :rows => 4) -%>
99
1010 <p>
11 <a href="javascript:document.postmessage.submit();" class='function'>Update</a>
11 <a href="javascript:document.postmessage.submit();">Update</a>
1212 </p>
1313
1414<% end -%>
toggle raw diff

app/views/projects/ac_timeline.html.erb

 
0
1<%= render :partial => "ac_project_header", :locals => { :tab => PRJ_TAB_LOG, :project => @project, :pagetitle => @title } %>
2
3<%= render :partial => "ac_project_footer" %>
toggle raw diff

app/views/sessions/ac_new.html.erb

 
2525 <%= check_box_tag 'remember_me' %>
2626 </p>
2727
28 <p><a href="javascript:document.sessionform.submit();" class='function'>Login</a></p>
28 <p><a href="javascript:document.sessionform.submit();">Login</a></p>
2929<% end -%>
3030
3131<%= div_formattedtext_close %>
toggle raw diff

app/views/tickets/_ac_right_ticket_filter.html.erb

 
1
2<table class='right_default_table' cellspacing=0px>
3
4<% form_for :ticket, :url => project_tickets_path(@project.slug), :method => :get, :html => {:name => 'ticketfilter'} do |f| %>
5
6<tr><th colspan=2>Ticket Filter</th></tr>
7
8<tr>
9
10<td><small>
11<br />
12<%= check_box(:ticket, :ttype_defect, {:checked => ticket_value_checked?(:ttype_defect)}, "1", "0") %>Defect<br />
13<%= check_box(:ticket, :ttype_enhancement, {:checked => ticket_value_checked?(:ttype_enhancement)}, "1", "0") %>Enhancement<br />
14<%= check_box(:ticket, :ttype_task, {:checked => ticket_value_checked?(:ttype_task)}, "1", "0") %>Task<br />
15<br />
16<%= check_box(:ticket, :status_proposed, {:checked => ticket_value_checked?(:status_proposed)}, "1", "0") %>Proposed<br />
17<%= check_box(:ticket, :status_open, {:checked => ticket_value_checked?(:status_open)}, "1", "0") %>Open<br />
18<%= check_box(:ticket, :status_closed, {:checked => ticket_value_checked?(:status_closed)}, "1", "0") %>Closed<br />
19<br />
20</small></td>
21
22<td><small>
23<br />
24<%= check_box(:ticket, :impact_low, {:checked => ticket_value_checked?(:impact_low)}, "1", "0") %>Low Impact<br />
25<%= check_box(:ticket, :impact_high, {:checked => ticket_value_checked?(:impact_high)}, "1", "0") %>High Impact<br />
26<%= check_box(:ticket, :impact_security, {:checked => ticket_value_checked?(:impact_security)}, "1", "0") %>Security Impact<br />
27<br />
28<%= check_box(:ticket, :priority_none, {:checked => ticket_value_checked?(:priority_none)}, "1", "0") %>No Priority<br />
29<%= check_box(:ticket, :priority_low, {:checked => ticket_value_checked?(:priority_low)}, "1", "0") %>Low Priority<br />
30<%= check_box(:ticket, :priority_high, {:checked => ticket_value_checked?(:priority_high)}, "1", "0") %>High Priority<br />
31<%= check_box(:ticket, :priority_critical, {:checked => ticket_value_checked?(:priority_critical)}, "1", "0") %>Critical<br />
32<br />
33</small></td>
34
35</tr>
36
37<tr><td colspan=2>
38<center><a href="javascript:document.ticketfilter.submit();" class='function'>Update</a></center><br />
39</td></tr>
40
41<% end %>
42
43</table>
44
toggle raw diff

app/views/tickets/ac_project_index.html.erb

 
11<%= render :partial => "projects/ac_project_header", :locals => { :tab => PRJ_TAB_TICKETS, :project => @project, :pagetitle => @title } %>
22
3<div id='todo'>
4<p>Ticket management</p>
5</div>
6
7
83<%= render_project_tickets %>
94
10<div id='todo'>
11<p>See <a href='http://dev.rubyonrails.org/query?status=new&status=assigned&status=reopened&milestone=2.1'>http://dev.rubyonrails.org/query?status=new&status=assigned&status=reopened&milestone=2.1</a></p>
12<p>Add a filter to top of page to show All, my or members tasks, priorities etc.</p>
13<p>Add percentage completed bars to each milestone / task</p>
14<p>Add comments for a milestone or task</p>
15<p>Move this view to tasklists controller</p>
16<p>A task can belong to a version or release</p>
17<p>A milestone can belong to a project or version (e.g. a project may have a bluesky 'v7 release', and version may have a more detailed 'v6.1 release' milestone</p>
18<p>A task may or may not have an issue associated with it</p>
19<p>Add a calendar view, allow tasks, milestones and events to be added to calendar</p>
20<p>Add Ajax task order sort (needs an milestone_order sort field in DB)</p>
21</div>
22
23<div id='todo'>
24<p>Tickets can belong to a project, release, milestone</p>
25<p>Tickets can be for bugs, enhancements or tasks</p>
26
27<ul>
28 <li>Project < ticket|task|milestone</li>
29 <ul>
30 <li>Version (stable, dev) < ticket|task|milestong</li>
31 <ul>
32 <li>Release (1.0, 1.1) < ticket|task|milestone</li>
33 </ul>
34 </ul>
35 <li>milestone < task(s)</li>
36 <li>ticket < task(s)</li>
37 <li>ticket and tasks are almost indentical, is there a better solution?</li>
38 <li>allow ticket categories to be created per project</li>
39 <li>add a filter like this: http://rubyforge.org/tracker/?atid=1698&group_id=426&func=browse</li>
40</ul>
41
42</div>
43
445<%= render :partial => "projects/ac_project_footer" %>
toggle raw diff

app/views/wikis/ac_project_edit.html.erb

 
2121 </p>
2222
2323 <p>
24 <%= link_to "Cancel", project_wiki_path(@project.slug, @wiki.slug), :class => 'function' %>
25 <a href="javascript:document.editwiki.submit();" class='function'>Preview</a>
26 <a href="javascript:document.editwiki.submit();" class='function'>Update</a>
24 <%= link_to "Cancel", project_wiki_path(@project.slug, @wiki.slug) %>
25 <a href="javascript:document.editwiki.submit();">Preview</a>
26 <a href="javascript:document.editwiki.submit();">Update</a>
2727 </p>
2828
2929<% end -%>
toggle raw diff

app/views/wikis/ac_project_new.html.erb

 
1717
1818 <p>
1919 <%= link_to "Cancel", project_path(@project.slug), :class => 'function' %>
20 <a href="javascript:document.newwiki.submit();" class='function'>Preview</a>
21 <a href="javascript:document.newwiki.submit();" class='function'>Create</a>
20 <a href="javascript:document.newwiki.submit();">Preview</a>
21 <a href="javascript:document.newwiki.submit();">Create</a>
2222 </p>
2323
2424<% end -%>
toggle raw diff

public/robots.txt

 
77#User-agent: *
88#Disallow: /projects/
99
10User-agent: *
11Disallow: /
10#User-agent: *
11#Disallow: /
toggle raw diff

public/stylesheets/base.css

 
11/*
2 Gitlab specfic CSS
3
42 Note: CSS for syntax highlighting is in /vendor/coderay/styles/gitlab.rb
53*/
64
189189table.right_default_table th { font-weight: 800; text-align: left; background-color: #eee; border: 0px; margin: 0px; padding: 4px 10px 4px 10px; }
190190table.right_default_table td { vertical-align: top; text-align: left; background-color: #fbfbfb; border: 0px; margin: 0px; padding: 4px 5px 4px 10px; }
191191table.right_default_table .count { font-size: 0.9em; }
192table.right_default_table .function { margin: 10px 0px 0px 0px; background-color: #fff; text-decoration: none; padding: 4px 8px 4px 8px; border: 1px solid #dde; font-weight: 800; }
193
192194/*
193195table.releasedownload { margin-top: 10px; margin-bottom: 20px; background-color: #fff; border-spacing: 0px; }
194196table.releasedownload td { vertical-align: top; color: #000; font-size: 1.0em; border: 0px; }
toggle raw diff

test/fixtures/milestones.yml

 
66<% fixtures :projects %>
77
88gitlabstable:
9 id: 2
10 name: "0.1 Latest Stable"
9 id: 1
10 name: "0.1 Stable"
1111 description: "90% of Model, very little CRUD, loads missing."
1212 status: :complete
1313 slug: "0-1"
1818 progress: 96
1919
2020gitlabdevelopment:
21 id: 3
22 name: "0.2 Active Development"
21 id: 2
22 name: "0.2 Active Dev"
2323 description: "Current pre-alpha development version, loads missing. Commits go to <a href=''>0.2 Development</a>"
2424 status: :active
2525 slug: "0-2"
3030 progress: 20
3131
3232gitlabdevelopmentplusone:
33 id: 4
33 id: 3
3434 name: "0.3 Next"
3535 description: "Proposed next development version."
3636 status: :proposed
4242 progress: 30
4343
4444gitlabpublic:
45 id: 5
46 name: "1.x Public Release"
45 id: 4
46 name: "1.x Public"
4747 description: "First fully functional release."
4848 status: :proposed
4949 slug: "1-x"
5353 project_id: <%= projects(:gitlab) %>
5454 progress: 10
5555
56gitlabpublicv2:
57 id: 6
58 name: "2.x"
59 description: "Proposed second generation"
60 status: :proposed
61 slug: "2-x"
62 audience: :public
63 created_at: "2008-03-07 18:04:00"
64 due_date: "2009-01-01 00:00:00"
65 project_id: <%= projects(:gitlab) %>
66 progress: 0
67
68
69
70
toggle raw diff

test/fixtures/tickets.yml

 
77<% fixtures :users, :milestones %>
88
99#
10# Add settings system
11#
12# Move journals, settings and servermanager to plugins
13#
14#
15# Milestone
16# Ticket (single or multiple task)
17# Task
18#
19# Look at using http://dostorm.com/ system for repo trees (it uses ULs and sets the left border
20#
21# Remove all != nil
22#
23# Add defaults to fixtures:
24#
25# DEFAULTS: &DEFAULTS
26# created_on: <%= 3.weeks.ago.to_s(:db) %>
27#
28# first:
29# name: Smurf
30# <<: *DEFAULTS
31#
32#
33# Add comments to tickets
34#
35# Add some system to tickets to allow files to be added
36#
37# Add glow round screenshot images
38#
39# On home page make the permalinks include the project title
40#
41# Articles: Make the right column user and categories list collapsable
42#
43# Articles: Make the current filter clearer (title or something), maybe use the project navigator style bar with lots of drop downs on
44#
45# sort the directory listing by directory asc, file asc
46#
47# don't allow massive commits to be viewed as HTML (8510e1b)
48#
49# Sort tree by directorys, files
50#
51# Click on a file in tree to see change history
52#
53# Use <thead>
54#
55# Refactor:
56# Disconnect Milestone, make it just a collection of tickets
57#
58# Project
10# Possible filtering
5911#
6012# * Summary
6113# * Roadmap [filter milestone, urgency, user]
3030# Forum [filter project]
3131# Timeline [filter project, branch, event_type]
3232#
33#
34# Use the nested mapping in routes that Gitorious uses
35#
36# Look at adding Grit from Gitorious repo as a submodule using git-submodule
37#
38# Change all helpers to use same string system used on application_helper
39#
40# Add twitter type feed to user profile pages
41#
42# Look at using content_tag for doing divs
43#
44# Figure out why a case statement is not working in /views/shared/_articles_list
45#
46# Add RSS feeds per project
47#
48# Add pagination to the article list tabs on Project and Profile
49#
50# Change favicon from red to orange
51#
52# Add a checkbox on Roadmap to show completed milestones - http://dev.rubyonrails.org/roadmap?show=all
53#
54# Change the button on project and profile navs to toolbar icons
55#
56# Use partials to render similar headers (like all the profile and project pages)
57#
58# When doing polymorphic tables - see this http://errtheblog.com/posts/15-hasmany-as
59#
60# Ajax preview of typed text - http://errtheblog.com/posts/23-submittopopup
61#
62# Add :limit => 50 to strings in migrations
63#
64# Consider renaming wiki to kb
65#
66# :unique => true in migrations
67#
68# Journals (revision history) for wikis, tickets, tasks, milestone (descriptions), articles, project (descriptions), using _journal tables
69#
70# Store IP address of people making changes
71#
72# In the wiki formatting add some way to backlink http://trac.edgewall.org/wiki/TracCrossReferences
73#
74# Add HTML description meta tag to headers
75#
76# Move mediacloth to it's correct location (in /vendor looking at the other users)
77#
7833
7923:
80 id: 23
81 title: "Add an &lt;noscript>&gt; section for the project nav filter, listing all versions and revisions in a single dropdown"
82 open_date: "2008-03-04 08:23:00"
34
35
36DEFAULTS: &DEFAULTS
37 open_date: "2008-02-16 21:56:00"
8338 assignee_id: <%= users(:mtkd) %>
8439 submitter_id: <%= users(:mtkd) %>
40 audience: :public
41
42
4337:
44 id: 37
45 title: "Rename and move gitorious config to a table"
46 <<: *DEFAULTS
47 milestone_id: <%= milestones(:gitlabdevelopment) %>
48 ttype: :task #:defect, :enhancement, :task
49 status: :proposed #:proposed, :open, :closed, :deleted
50 impact: :low #:low, :high, :security
51 priority: :low #:none, :low, :high, :critical
52
5336:
54 id: 36
55