Merge ~pappacena/launchpad:bug-oci-project-selector-ui into launchpad:master

Proposed by Thiago F. Pappacena
Status: Rejected
Rejected by: Thiago F. Pappacena
Proposed branch: ~pappacena/launchpad:bug-oci-project-selector-ui
Merge into: launchpad:master
Prerequisite: ~pappacena/launchpad:bug-oci-project-navigation
Diff against target: 109 lines (+55/-12)
4 files modified
lib/lp/app/widgets/launchpadtarget.py (+4/-0)
lib/lp/app/widgets/templates/launchpad-target.pt (+29/-12)
lib/lp/bugs/javascript/bugtask_index.js (+21/-0)
lib/lp/bugs/stories/bugtask-management/xx-bugtask-edit-forms.txt (+1/-0)
Reviewer Review Type Date Requested Status
Launchpad code reviewers Pending
Review via email: mp+394210@code.launchpad.net

Commit message

Hiding the OCI project picker from bugtask UI when possible

To post a comment you must log in.
Revision history for this message
Thiago F. Pappacena (pappacena) wrote :
b84e9ce... by Thiago F. Pappacena

Merge branch 'bugtask-oci-project' into bug-oci-project-navigation

8797613... by Thiago F. Pappacena

Merge branch 'bug-oci-project-navigation' into bug-oci-project-selector-ui

d12cddb... by Thiago F. Pappacena

Merge branch 'bugtask-oci-project' into bug-oci-project-navigation

d4c5f35... by Thiago F. Pappacena

Merge branch 'bug-oci-project-navigation' into bug-oci-project-selector-ui

d4945c1... by Thiago F. Pappacena

Merge branch 'bugtask-oci-project' into bug-oci-project-navigation

d428963... by Thiago F. Pappacena

Merge branch 'bug-oci-project-navigation' into bug-oci-project-selector-ui

Unmerged commits

d428963... by Thiago F. Pappacena

Merge branch 'bug-oci-project-navigation' into bug-oci-project-selector-ui

d4945c1... by Thiago F. Pappacena

Merge branch 'bugtask-oci-project' into bug-oci-project-navigation

d4c5f35... by Thiago F. Pappacena

Merge branch 'bug-oci-project-navigation' into bug-oci-project-selector-ui

d12cddb... by Thiago F. Pappacena

Merge branch 'bugtask-oci-project' into bug-oci-project-navigation

8797613... by Thiago F. Pappacena

Merge branch 'bug-oci-project-navigation' into bug-oci-project-selector-ui

b84e9ce... by Thiago F. Pappacena

Merge branch 'bugtask-oci-project' into bug-oci-project-navigation

a32506e... by Thiago F. Pappacena

Fixing bugtask edit form test

e0e5937... by Thiago F. Pappacena

Hiding the OCI project picker from bugtask UI when possible

dad8a5b... by Thiago F. Pappacena

Merge branch 'bugtask-oci-project' into bug-oci-project-navigation

7e6ce97... by Thiago F. Pappacena

Merge branch 'master' into bug-oci-project-navigation

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/app/widgets/launchpadtarget.py b/lib/lp/app/widgets/launchpadtarget.py
2index 5d75dd0..be8742e 100644
3--- a/lib/lp/app/widgets/launchpadtarget.py
4+++ b/lib/lp/app/widgets/launchpadtarget.py
5@@ -129,6 +129,10 @@ class LaunchpadTargetWidget(BrowserWidget, InputWidget):
6 except UnexpectedFormData:
7 return False
8
9+ @property
10+ def selected_target_type(self):
11+ return self.request.form_ng.getOne(self.name, self.default_option)
12+
13 def getInputValue(self):
14 """See zope.formlib.interfaces.IInputWidget."""
15 self.setUpSubWidgets()
16diff --git a/lib/lp/app/widgets/templates/launchpad-target.pt b/lib/lp/app/widgets/templates/launchpad-target.pt
17index 0d3b6a3..fde9115 100644
18--- a/lib/lp/app/widgets/templates/launchpad-target.pt
19+++ b/lib/lp/app/widgets/templates/launchpad-target.pt
20@@ -36,16 +36,33 @@
21 </td>
22 </tr>
23
24- <tr>
25- <td>
26- <label>
27- <input type="radio" value="ociproject"
28- tal:replace="structure view/options/ociproject" />
29- OCI project
30- </label>
31- </td>
32- <td>
33- <tal:product tal:replace="structure view/ociproject_widget" />
34- </td>
35- </tr>
36+ <tal:comment replace="nothing">
37+ In this section, we have more "advanced" target types (for now, only OCI
38+ projects).
39+ The general idea is to hide them for not-so-advanced users, but we need
40+ to automatically expand it in case one of the hidden options is selected.
41+ </tal:comment>
42+ <tal:more-targets
43+ define="expanded python: view.selected_target_type == 'ociproject'">
44+ <tr tal:attributes="class python: 'hidden' if expanded else ''">
45+ <td colspan="2" style="width: 100%; text-align: right">
46+ <a class="moretargets-expander" href="#"
47+ style="text-style: italic; font-size: 95%">more targets...</a>
48+ </td>
49+ </tr>
50+
51+ <tr tal:attributes="class python: ('moretargets-collapsible-content' +
52+ ('hidden' if expanded else ''))">
53+ <td>
54+ <label>
55+ <input type="radio" value="ociproject"
56+ tal:replace="structure view/options/ociproject" />
57+ OCI project
58+ </label>
59+ </td>
60+ <td>
61+ <tal:product tal:replace="structure view/ociproject_widget" />
62+ </td>
63+ </tr>
64+ </tal:more-targets>
65 </table>
66diff --git a/lib/lp/bugs/javascript/bugtask_index.js b/lib/lp/bugs/javascript/bugtask_index.js
67index ef0324b..4df24c7 100644
68--- a/lib/lp/bugs/javascript/bugtask_index.js
69+++ b/lib/lp/bugs/javascript/bugtask_index.js
70@@ -795,6 +795,27 @@ namespace.setup_bugtask_row = function(conf) {
71 icon_node, row_node, { animate_node: content_node });
72 expander.setUp();
73 }
74+
75+ // Set-up expander on "more targets" link.
76+ // We have this here to hide extra complexities from the end user, so they
77+ // don't get confused with options that are not obvious to everyone (like
78+ // OCI projects).
79+ icon_node = Y.one(
80+ 'tr#' + conf.form_row_id + ' a.moretargets-expander');
81+ row_node = Y.one(
82+ 'tr#' + conf.form_row_id + ' .moretargets-collapsible-content');
83+ content_node = row_node;
84+ expander = new Y.lp.app.widgets.expander.Expander(
85+ icon_node, row_node, { no_animation: true });
86+ // Do not add arrow icon automatically. This link should be small and
87+ // discrete.
88+ expander.setIcon = function() {};
89+ // Hides the original link.
90+ // If we have more targets than just OCI project to hide, it might worth
91+ // keeping the link to collapse/expand. But with only one extra option, it
92+ // makes no sense to hide the element again.
93+ expander.setExpanded = function() { icon_node.addClass('hidden'); };
94+ expander.setUp();
95 };
96
97 /**
98diff --git a/lib/lp/bugs/stories/bugtask-management/xx-bugtask-edit-forms.txt b/lib/lp/bugs/stories/bugtask-management/xx-bugtask-edit-forms.txt
99index f4abae5..058685d 100644
100--- a/lib/lp/bugs/stories/bugtask-management/xx-bugtask-edit-forms.txt
101+++ b/lib/lp/bugs/stories/bugtask-management/xx-bugtask-edit-forms.txt
102@@ -49,6 +49,7 @@ respective bug task.
103 Distribution
104 ...
105 Project (Find…)
106+ more targets...
107 OCI project (Find...)
108 Status Importance Milestone
109 New... Low... (nothing selected)...