Merge lp:~jcsackett/launchpad/no-write-sharing-lies into lp:launchpad

Proposed by j.c.sackett
Status: Merged
Approved by: Curtis Hovey
Approved revision: no longer in the source branch.
Merged at revision: 15785
Proposed branch: lp:~jcsackett/launchpad/no-write-sharing-lies
Merge into: lp:launchpad
Diff against target: 50 lines (+16/-1)
3 files modified
lib/canonical/launchpad/icing/css/forms.css (+6/-0)
lib/lp/app/javascript/choiceedit/choiceedit.js (+4/-0)
lib/lp/app/javascript/choiceedit/tests/test_choiceedit.js (+6/-1)
To merge this branch: bzr merge lp:~jcsackett/launchpad/no-write-sharing-lies
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code Approve
Review via email: mp+118800@code.launchpad.net

Commit message

Sets correct css on choicesource html when clickable_content is false, so the content is not styled as clickable.

Description of the change

Summary
=======
We can make +sharing read-only via flags, but the choicesource remains a
clickable item -- it sets the cursor and text-decoration as a link, but
doesn't do anything when clicked.

ChoiceSource has a clickable_content attribute--when false, the content
should not be styled as though it is clickable.

Preimp
======
Spoke with Curtis Hovey.

Implementation
==============
A new css class for the choicesource is added -- no-click. It's not named
yui3-choicesource-no-click b/c we might want to use this same css elsewhere.
It sets cursor to default and text decoration to none on hover.

On init in choicesource, if clickable_content is false, no-click is added to
the contentBox's classes.

Tests
=====
bin/test -t choiceedit --layer=YUI

QA
==
Make sure that the choicesources on +sharing aren't clickable when the
writable flag is off.

LoC
===
This is part of disclosure.

Lint
====

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/canonical/launchpad/icing/css/forms.css
  lib/lp/app/javascript/choiceedit/choiceedit.js
  lib/lp/app/javascript/choiceedit/tests/test_choiceedit.js

./lib/canonical/launchpad/icing/css/forms.css
< ... snip ... >

There are a bunch of errors in forms.css, but it's not a file I want to
reformat. I assume if every line lints wrongly the same way, there's a reason.

To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

I don't think this branch is complete. As a driver of a project, I can see who the project shares with, but I cannot edit.

I see this in lib/lp/registry/javascript/sharing/granteetable.js at line 244:
        var clickable_content = this.get('write_enabled');
        var permission_edit = new Y.ChoiceSource({
            clickable_content: clickable_content,

I think a drivers will see the clickable content even though they do not have the permission to make a change.
/me checks
Well I think I found another bug. As a driver, I cannot see the +sharing link or access the page :( This undermines a lot of Canonical projects.

review: Needs Information (code)
Revision history for this message
j.c.sackett (jcsackett) wrote :

As discussed on IRC, the clickable_content is simply what's inside the choice source--the content is always rendered, and *should* be. The only thing being altered by that var is whether or not the rendered content should behave as clickable.

Previously, all that meant was whether or not clicking brought up the ChoiceList--with this branch it means that said content doesn't behave as a link--text-decoration stays None and cursor stays Default.

The drivers issue is, as discussed on IRC, a separate bug.

Revision history for this message
Curtis Hovey (sinzui) wrote :

Thank you for explaining the situation to me. I think this is good to land.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/icing/css/forms.css'
2--- lib/canonical/launchpad/icing/css/forms.css 2012-07-31 08:29:31 +0000
3+++ lib/canonical/launchpad/icing/css/forms.css 2012-08-08 17:18:30 +0000
4@@ -264,6 +264,12 @@
5 text-decoration: underline;
6 cursor: pointer;
7 }
8+
9+.no-click:hover {
10+ text-decoration: none !important;
11+ cursor: default !important;
12+ }
13+
14 .yui3-buglisting-config-util a {
15 position: relative;
16 top: 3px;
17
18=== modified file 'lib/lp/app/javascript/choiceedit/choiceedit.js'
19--- lib/lp/app/javascript/choiceedit/choiceedit.js 2012-06-29 19:36:57 +0000
20+++ lib/lp/app/javascript/choiceedit/choiceedit.js 2012-08-08 17:18:30 +0000
21@@ -171,6 +171,10 @@
22 * @preventable _saveData
23 */
24 this.publish(SAVE);
25+ if (!this.get('clickable_content')) {
26+ var content = this.get('contentBox');
27+ content.addClass('no-click');
28+ };
29 },
30
31 /**
32
33=== modified file 'lib/lp/app/javascript/choiceedit/tests/test_choiceedit.js'
34--- lib/lp/app/javascript/choiceedit/tests/test_choiceedit.js 2012-06-15 18:35:20 +0000
35+++ lib/lp/app/javascript/choiceedit/tests/test_choiceedit.js 2012-08-08 17:18:30 +0000
36@@ -331,8 +331,13 @@
37 "ChoiceList object is not being created");
38 Assert.isNotNull(Y.one(document).one(".yui3-ichoicelist"),
39 "ChoiceList HTML is not being added to the page");
40+ },
41+
42+ test_choicesource_has_no_click: function () {
43+ var contentBox = this.choice_edit.get('contentBox');
44+ Assert.isTrue(contentBox.hasClass('no-click'),
45+ "no-click not applied to choicelist html.");
46 }
47-
48 }));
49
50 /**