-
Notifications
You must be signed in to change notification settings - Fork 719
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
Replace jscalendar with bootstrap-datetimepicker library #943
Conversation
+ Enable datetimepciker on all pages by default + Relocate inline JS code into standalone files + Remove CSP exceptions for jscalendar + Multi-language support Fixes #20040
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new css/js files are not small... Is it necessary to include them on every page ?
*/ | ||
$g_calendar_js_date_format = '\%Y-\%m-\%d \%H:\%M'; | ||
$g_calendar_js_date_format = 'Y-M-D H:m'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency with prior version (month and day with leading 0), the new format should be Y-MM-DD
.
Note: this was just a quick review, I have not yet tested the new functionality. |
I didn't have a deeper look, but what's wrong using the jquery-ui date-time picker used in PR #628 ? |
@atrol Do you know why we include jquery-ui? I opened issue #21881 to see if we can get rid of jquery-ui |
jquery and jquery-ui have been plugins before 1.3.x They have been bundled with MantisBT core to make life of plugin authors a bit easier. At least this one uses jQuery-UI |
@syncguru as we replace the date time control, we should do one of two things:
Please update library/README.md with new libraries used and their version details. I will do some testing tonight and provide more feedback. @atrol I haven't researched the components being compared here, but I would rather use a bootstrap based component over a jquery-ui based one. The component used here has > 4,800 stars. That is pretty popular. Will look more. @syncguru Did you test on small screens? But generally, I'm happy with finally getting rid of the outdated jscalendar and the inline scripts associated with it. |
@atrol |
I don't have a problem with it as I don't use any plugin that uses jquery-ui, but would like to get also some feedback from others, e.g. @rombert who is the author of the Inline-column-configuration plugin. |
manage_proj_ver_edit_page.php does not work for me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replacement of jscalendar should allow removal of CSP bypass for bug report page, see https://github.com/mantisbt/mantisbt/blob/release-2.0.0-rc.1/core/http_api.php#L236, please confirm and implement it as part of the PR if no longer needed.
I think inputs with datetimepicker should not be auto-completed ( |
As far as plugins registered in mantisbt-plugins org, I found several that refer to or use jQuery-UI in one way or another. Mentioning their respective authors to bring their attention to this discussion, and get their opinion:
Most of these plugins have not been updated recently, and none have yet been revised by their respective authors to work with MantisBT 2.x. Since we don't use jQuery-UI ourselves in the core ATM (and it probably does not make sense to do so in the future since we went down the Bootstrap route), I don't have a strong objection against removing it; it would be quite straightforward to update the jQuery-UI plugin, to enable 3rd-party plugins to use that functionality if they need it. |
Hm, managed to miss the mention. Anyway, I don't see a problem with removing jQuery-UI and having administrators pull in the jQuery-UI plug-in themselves if needed. |
|
||
# The JS Calendar control does unsafe eval, remove once we upgrade the control (see #20040) | ||
if( 'bug_update_page.php' == basename( $_SERVER['SCRIPT_NAME'] ) ) { | ||
http_csp_add( 'script-src', "'unsafe-eval'" ); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dregad fyi: csp exception no longer needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cheers
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not block this PR though
I disagree. The button was operational before, and changes in this PR broke it. Making it work as before must be done here so we don't introduce a regression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@syncguru I did a quick test + review and here is my feedback:
- I agree with @dregad that the calendar icon should work.
- The new configuration options are not documented in the manual.
- Should we use new configs or try to re-use the standard MantisBT configuration options for date formats, i.e. normal_date_format, short_date_format or complete_date_format? I would rather re-use one of these rather than creating new ones.
- When using the calendar control to set the date, it adds extra spaces/tabs at the end of the field. Can we remove these?
- Do we control the default time? e.g. can the time be 00:00 by default rather than current time? Not sure about the correct behavior here. Not sure what was the default behavior for jscalendar.
|
||
/** | ||
* Maps current lang string to moment.js locale https://github.com/moment/moment/tree/develop/locale | ||
* @return string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document what the return string will contain.
* Maps current lang string to moment.js locale https://github.com/moment/moment/tree/develop/locale | ||
* @return string | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove blank line between phpdoc and function.
@@ -307,11 +313,21 @@ function layout_head_javascript() { | |||
* @return null | |||
*/ | |||
function layout_body_javascript() { | |||
# bootstrap | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove extra blank line.
@@ -203,4 +203,6 @@ | |||
# changes in 2.0.0dev | |||
config_obsolete( 'icon_path' ); | |||
config_obsolete( 'bug_print_page_fields' ); | |||
config_obsolete( 'calendar_js_date_format' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be
config_obsolete( 'calendar_js_date_format', 'datetime_picker_format' );
@@ -203,4 +203,6 @@ | |||
# changes in 2.0.0dev | |||
config_obsolete( 'icon_path' ); | |||
config_obsolete( 'bug_print_page_fields' ); | |||
config_obsolete( 'calendar_js_date_format' ); | |||
config_obsolete( 'calendar_date_format' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be
config_obsolete( 'calendar_date_format', 'datetime_picker_format' );
1- Update obsolete statements 2- Reduce datepicker box width to avoid icon wrapping Fixes #20040
…040-datetime-picker # Conflicts: # core/obsolete.php
@dregad Please have a look that your feedback is addressed and merge once ready. |
Merged in 0253f46 |
bootstrap-datetimepicker: https://github.com/eonasdan/bootstrap-datetimepicker
Fixes #20040
Date Picker
Time Picker
Bulk Edit
French