-
Notifications
You must be signed in to change notification settings - Fork 126
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
Flash fixture documentation is incorrect #912
Comments
I also noticed some issues with the documentation of the Flash fixture, but ist is not clear to me where exactly are the causes. |
Based on what the _scaffold app is doing nowadays, it should actually be
something like this (which works fine, BTW):
<div>
<!-- Flash alert messages, first optional one in data-alert -->
<flash-alerts class="padded" data-alert="[[=globals().get('flash','')]]"></
flash-alerts>
</div>
which is completely not what is in the documentation.
Cheers,
Krzysztof.
…On Wed, 21 Aug 2024 at 23:51, Andreas Chizzali ***@***.***> wrote:
I also noticed some issues with the documentation of the Flash fixture,
but ist is not clear to me where exactly are the causes.
The function utils.flash(), seems to me, will be built after loading the
sctipt utils.js.
Towards the end of utils.js there is the line
Q.handle_flash();
if a flash request was found (elem), this function defines Q.flash:
Q.flash = function(detail) {elem.dispatchEvent(new CustomEvent('flash',
{detail: detail}));};
then this function is evaluated and i think an event 'flash' is defined.
Possibly utils.flash executes the event. I'm not shure about, my knowledge
of js is limited.
I also noticed, that the two flash examples in showcase are working.
In flash.example.html the template uses Q.flash(). The generic template
layout.html uses a custom element flash_alerts (not alerts-flash) with a
data-Attribute data-alert.
There are two diffrent mechanisms, only in case of a redirect the flash is
stored in the cookie.
Lately I was in vacation, so I did not complete my analisys of the issue.
I also found other ways to get my flash messages, even if not in the
canonical way. I tried something, but did not succed with the methods of
the examples in showcase, when the actions are a little different.
Perheaps someone more experienced has a clue.
—
Reply to this email directly, view it on GitHub
<#912 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABV27XX76EEROWYRBN4LFADZSUDWFAVCNFSM6AAAAABM36YEGWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBTGA3TCMRRGY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
😩
On Fri, Aug 23, 2024, 10:25 Krzysztof Socha ***@***.***>
wrote:
… Based on what the _scaffold app is doing nowadays, it should actually be
something like this (which works fine, BTW):
<div>
<!-- Flash alert messages, first optional one in data-alert -->
<flash-alerts class="padded"
data-alert="[[=globals().get('flash','')]]"></
flash-alerts>
</div>
which is completely not what is in the documentation.
Cheers,
Krzysztof.
On Wed, 21 Aug 2024 at 23:51, Andreas Chizzali ***@***.***>
wrote:
> I also noticed some issues with the documentation of the Flash fixture,
> but ist is not clear to me where exactly are the causes.
> The function utils.flash(), seems to me, will be built after loading the
> sctipt utils.js.
> Towards the end of utils.js there is the line
> Q.handle_flash();
> if a flash request was found (elem), this function defines Q.flash:
> Q.flash = function(detail) {elem.dispatchEvent(new CustomEvent('flash',
> {detail: detail}));};
> then this function is evaluated and i think an event 'flash' is defined.
> Possibly utils.flash executes the event. I'm not shure about, my
knowledge
> of js is limited.
> I also noticed, that the two flash examples in showcase are working.
> In flash.example.html the template uses Q.flash(). The generic template
> layout.html uses a custom element flash_alerts (not alerts-flash) with a
> data-Attribute data-alert.
> There are two diffrent mechanisms, only in case of a redirect the flash
is
> stored in the cookie.
> Lately I was in vacation, so I did not complete my analisys of the
issue.
> I also found other ways to get my flash messages, even if not in the
> canonical way. I tried something, but did not succed with the methods of
> the examples in showcase, when the actions are a little different.
> Perheaps someone more experienced has a clue.
>
> —
> Reply to this email directly, view it on GitHub
> <#912 (comment)>,
or
> unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/ABV27XX76EEROWYRBN4LFADZSUDWFAVCNFSM6AAAAABM36YEGWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBTGA3TCMRRGY>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
—
Reply to this email directly, view it on GitHub
<#912 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHLZT2RPNJHSCN2ZCUG6P3ZS3WXNAVCNFSM6AAAAABM36YEGWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBWGU3DQMJQG4>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Updated fash fixture doc to actual behavior as web2py#912
Thank you, |
Updated docs including working js example: #914 |
The example works for me only for server flash messages.
there is no trace of an |
* Update Flash Fixture doc Updated fash fixture doc to actual behavior as #912 * Flash fixtures docs Working example from python and js
Thanks for fixing this! |
It seems that the documentation for the Flash fixture is lagging behind the actual code...
The documentation (https://py4web.com/_documentation/static/en/chapter-06.html#the-flash-fixture) gives an example that generally does not seem to work with the current version of
utils.js
.It suggests setting up a
<div id="py4web-flash"></div>
while the script seems to be looking for something withid="alerts-flash"
. Also there does not seem to be autils.flash()
function that I could actually find...It would be useful to update the documentation to match the code.
The text was updated successfully, but these errors were encountered: