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

Intent to implement: Non-modal dismissable user notifications #902

Closed
cramforce opened this issue Nov 11, 2015 · 8 comments
Closed

Intent to implement: Non-modal dismissable user notifications #902

cramforce opened this issue Nov 11, 2015 · 8 comments
Assignees
Labels
INTENT TO IMPLEMENT Proposes implementation of a significant new feature. https://bit.ly/amp-contribute-code
Milestone

Comments

@cramforce
Copy link
Member

Implement a tag that can be shown conditionally for applicable users and that can be dismissed by users.

Usage

<amp-user-notification 
    layout=nodisplay
    data-dialog-id="some-dialog"
    data-show-if-href="https://external-host.com/show-dialog"
    data-dismiss-href="https://external-host.com/confirm">
   …arbitrary HTML…
   <button on="tap:amp-user-notification.dismiss()">Got it</button>
</amp-user-notification>

Showing the dialog

The new tag amp-user-notification always starts out in layout mode nodisplay (isn’t shown). Upon page load it makes a POST CORS XHR request to the URL given as data-show-if-href. It posts an ExternalCID that is specific for the string given as data-dialog-id as the POST argument “user_id”.

The POST request is expected to return a simple JSON document of the form
{"show_dialog": true}
or
{"show_dialog": false}

In case of the true response AMP switches the <amp-user-notification> tag to have container layout and displays it in a fixed positioned container at position (0, 0) and as wide as the screen.

Closing the dialog

A button or similar tag inside of the notification can be designated with on="tap:amp-user-notification.dismiss()" to dismiss the notification.
If the user taps that button the <amp-user-notification> is again switched to nodisplay mode and AMP makes a POST CORS XHR request to the URL given as data-dismiss-href. It posts an ExternalCID that is specific for the string given as data-dialog-id as the POST argument “user_id”.

The above POST request presents an opportunity for the publisher to store for the given “user_id” as to whether it should return true next time a request to data-show-if-href is made.

@cramforce cramforce added the INTENT TO IMPLEMENT Proposes implementation of a significant new feature. https://bit.ly/amp-contribute-code label Nov 11, 2015
@cramforce
Copy link
Member Author

See #871 for one possible use of this.

@cramforce
Copy link
Member Author

@erwinmombay Assigned you. OK?

@erwinmombay
Copy link
Member

@cramforce 👍

@rudygalfi
Copy link
Contributor

@erwinmombay Trying to get a handle on when various features will land. Any estimate on this one?

@erwinmombay
Copy link
Member

@rudygalfi almost done (thursday or friday at worst), talking to @dvoytenko about some technical details on implementation (since he's also working on some alert stuff). I think he had some concerns on this specific component.

@rudygalfi
Copy link
Contributor

👍 thanks

@ericlindley-g
Copy link
Contributor

@erwinmombay — can this be closed?

@ericlindley-g ericlindley-g added this to the M1 milestone Feb 6, 2016
@erwinmombay
Copy link
Member

@ericlindley-g i think we should be good here since we have issues for the follow ups. anyone feel free to reopen otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
INTENT TO IMPLEMENT Proposes implementation of a significant new feature. https://bit.ly/amp-contribute-code
Projects
None yet
Development

No branches or pull requests

4 participants