Dashboard: Make table sections able to display links
Updated 9 months, 1 week ago
| Ted Tate | Reviewers | ||
| Basie-Dev | |||
| None | Basie SVN | ||
Make the recently closed tickets section on the dashboard show links to tickets. This is a general change to the sections.TableSection class and thus will allow other applications utilizing the class to do similar to what is shown in recently closed tickets.
Works with current tests. Adding another test to test link adding.
Review request changed
Updated 9 months, 2 weeks ago (October 14th, 2009, 12:31 p.m.)
-
- added Diff r2
Posted 9 months, 2 weeks ago (October 14th, 2009, 12:34 p.m.)
-
/trunk/apps/dash/templates/dash/table.html (Diff revision 2) -
I'm unsure about doing this. Cell should always be a tuple when it is a link where the first item is the link itself, and the second item is link text. Another option would be to always have cell be a tuple where the second item would be empty if cell was not a link. Overall, I prefer the first way but would like some input.
Review request changed
Updated 9 months, 2 weeks ago (October 14th, 2009, 3:18 p.m.)
-
- added Diff r3
Fixed doctests for dash that this change broke.
Review request changed
Updated 9 months, 2 weeks ago (October 14th, 2009, 3:19 p.m.)
-
Probably breaks tests made for the dashboard. Fixes in progress. Will updated diff when done.
Works with current tests. Adding another test to test link adding.
Current dash doctests now work.
Posted 9 months, 2 weeks ago (October 15th, 2009, 5:05 p.m.)
-
/trunk/apps/dash/sections.py (Diff revision 3) -
since items already come out of a project items = get_visible(user, project, self.model) is it necessary to #get_row for item _and_ project?
-
/trunk/apps/dash/templates/dash/table.html (Diff revision 3) -
to weight in, if a cell is not a link, then we shouldn't construct <a> tags.
-
/trunk/apps/dash/tests/sections.doctest (Diff revision 3) -
but "project" is instance.project. The new argument doesn't appear to be used.
-
/trunk/apps/tickets/dash_data.py (Diff revision 3) -
instead of project.slug, can't we use ticket.project.slug ?
Posted 9 months, 2 weeks ago (October 17th, 2009, 11:23 a.m.)
Some suggestions.
-
/trunk/apps/dash/sections.py (Diff revision 3) -
You are not using project in self.get_row. Why did you add that parameter?
-
/trunk/apps/dash/templates/dash/table.html (Diff revision 3) -
{% for link,text in row %} {% if link %} <a href={{ link }}>{{ text|default:"-" }}</a> {% else %} {{ text|default:"-" }} {% endif %} row will be a generator(something iterable) in which the first element can be a link or None and the second element is the text. -
/trunk/apps/dash/tests/sections.doctest (Diff revision 3) -
You should include a get_absolute_url (http://docs.djangoproject.com/en/dev/ref/models/instances/#django.db.models.Model.get_absolute_url) method in our FakeEvent model. from itertools import izip_longest row_texts = (instance.title, ...) link = intance.get_absolute_url() # Fills with None. return izip_longest([link], row_texts)
-
/trunk/apps/tickets/dash_data.py (Diff revision 3) -
ticket url is: ticket.get_absolute_url() Take a look at apps/tickets/models.py line 51
-
/trunk/apps/tickets/dash_data.py (Diff revision 3) -
from itertools import izip_longest row_texts = (ticket.number, ...) link = ticket.get_absolute_url() # Fills with None. return izip_longest([link], row_texts)
Review request changed
Updated 9 months, 1 week ago (October 20th, 2009, 2:59 a.m.)
-
- added Diff r4
Updated diff based on suggestions from Zuzel and Tony.
Looks ok :) I will update my diff after your commit so there are no conflicts. -- Waiting for your review.
-
/trunk/apps/tickets/dash_data.py (Diff revision 4) -
This import line is not necessary (you can remove it before the commit, no need to update the diff on review board)
