Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to add code to dismiss notification bar #3379

Closed
nlhkabu opened this issue Mar 23, 2018 · 3 comments
Closed

Document how to add code to dismiss notification bar #3379

nlhkabu opened this issue Mar 23, 2018 · 3 comments
Labels
documentation good first issue This issue is ideal for first-time contributors!

Comments

@nlhkabu
Copy link
Contributor

nlhkabu commented Mar 23, 2018

We should add some help text at the top of static/sass/blocks/_notification-bar.scss to explain how to make a notification bar dismissible.


Good First Issue: This issue is good for first time contributors. If you've already contributed to Warehouse, please work on another issue without this label instead. If there is not a corresponding pull request for this issue, it is up for grabs. For directions for getting set up, see our Getting Started Guide. If you are working on this issue and have questions, please feel free to ask them here, #pypa-dev on Freenode, or the pypa-dev mailing list.

@nlhkabu nlhkabu added good first issue This issue is ideal for first-time contributors! documentation labels Mar 23, 2018
@pgadige
Copy link
Contributor

pgadige commented Mar 26, 2018

I'd like to work on this, @nlhkabu. I'll appreciate some insight on what qualifies as help text.

What should we provide to the reader of static/sass/blocks/_notification-bar.scss file as help text?

Should we explain adding .notification-bar--dismissable and .notification-bar--visible to the div tag that's used to make notification bar together with a button with .notification-bar__dismiss to click on to dismiss/close the notification bar?

@brainwane brainwane added this to the Cool but not urgent milestone Mar 27, 2018
@nlhkabu
Copy link
Contributor Author

nlhkabu commented Mar 27, 2018

@aalmazan would you be able to give @pgadige some direction on how best to document this? Thanks :)

@aalmazan
Copy link
Contributor

Hi @pgadige,

I'm not sure how much detail you need, but since it's not particularly a big feature, I'll describe most of the workflow.

To make a notification dismissable one would need to add the following to the main notification-bar div:

  • .notification-bar-dismissable to its classes
  • data-controller="notification" and,
  • data-target="notification.notification" as attributes

The data-controller and data-target attributes are used by warehouse/static/js/warehouse/controllers/notification_controller.js to handle visibility -- this includes adding .notification-bar--visible to the notification if it has not been dismissed (and persisted) yet.

Also, note that if Javascript is disabled the styles in warehouse/static/sass/noscript.scss will be used instead. This mainly defaults notifications to always be visible.

Let me know if you need anything else!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation good first issue This issue is ideal for first-time contributors!
Projects
None yet
Development

No branches or pull requests

4 participants