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

Date and Datetime fields do not work for anonymous #203

Open
pbauer opened this issue Feb 3, 2020 · 36 comments
Open

Date and Datetime fields do not work for anonymous #203

pbauer opened this issue Feb 3, 2020 · 36 comments

Comments

@pbauer
Copy link
Member

pbauer commented Feb 3, 2020

The pickadate-pattern is only part of the of the bundles plone-editor-tools and plone-tinymce which are only available for logged-in users.
Is there a way to work around this?

@tkimnguyen
Copy link
Member

Copy them into the add-on?

@pbauer
Copy link
Member Author

pbauer commented Feb 4, 2020

Copy what into the addon? The bundle, the pattern or only the registration?

@thet
Copy link
Member

thet commented Feb 5, 2020

May we should peel out the pickadate pattern from plone-editor-tools and make it available as a seperate bundle? That's to be done in plone.staticresources.
Then collective.easyform could just enable that bundle via the registry.
/cc @agitator

@agitator
Copy link
Member

agitator commented Feb 5, 2020

I'm open for further splitting of bundles @pbauer remind me at the sprint ;-)
But please no generic auto-enable from easyform ...

@tkimnguyen
Copy link
Member

Copy what into the addon? The bundle, the pattern or only the registration?

I meant the pattern, but @thet ‘s idea is much better

@tkimnguyen
Copy link
Member

tkimnguyen commented Feb 5, 2020

Actually, if the pattern isn’t heavy, why not move it into the non logged in bundle?

@agitator
Copy link
Member

agitator commented Feb 5, 2020

one can always extend the condition for the bundle to something like python: member is not None or context.portal_type in ('EasyForm')

Depending on the usecase putting "everything" into a bundle doesn't make sense because it adds unnecessary load and therefore slows down the experience. We did that wrong with Plone for too long!

@tkimnguyen
Copy link
Member

Is it ok to mention a non core content type? That dredges up the question: why not include EasyForm in Plone buildout.cfg but commented out, as used to be the case with PloneFormGen (maybe in the unified installer)

@davide-targa
Copy link
Contributor

Maybe I misunderstood the issue (is it a datepicker problem?) but I just tried on a clean Plone 5.2 buildout with Python 3.7.3: Date and Datetime fields work as expected.

@thet
Copy link
Member

thet commented Feb 6, 2020

@davide-targa
Copy link
Contributor

@thet I was not logged-in.

@davide-targa
Copy link
Contributor

davide-targa commented Feb 6, 2020

Check out this public test form for exmple: https://bit.ly/2vOBRGb
I have no issue filling the Date and DateTime fields.

Plone 5.2.0 (5207)
CMF 2.4.0
Zope 4.1.1
Python 3.7.3 (default, Apr 3 2019, 05:39:12) [GCC 8.3.0]
PIL 6.1.0 (Pillow)
WSGI: On
Server: waitress 1.3.0

@pbauer
Copy link
Member Author

pbauer commented Feb 7, 2020

@davide-targa That's weird. Can you try to do the same for 5.2.1? Maybe it it still worked in 5.2.0.

@thet
Copy link
Member

thet commented Feb 7, 2020

@pbauer @davide-targa yes, 5.2.0 is probably the reason why it's working for you. We did the bundle-splitting @ ploneconf in Ferrara, where 5.2.0 was out since some months: plone/plone.staticresources#46

... not the best semantic versioning scheme for cmfplone here ;)

@pbauer
Copy link
Member Author

pbauer commented Feb 7, 2020

I just confirmed this. In Plone 5.2 the date and datetime fields still work for anonymous users. After upgrading to 5.2.1 they stop working.
I can also confirm that you can work around that by changing the condition of the bundle plone-logged-in in /@@resourceregistry-controlpanel to python: member is not None or context.portal_type in ('EasyForm')

@davide-targa
Copy link
Contributor

davide-targa commented Feb 7, 2020

@thet @pbauer I confirm that in Plone 5.2.1 Date and DateTime fields don't work for anonymous users. Sorry for the noise.

@mactrash
Copy link

+1 same issue

@parruc
Copy link

parruc commented Aug 25, 2020

We had this issue and solved it extending (in our own product ATM) the existing easyform bundle as follows:

  • adding a js that requires mockup-patterns-pickadate
  • adding a less that requires pattern.pickadate.less

If this other solution can work for collective.easyform too we would be happy to create a pull request.

@agitator
Copy link
Member

agitator commented Aug 25, 2020

@parruc have you tried changing the condition for the bundle to check on EasyForm as well?

If you want to help other users, you could create a separate bundle for the datepicker in staticresources and extend it's condition in the profile.xml of the EasyForm. So no need to include the datepicker bundle in Easyform as well.

@parruc
Copy link

parruc commented Aug 25, 2020

We did not need to change the condition because we included the mockup-patterns-pickadate needed by EasyForm into the easyform bundle along with other js and css we needed.

If the idea here is to move datepicker to its own bundle inside staticresources it makes absolutly sense and I will gladly share the minimal code to do it as soon as possible.

@agitator
Copy link
Member

At least it would allow the datepicker to be enabled through the resource registry without loading the whole logged-in-bundle.
As we did that for datatables https://github.com/plone/plone.staticresources/blob/master/src/plone/staticresources/static/plone-datatables.js

@thet what do you think?

@parruc
Copy link

parruc commented Aug 26, 2020

In the meantime I opened a ticket in plone.staticresources: plone/plone.staticresources#96 given that the needed changes are to be done there, ok?

@vanne
Copy link

vanne commented Dec 23, 2020

It's not only date/time fields/pickers that are not working.
All other JS that validates fields on blur is also missing.

For instance logged in users see a "Required input is missing." (when blurring a mandatory field, leaving it empty) while logged out users see nothing.

@mactrash
Copy link

mactrash commented Mar 2, 2021

Just test clean install Plone 5.2.3 the date/time fields/pickers that are not working.

@mactrash
Copy link

mactrash commented Mar 2, 2021

Also test clean install Plone 5.2.4rc the date/time fields/pickers that are not working.

@mactrash
Copy link

mactrash commented Mar 8, 2021

5.2.4 by changing the condition of the bundle plone-logged-in in /@@resourceregistry-controlpanel to python: member is not None still not working any idea?

@fredvd
Copy link
Member

fredvd commented Mar 9, 2021

I have created an add'on that should include the date picker pattern and also inline validation to public views.

https://github.com/collective/collective.anonymouseditpatterns

It is a first attempt that seems to work for me locally in a plain Plone 5.2.4 coredev plone site. I first tried to get the add'on working in a customer project, but I ran into strange issues of missing resources in the compiling bundle stage.

The anonymouseditpatterns imports the pickadate patterns' less code, but in the mockup pattern these imports failed
until I changed bootstrap to bootstrap3:

https://github.com/plone/mockup/blob/2ec35e1bf556b76a4b1584cd11b82ebf2c93dd40/mockup/patterns/pickadate/pattern.pickadate.less#L4-L5

when I added the add'on to a 5.2 coredev checkout, the paths worked again for /bootstrap/ :-S

I've tried to reduce the bundle size by adding js stubs, but the pickadate pattern pulls in select2. Maybe it doesn't add more js if I also add pat-select2 to collective.anonymouseditpatterns.

@agitator
Copy link
Member

agitator commented Mar 9, 2021

how about adding a profile to change the condition for that bundle to python: member is not None or context.portal_type in ('EasyForm') within easyform?

@fredvd
Copy link
Member

fredvd commented Mar 9, 2021

And what happens to the condition for that bundle when it is merged into the meta-bundle?

@agitator
Copy link
Member

agitator commented Mar 9, 2021

imho it's will be merged...

@thet ping?

we're sprinting tomorrow, as every Wednesday, join us if you need some pointers

@oxygenius
Copy link

What's the status on this issue?

@fredvd
Copy link
Member

fredvd commented Oct 19, 2021

What's the status on this issue?

@oxygenius I think the status is what you see here on github. Do you have the same problem? Which Plone versions. Did you try collective.anonymouseditpatterns?

@oxygenius
Copy link

Okay. So the workaround with the anonymouseditpatterns is still the way to go. I'll try collective.anonymouseditpatterns.

@oxygenius
Copy link

Hi @fredvd, works like a charm!

@pbauer
Copy link
Member Author

pbauer commented Aug 25, 2022

In Plone 6 there is still no datepicker for anonymous users. You have to enter the date manually.

@witsch
Copy link
Member

witsch commented Aug 28, 2023

Hi @fredvd, works like a charm!

Same here (on 5.2.13). Thank you! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests