-
Notifications
You must be signed in to change notification settings - Fork 56
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
EZP-30099: Define preferred user date format #846
Conversation
This comment has been minimized.
This comment has been minimized.
2b3a5b3
to
98ebdd5
Compare
This comment has been minimized.
This comment has been minimized.
98ebdd5
to
db6e296
Compare
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.
There are a few BC breaks.
src/bundle/Resources/public/js/scripts/helpers/timezone.helper.js
Outdated
Show resolved
Hide resolved
src/bundle/Resources/public/js/scripts/helpers/timezone.helper.js
Outdated
Show resolved
Hide resolved
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.
Besides the comments from @dew326 there are some minor coding standards issues.
src/bundle/Resources/public/js/scripts/admin.user_settings.datetime_format.js
Outdated
Show resolved
Hide resolved
src/bundle/Resources/public/js/scripts/admin.user_settings.datetime_format.js
Outdated
Show resolved
Hide resolved
src/bundle/Resources/public/js/scripts/admin.user_settings.datetime_format.js
Outdated
Show resolved
Hide resolved
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.
-
I'm not sure how it works for but since you are not mapping siteaccess aware configuration to parameters in
\EzSystems\EzPlatformAdminUiBundle\DependencyInjection\Configuration\Parser\UserPreferences::mapConfig
. Please check how it's done and add your mapping accordingly. -
There are many typos. Please check your code.
-
I'd store datetime format as a JSON object in User Preferences because combined string makes it too complicated. Just look at
\EzSystems\EzPlatformAdminUi\Service\UserPreferences\DateTimeFormat\DateTimeFormatRepository
- it requires a lot of strings magic. -
Changing
\EzSystems\EzPlatformAdminUi\UI\Config\Provider\DateFormat
is a BC break. -
We are using multiple date formats across AdminUI. Single one is not enough since sometimes we need short format and sometimes full.
src/bundle/DependencyInjection/Configuration/Parser/UserPreferences.php
Outdated
Show resolved
Hide resolved
src/bundle/DependencyInjection/Configuration/Parser/UserPreferences.php
Outdated
Show resolved
Hide resolved
@@ -100,3 +100,7 @@ services: | |||
EzSystems\EzPlatformAdminUiBundle\Templating\Twig\PathStringExtension: ~ | |||
|
|||
EzSystems\EzPlatformAdminUiBundle\Templating\Twig\ContentTypeIconExtension: ~ | |||
|
|||
EzSystems\EzPlatformAdminUiBundle\Templating\Twig\DateTime\DateTimeExtension: ~ |
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.
It shouldn't be placed in this file. This namespace is reserved for EzSystems\EzPlatformAdminUi\UI\Config
stuff. Someone has already put non relevant service definitions here (PathStringExtension
and ContentTypeIconExtension
).
src/lib/Service/UserPreferences/DateTimeFormat/DateTimeFormatRepository.php
Outdated
Show resolved
Hide resolved
src/lib/Service/UserPreferences/DateTimeFormat/DateTimeFormatRepository.php
Outdated
Show resolved
Hide resolved
src/lib/Service/UserPreferences/DateTimeFormat/DateTimeFormatRepository.php
Outdated
Show resolved
Hide resolved
src/lib/Service/UserPreferences/DateTimeFormat/DateTimeFormatRepository.php
Outdated
Show resolved
Hide resolved
Could you please update PR description with the configuration and |
@pawbuj rebase is needed here. |
c245e65
to
df14354
Compare
src/bundle/Resources/public/js/scripts/helpers/timezone.helper.js
Outdated
Show resolved
Hide resolved
src/bundle/Resources/public/js/scripts/helpers/timezone.helper.js
Outdated
Show resolved
Hide resolved
src/bundle/Resources/public/js/scripts/helpers/timezone.helper.js
Outdated
Show resolved
Hide resolved
src/bundle/Resources/public/js/scripts/helpers/timezone.helper.js
Outdated
Show resolved
Hide resolved
257e60e
to
f509454
Compare
const demoContainer = doc.querySelector('#datetime_format_demo'); | ||
|
||
const updateDemoDateFormat = () => { | ||
let dateFormat = dateDropdown.options[dateDropdown.selectedIndex].value; |
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.
const
|
||
const updateDemoDateFormat = () => { | ||
let dateFormat = dateDropdown.options[dateDropdown.selectedIndex].value; | ||
let timeFormat = timeDropdown.options[timeDropdown.selectedIndex].value; |
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.
const
const updateDemoDateFormat = () => { | ||
let dateFormat = dateDropdown.options[dateDropdown.selectedIndex].value; | ||
let timeFormat = timeDropdown.options[timeDropdown.selectedIndex].value; | ||
let datetimeFormat = dateFormat + ' ' + timeFormat; |
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.
const
dateDropdown.addEventListener('change', updateDemoDateFormat, false); | ||
timeDropdown.addEventListener('change', updateDemoDateFormat, false); | ||
updateDemoDateFormat(); | ||
})(window, document); |
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.
new line at the end
@@ -15,6 +15,7 @@ const layout = [ | |||
path.resolve(__dirname, '../public/js/scripts/button.prevent.default.js'), | |||
path.resolve(__dirname, '../public/js/scripts/udw/browse.js'), | |||
path.resolve(__dirname, '../public/js/scripts/admin.user.menu.js'), | |||
path.resolve(__dirname, '../public/js/scripts/admin.user_settings.datetime_format.js'), |
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.
admin.user.settings.datetime.format.js
src/bundle/Resources/public/js/scripts/admin.user_settings.datetime_format.js
Outdated
Show resolved
Hide resolved
return [ | ||
'full' => 'M j, Y g:i A', |
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.
Is this working? Seems like full
is still removed.
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.
Good catch. I forgot to commit this file.
<trans-unit id="f99a9bb9741db45f57f2436c535d89609ebc6b0d" resname="settings.short_datetime_format.value.description"> | ||
<source><![CDATA[Format for displaying Date & Time]]></source> | ||
<target state="new"><![CDATA[Format for displaying Date & Time]]></target> | ||
<note>key: settings.short_datetime_format.value.description</note> |
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.
Shouldn't be part of ezplatform-user?
There is an error - both on my local machine, and on Travis test build:
Is this a bug, or there are some missing dependencies? |
Looks like changes from ezplatform-user were not taken into account. Restart should help. |
524ac36
to
ef673a1
Compare
All green 🚀 |
User settings / datetime format.
Checklist:
$ composer fix-cs
)