Merge lp:~wallyworld/launchpad/nominations-javascript2-271697 into lp:launchpad

Proposed by Ian Booth
Status: Merged
Approved by: Curtis Hovey
Approved revision: no longer in the source branch.
Merged at revision: 16093
Proposed branch: lp:~wallyworld/launchpad/nominations-javascript2-271697
Merge into: lp:launchpad
Diff against target: 122 lines (+18/-54)
2 files modified
lib/lp/bugs/stories/bugs/xx-bug-nomination-table-row.txt (+4/-23)
lib/lp/bugs/templates/bugnomination-tasks-and-nominations-table-row.pt (+14/-31)
To merge this branch: bzr merge lp:~wallyworld/launchpad/nominations-javascript2-271697
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code Approve
Review via email: mp+127918@code.launchpad.net

Commit message

Fix nominations expanders and layout issues.

Description of the change

The link to open the nominations form for each bugtask row was wired to old, deleted javascript. The new expander infrastructure has been wired in. The new expander uses a little triangle icon so the now obsolete brackets around the link have been wrapped in a hide-on-load span so they only show when javascript is not available.

Also fix a table cell colspan issue.

To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

This markup is incompatible with the expander. The expander *creates* an <a> node and wraps the label node to create the expanding link. The label node is the first node in the "collapsible" parent, and it is already an anchor. Anchors in anchors are invalid and fail in some browsers. You need to change the first node to a span., of but that markup also looks odd because we have a link in the span...

We are being stupid. This markup has been edited so many times over seven years we forgot what is happening.
1. We do not need a link to the form page, the bloody form is rendered inline.
2. The form should not be hidden, the expander adds the hidden css class when js is successful, and we care about hide-on-load
3. We already have a driver permission check in the outer nodes, we don't need checks in the subnodes.
4. the "lesser" css class that makes the small text in a for we expect to use is madness. the small text is for asides you do not need to do important work with. We can remove that.
5. I think we want to tweak the style, or find a class that does the proper alignment and spacing. The current alignment was probably designed for Lp 1.0.
6. Oh the secondary class is not used with tables anymore

This is a replacement template that removes the cruft. http://pastebin.ubuntu.com/1260024/
I would be nice if the form knew it was embedded, but that is really a seperate issue involving formoverlay.

review: Needs Fixing (code)
Revision history for this message
Curtis Hovey (sinzui) wrote :

PS the nomination id is not needed. If a test fails looking for it, it assumes the form was rendered or the JS was hooked up, but that is not the actual case. I would delete any test that checks for the bogus id.

Revision history for this message
Curtis Hovey (sinzui) wrote :

"I would be nice" should be "It would be nice ". I am never nice.

Revision history for this message
Curtis Hovey (sinzui) wrote :

We talked and agree that if you like the layout, my pastebin is okay to land.

review: Approve (code)
Revision history for this message
Ian Booth (wallyworld) wrote :

Thanks for the excellent changes. I have used those, and also added a change of my own. The accept/decline text is not needed for non js browsers since the form is now inline and visible for non js situations.
I also updated a failing doctest.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/stories/bugs/xx-bug-nomination-table-row.txt'
2--- lib/lp/bugs/stories/bugs/xx-bug-nomination-table-row.txt 2011-12-24 17:49:30 +0000
3+++ lib/lp/bugs/stories/bugs/xx-bug-nomination-table-row.txt 2012-10-04 22:36:24 +0000
4@@ -37,12 +37,7 @@
5 >>> user_browser.contents
6 '...Nominated...for...Hoary...by...No Privileges Person...'
7
8-But not the approve/decline link, nor any Approve or Decline buttons.
9-
10- >>> user_browser.getLink("approve/decline")
11- Traceback (most recent call last):
12- ...
13- LinkNotFoundError
14+But not the Approve or Decline buttons.
15
16 >>> user_browser.getControl("Approve")
17 Traceback (most recent call last):
18@@ -67,8 +62,8 @@
19 But if we log in as a user that does have launchpad.Driver permission,
20 we will see the approve/decline links.
21
22-First, when the task is in Proposed state, the (privileged) user sees an
23-approve/decline link.
24+First, when the task is in Proposed state, the (privileged) user sees
25+Approve and Decline buttons.
26
27 >>> login("foo.bar@canonical.com")
28 >>> check_permission("launchpad.Driver", ubuntu_hoary_nomination.target)
29@@ -82,12 +77,6 @@
30 ... "http://launchpad.dev/distros/ubuntu/+source/mozilla-firefox/"
31 ... "+bug/1/nominations/2/+bugtasks-and-nominations-table-row")
32
33- >>> browser.getLink("approve/decline")
34- <Link ...>
35-
36-Clicking the "approve/decline" link causes a simple form to be expanded
37-underneath, with "Approve" and "Decline" buttons.
38-
39 >>> approve_button = browser.getControl("Approve")
40 >>> decline_button = browser.getControl("Decline")
41
42@@ -101,8 +90,7 @@
43 True
44 >>> logout()
45
46-Now only the "Approve" button shows, and the approve/decline link now
47-reads only "approve".
48+Now only the "Approve" button shows.
49
50 >>> browser = setupBrowser("Basic foo.bar@canonical.com:test")
51 >>> browser.open(
52@@ -112,13 +100,6 @@
53 >>> browser.contents
54 '...Declined...for...Hoary...by...Foo Bar...'
55
56- >>> browser.getLink("approve/decline")
57- Traceback (most recent call last):
58- ...
59- LinkNotFoundError
60- >>> browser.getLink("approve")
61- <Link ...>
62-
63 >>> approve_button = browser.getControl("Approve")
64 >>> browser.getControl("Decline")
65 Traceback (most recent call last):
66
67=== modified file 'lib/lp/bugs/templates/bugnomination-tasks-and-nominations-table-row.pt'
68--- lib/lp/bugs/templates/bugnomination-tasks-and-nominations-table-row.pt 2012-03-02 16:24:45 +0000
69+++ lib/lp/bugs/templates/bugnomination-tasks-and-nominations-table-row.pt 2012-10-04 22:36:24 +0000
70@@ -1,38 +1,21 @@
71 <tal:nomination
72 xmlns:tal="http://xml.zope.org/namespaces/tal"
73 tal:define="user_is_driver view/userCanMakeDecisionForNomination;
74- nomination_form_id string:nomination${context/id};
75 nomination_person view/getNominationPerson">
76- <tr class="secondary">
77- <td style="padding: 0.3em 0em 0.3em 1.5em" colspan="4">
78- <span class="lesser">
79- <span tal:content="context/status/title">
80- Nominated
81- </span>
82- for
83- <span tal:content="context/target/name/capitalize">
84- Warty
85- </span>
86- by
87- <a tal:replace="structure nomination_person/fmt:link">
88- Foo Bar
89- </a>
90- </span>
91- <tal:links condition="view/displayNominationEditLinks">
92- <tal:release-management condition="user_is_driver">
93- (<a href="#"
94- tal:content="view/getApproveDeclineLinkText"
95- tal:attributes="onclick string:return toggleFormVisibility('${nomination_form_id}');
96- href view/getNominationEditLink">approve/decline</a>)
97- <div tal:attributes="id nomination_form_id"
98- tal:condition="user_is_driver"
99- class="hidden">
100- <span style="padding-left: 1.5em" tal:content="structure context/@@+edit-form">
101- Approve/Decline
102- </span>
103- </div>
104- </tal:release-management>
105- </tal:links>
106+ <tr>
107+ <td colspan="6">
108+ <div class="subordinate">
109+ <span tal:content="context/status/title">Nominated</span> for
110+ <span tal:content="context/target/name/capitalize">Warty</span>
111+ by <a tal:replace="structure nomination_person/fmt:link">Foo Bar</a>
112+ <tal:no-cve condition="view/displayNominationEditLinks">
113+ <span class="collapsible" tal:condition="user_is_driver">
114+ <span class='hidden' tal:content="view/getApproveDeclineLinkText">approve/decline</span>
115+ <div class="hide-on-load"
116+ tal:content="structure context/@@+edit-form" />
117+ </span>
118+ </tal:no-cve>
119+ </div>
120 </td>
121 </tr>
122 </tal:nomination>