Merge lp:~wgrant/launchpad/sharing-icon-fix into lp:launchpad

Proposed by William Grant
Status: Merged
Approved by: Steve Kowalik
Approved revision: no longer in the source branch.
Merged at revision: 16576
Proposed branch: lp:~wgrant/launchpad/sharing-icon-fix
Merge into: lp:launchpad
Diff against target: 65 lines (+19/-5)
3 files modified
Makefile (+2/-2)
lib/lp/registry/javascript/sharing/granteetable.js (+2/-3)
lib/lp/registry/javascript/sharing/tests/test_granteetable.js (+15/-0)
To merge this branch: bzr merge lp:~wgrant/launchpad/sharing-icon-fix
Reviewer Review Type Date Requested Status
Steve Kowalik (community) code Approve
Review via email: mp+159751@code.launchpad.net

Commit message

Fix +sharing permission picker creation to unhide the right edit icon.

Description of the change

The grantee table JS on +sharing was always unhiding the first edit icon in each row, even when activating a permission other than the first. Fix it to always show the right one.

I also fixed jsbuild to rebuild the LP JS without having to clean first.

To post a comment you must log in.
Revision history for this message
Steve Kowalik (stevenk) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Makefile'
--- Makefile 2013-04-18 04:33:16 +0000
+++ Makefile 2013-04-19 06:14:27 +0000
@@ -173,7 +173,7 @@
173 ln -sfn $(YUI_DEFAULT) $@173 ln -sfn $(YUI_DEFAULT) $@
174174
175$(LP_JS_BUILD): | $(JS_BUILD_DIR)175$(LP_JS_BUILD): | $(JS_BUILD_DIR)
176 mkdir $@176 -mkdir $@
177 for jsdir in lib/lp/*/javascript; do \177 for jsdir in lib/lp/*/javascript; do \
178 app=$$(echo $$jsdir | sed -e 's,lib/lp/\(.*\)/javascript,\1,'); \178 app=$$(echo $$jsdir | sed -e 's,lib/lp/\(.*\)/javascript,\1,'); \
179 cp -a $$jsdir $@/$$app; \179 cp -a $$jsdir $@/$$app; \
@@ -489,4 +489,4 @@
489 launchpad.pot pagetests pull_branches pydoctor realclean \489 launchpad.pot pagetests pull_branches pydoctor realclean \
490 reload-apache run run-testapp runner scan_branches schema \490 reload-apache run run-testapp runner scan_branches schema \
491 sprite_css sprite_image start stop sync_branches TAGS tags \491 sprite_css sprite_image start stop sync_branches TAGS tags \
492 test_build test_inplace zcmldocs492 test_build test_inplace zcmldocs $(LP_JS_BUILD)
493493
=== modified file 'lib/lp/registry/javascript/sharing/granteetable.js'
--- lib/lp/registry/javascript/sharing/granteetable.js 2013-04-09 05:05:39 +0000
+++ lib/lp/registry/javascript/sharing/granteetable.js 2013-04-19 06:14:27 +0000
@@ -245,12 +245,11 @@
245245
246 var id = 'permission-'+grantee.name;246 var id = 'permission-'+grantee.name;
247 var grantee_row = this.get('grantee_table').one('[id="' + id + '"]');247 var grantee_row = this.get('grantee_table').one('[id="' + id + '"]');
248 var permission_node = grantee_row.one('[id="td-' + id + '"]');248 var contentBox = grantee_row.one(
249 var contentBox = permission_node.one(
250 '[id="' + policy + '-' + id + '"]');249 '[id="' + policy + '-' + id + '"]');
251 var value_location = contentBox.one('.value');250 var value_location = contentBox.one('.value');
252 var editable = LP.cache.has_edit_permission;251 var editable = LP.cache.has_edit_permission;
253 var editicon = permission_node.one('a.editicon');252 var editicon = contentBox.one('a.editicon');
254 if (editable) {253 if (editable) {
255 editicon.removeClass('hidden');254 editicon.removeClass('hidden');
256 }255 }
257256
=== modified file 'lib/lp/registry/javascript/sharing/tests/test_granteetable.js'
--- lib/lp/registry/javascript/sharing/tests/test_granteetable.js 2013-03-20 03:41:40 +0000
+++ lib/lp/registry/javascript/sharing/tests/test_granteetable.js 2013-04-19 06:14:27 +0000
@@ -84,8 +84,23 @@
84 "Grantee table failed to be instantiated");84 "Grantee table failed to be instantiated");
85 },85 },
8686
87 // Write mode unhides the edit icons.
88 test_writable: function() {
89 window.LP.cache.has_edit_permission = true;
90 this.grantee_table = this._create_Widget({
91 write_enabled: true
92 });
93 this.grantee_table.render();
94 Y.all('#grantee-table ' +
95 '.sprite.add, .sprite.edit, .sprite.remove a')
96 .each(function(link) {
97 Y.Assert.isFalse(link.hasClass('hidden'));
98 });
99 },
100
87 // Read only mode disables the correct things.101 // Read only mode disables the correct things.
88 test_readonly: function() {102 test_readonly: function() {
103 window.LP.cache.has_edit_permission = true;
89 this.grantee_table = this._create_Widget({104 this.grantee_table = this._create_Widget({
90 write_enabled: false105 write_enabled: false
91 });106 });