-
Notifications
You must be signed in to change notification settings - Fork 81
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
Resolve #461: Add calendar picker for date attribute fields #734
Conversation
Can you see if there's a way to fit into the way Django's Javascript localisation works? (https://docs.djangoproject.com/en/1.9/topics/i18n/translation/#internationalization-in-javascript-code). We now have this set up, with a seperate |
@ian-ross, I've looked into the Javascript localization but I don't think it's needed because the JavaScript strings that need to be translated are not in static JS files but in templates, so regular Django template translation strings could suffice. However, I decided to resolve this by loading the proper JQuery UI i18n JS file from the RawGit CDN (which we already use for the markerCluster Leaflet plugin), and using the Two disadvantages of this approach is that one, we now have an external i18n dependency, and two, dialects like Brazilian Portuguese cannot be supported in a straightforward manner because Django uses language codes like "pt-br" while JQuery UI uses "pt-BR". |
Sounds good! (We can always write a custom template tag to convert the regional language codes to the format that jQuery uses if we need that level of detail.) |
Question: Is jQuery UI's widget good enough? Or would the Bootstrap 3 Datepicker be better so that the widget can match our Bootstrap theme? |
@seav I think it is good enough for now if you are done with this. |
@wonderchook, yes, this is done. |
@seav I think there's something missing here. The datepicker pops up when you edit entities, but not when you're creating entities. I think you just forgot to add the datepicker activation JS code to the relevant templates. |
D'oh! I'll fix this now. |
0407986
to
848086d
Compare
I think, this is good to go. Any objections, @ian-ross? |
No objections from me: merging now... |
Proposed changes in this pull request
datepicker
HTML class if the Django field to be rendered isDateField
.When should this PR be merged
The following issue should be resolved first.
I need some suggestions on how best to incorporate l10n. JQuery UI has a comprehensive set of l10n files, but this would be a bit tricky to work with our language picker at the footer. It may end up that the user changed the UI language but the date picker retains the previous language though this scenario may be rare because the user would have changed the language way before going to a page with the datepicker.
An alternative option is to use the Datepicker's
monthNamesShort
anddayNamesMin
options to override any selected locale. This can then use Django's normal template l10n features.Risks
None foreseen.
Follow up actions
None.