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
1=== modified file 'Makefile'
2--- Makefile 2013-04-18 04:33:16 +0000
3+++ Makefile 2013-04-19 06:14:27 +0000
4@@ -173,7 +173,7 @@
5 ln -sfn $(YUI_DEFAULT) $@
6
7 $(LP_JS_BUILD): | $(JS_BUILD_DIR)
8- mkdir $@
9+ -mkdir $@
10 for jsdir in lib/lp/*/javascript; do \
11 app=$$(echo $$jsdir | sed -e 's,lib/lp/\(.*\)/javascript,\1,'); \
12 cp -a $$jsdir $@/$$app; \
13@@ -489,4 +489,4 @@
14 launchpad.pot pagetests pull_branches pydoctor realclean \
15 reload-apache run run-testapp runner scan_branches schema \
16 sprite_css sprite_image start stop sync_branches TAGS tags \
17- test_build test_inplace zcmldocs
18+ test_build test_inplace zcmldocs $(LP_JS_BUILD)
19
20=== modified file 'lib/lp/registry/javascript/sharing/granteetable.js'
21--- lib/lp/registry/javascript/sharing/granteetable.js 2013-04-09 05:05:39 +0000
22+++ lib/lp/registry/javascript/sharing/granteetable.js 2013-04-19 06:14:27 +0000
23@@ -245,12 +245,11 @@
24
25 var id = 'permission-'+grantee.name;
26 var grantee_row = this.get('grantee_table').one('[id="' + id + '"]');
27- var permission_node = grantee_row.one('[id="td-' + id + '"]');
28- var contentBox = permission_node.one(
29+ var contentBox = grantee_row.one(
30 '[id="' + policy + '-' + id + '"]');
31 var value_location = contentBox.one('.value');
32 var editable = LP.cache.has_edit_permission;
33- var editicon = permission_node.one('a.editicon');
34+ var editicon = contentBox.one('a.editicon');
35 if (editable) {
36 editicon.removeClass('hidden');
37 }
38
39=== modified file 'lib/lp/registry/javascript/sharing/tests/test_granteetable.js'
40--- lib/lp/registry/javascript/sharing/tests/test_granteetable.js 2013-03-20 03:41:40 +0000
41+++ lib/lp/registry/javascript/sharing/tests/test_granteetable.js 2013-04-19 06:14:27 +0000
42@@ -84,8 +84,23 @@
43 "Grantee table failed to be instantiated");
44 },
45
46+ // Write mode unhides the edit icons.
47+ test_writable: function() {
48+ window.LP.cache.has_edit_permission = true;
49+ this.grantee_table = this._create_Widget({
50+ write_enabled: true
51+ });
52+ this.grantee_table.render();
53+ Y.all('#grantee-table ' +
54+ '.sprite.add, .sprite.edit, .sprite.remove a')
55+ .each(function(link) {
56+ Y.Assert.isFalse(link.hasClass('hidden'));
57+ });
58+ },
59+
60 // Read only mode disables the correct things.
61 test_readonly: function() {
62+ window.LP.cache.has_edit_permission = true;
63 this.grantee_table = this._create_Widget({
64 write_enabled: false
65 });