← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wallyworld/launchpad/css-fix-empty-sharing-table into lp:launchpad

 

Ian Booth has proposed merging lp:~wallyworld/launchpad/css-fix-empty-sharing-table into lp:launchpad.

Requested reviews:
  William Grant (wgrant)

For more details, see:
https://code.launchpad.net/~wallyworld/launchpad/css-fix-empty-sharing-table/+merge/122983

2 issues:

1. The sharing page displays some text if there are no grantees. The text contains the pillar name. This was unescaped.
2. The choice source popup displayed unescaped text in the header. For sharing, this text contains the grantee name.

The above have been fixed.
-- 
https://code.launchpad.net/~wallyworld/launchpad/css-fix-empty-sharing-table/+merge/122983
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/app/javascript/choiceedit/choiceedit.js'
--- lib/lp/app/javascript/choiceedit/choiceedit.js	2012-08-23 18:58:50 +0000
+++ lib/lp/app/javascript/choiceedit/choiceedit.js	2012-09-06 01:47:20 +0000
@@ -467,7 +467,9 @@
           node: this.get("value_location"),
           points:[Y.WidgetPositionAlign.TL, Y.WidgetPositionAlign.TL]
         });
-        this.set("headerContent", "<h2>" + this.get("title") + "</h2>");
+        this.set(
+            'headerContent',
+            Y.Node.create("<h2></h2>").set('text', this.get("title")));
         this.set("display_items_list", Y.Node.create("<ul>"));
         var display_items_list = this.get("display_items_list");
         var items = this.get("items");

=== modified file 'lib/lp/registry/javascript/sharing/granteetable.js'
--- lib/lp/registry/javascript/sharing/granteetable.js	2012-09-05 06:48:36 +0000
+++ lib/lp/registry/javascript/sharing/granteetable.js	2012-09-06 01:47:20 +0000
@@ -69,6 +69,10 @@
     grantee_row_template: {
         value: null
     },
+    // The node to display if there are no grantees.
+    grantee_table_empty_row: {
+        value: null
+    },
     // The handlebars template for the each access policy item.
     grantee_policy_template: {
         value: null
@@ -198,14 +202,15 @@
     },
 
     _grantee_table_empty_row: function() {
-        var row_template = [
-            '<tr id="grantee-table-not-shared">',
-            '<td colspan="5" style="padding-left: 0.25em">',
-            '{pillar_name}\'s private information is not shared with ',
-            'anyone.',
-            '</td></tr>'].join('');
-        return Y.Lang.sub(
-                row_template, {pillar_name: this.get('pillar_name')});
+        var row = Y.Node.create('<tr id="grantee-table-not-shared"></tr>');
+        var cell = Y.Node.create(
+            '<td colspan="5" style="padding-left: 0.25em"></td>')
+            .set(
+                'text',
+                this.get('pillar_name') +
+                '\'s private information is not shared with anyone.');
+        row.appendChild(cell);
+        return row;
     },
 
     _grantee_policy_template: function() {
@@ -310,7 +315,7 @@
         var table_node = Y.Node.create(html);
         if (grantees.length === 0) {
             table_node.one('tbody').appendChild(
-                Y.Node.create(this.get('grantee_table_empty_row')));
+                this.get('grantee_table_empty_row'));
         }
         grantee_table.replace(table_node);
         this.render_sharing_info(grantees);
@@ -522,8 +527,7 @@
         var delete_rows = function() {
             rows_to_delete.remove(true);
             if (all_rows_deleted === true) {
-                var empty_table_row = Y.Node.create(
-                    that.get('grantee_table_empty_row'));
+                var empty_table_row = that.get('grantee_table_empty_row');
                 grantee_table.one('tbody')
                     .appendChild(empty_table_row);
             }


Follow ups