Merge ~deadlight/maas:tooltips into ~deadlight/maas:vanilla

Proposed by Karl Williams
Status: Merged
Approved by: Karl Williams
Approved revision: e4df155cf46cbda41754c25a3b2202f726d0f678
Merged at revision: 78ad173aafe2e3ed85e6a0c964dde28938570224
Proposed branch: ~deadlight/maas:tooltips
Merge into: ~deadlight/maas:vanilla
Diff against target: 51 lines (+18/-17)
1 file modified
src/maasserver/static/js/angular/directives/maas_obj_form.js (+18/-17)
Reviewer Review Type Date Requested Status
Anthony Dillon (community) Approve
Review via email: mp+337277@code.launchpad.net

Description of the change

Updated form generation to use the new style tooltips.

QA:
Check that tooltips are present and working:
  - Subnet details summary (select Edit and see the tooltips)
  - Dashboard:
     - Next to the discovery switch
     - Open a row and see the tooltip next to the "parent" and "device name" fields

To post a comment you must log in.
Revision history for this message
Anthony Dillon (ya-bo-ng) wrote :

Looks and works

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/maasserver/static/js/angular/directives/maas_obj_form.js b/src/maasserver/static/js/angular/directives/maas_obj_form.js
2index 679b8ef..e8a935b 100644
3--- a/src/maasserver/static/js/angular/directives/maas_obj_form.js
4+++ b/src/maasserver/static/js/angular/directives/maas_obj_form.js
5@@ -578,28 +578,29 @@ angular.module('MAAS').directive('maasObjField', ['$compile',
6 element.append(labelElement);
7
8 // Add a label info icon with tooltip.
9- if(angular.isString(attrs.labelInfo)
10- && attrs.labelInfo.length > 0) {
11- var infoElement = angular.element('<i/>');
12- infoElement.addClass('icon');
13- infoElement.addClass('p-icon--information');
14- infoElement.addClass('tooltip tooltip--left');
15- infoElement.addClass('u-margin--left-tiny');
16- if(attrs.labelLeft === "true") {
17- infoElement.addClass('icon--left');
18- infoElement.removeClass('u-margin--left-tiny');
19- }
20- infoElement.attr('aria-label', attrs.labelInfo);
21- labelElement.text(labelElement.text() + ' ');
22- labelElement.append(infoElement);
23+ if(angular.isString(attrs.labelInfo) && attrs.labelInfo.length > 0) {
24+ var infoWrapper = angular.element('<span>&nbsp;</span>');
25+ infoWrapper.addClass('p-tooltip p-tooltip--btm-right');
26+
27+ var infoIcon = angular.element('<i/>');
28+ infoIcon.addClass('p-icon--information');
29+ infoIcon.attr('aria-describedby', attrs.key + '-tooptip');
30+
31+ var infoTooltip = angular.element('<p></p>');
32+ infoTooltip.addClass('p-tooltip__message');
33+ infoTooltip.text(attrs.labelInfo);
34+ infoTooltip.attr('id', attrs.key + '-tooptip');
35+
36+ infoWrapper.append(infoIcon);
37+ infoWrapper.append(infoTooltip);
38+
39+ labelElement.append(infoWrapper);
40
41 // prevents the icon from being clickable
42- infoElement.bind('click', function (evt) {
43+ infoIcon.bind('click', function (evt) {
44 evt.preventDefault();
45 });
46 }
47-
48-
49 }
50
51 // Add the wrapper for the input.

Subscribers

People subscribed via source and target branches

to all changes: