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

EZP-30099: Define preferred user date format #846

Merged
merged 1 commit into from
Mar 5, 2019

Conversation

pawbuj
Copy link
Contributor

@pawbuj pawbuj commented Feb 19, 2019

Question Answer
Tickets EZP-30099
Bug fix? no
New feature? yes
BC breaks? no
Tests pass? yes
Doc needed? yes
License GPL-2.0

User settings / datetime format.

Checklist:

  • Coding standards ($ composer fix-cs)
  • Ready for Code Review

@ezrobot

This comment has been minimized.

@pawbuj pawbuj force-pushed the EZP-30099_date_format branch from 2b3a5b3 to 98ebdd5 Compare February 19, 2019 22:25
@ezrobot

This comment has been minimized.

@pawbuj pawbuj force-pushed the EZP-30099_date_format branch from 98ebdd5 to db6e296 Compare February 19, 2019 23:07
Copy link
Member

@dew326 dew326 left a 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.

@dew326 dew326 requested a review from webhdx February 20, 2019 07:16
Copy link
Contributor

@sunpietro sunpietro left a 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.

Copy link
Contributor

@webhdx webhdx left a 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/Resources/views/user/settings/update.html.twig 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: ~
Copy link
Contributor

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/UserSetting/Setting/DateTimeFormat.php Outdated Show resolved Hide resolved
@pawbuj pawbuj requested review from webhdx and dew326 and removed request for andrerom February 20, 2019 09:42
@adamwojs
Copy link
Member

Could you please update PR description with the configuration and ez_datetime usage examples? The high-level overview of the solution will speed up the review in large PRs and usually is initial input for the @DominikaK and @MagdalenaZuba to document feature 😉

@lserwatka
Copy link
Member

@pawbuj rebase is needed here.

@pawbuj pawbuj force-pushed the EZP-30099_date_format branch from c245e65 to df14354 Compare March 4, 2019 19:56
@pawbuj pawbuj force-pushed the EZP-30099_date_format branch from 257e60e to f509454 Compare March 5, 2019 08:43
const demoContainer = doc.querySelector('#datetime_format_demo');

const updateDemoDateFormat = () => {
let dateFormat = dateDropdown.options[dateDropdown.selectedIndex].value;
Copy link
Member

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;
Copy link
Member

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;
Copy link
Member

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);
Copy link
Member

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'),
Copy link
Member

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

@pawbuj pawbuj requested review from sunpietro, webhdx and dew326 March 5, 2019 15:23
return [
'full' => 'M j, Y g:i A',
Copy link
Member

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.

Copy link
Member

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>
Copy link
Member

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?

@m-tyrala
Copy link
Contributor

m-tyrala commented Mar 5, 2019

There is an error - both on my local machine, and on Travis test build:

Cannot autowire service "EzSystems\EzPlatformAdminUi\UI\Config\Provider\Dat
eFormat": argument "$dateTimeFormatSerializer" of method "__construct()" ha
s type "EzSystems\EzPlatformUser\UserSetting\Setting\DateTimeFormatSerializ
er" but this class was not found.

Is this a bug, or there are some missing dependencies?

@lserwatka
Copy link
Member

lserwatka commented Mar 5, 2019

Looks like changes from ezplatform-user were not taken into account. Restart should help.

@adamwojs adamwojs force-pushed the EZP-30099_date_format branch from 524ac36 to ef673a1 Compare March 5, 2019 18:31
@lserwatka
Copy link
Member

All green 🚀

@lserwatka lserwatka merged commit b4580ab into master Mar 5, 2019
@lserwatka lserwatka deleted the EZP-30099_date_format branch March 5, 2019 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

8 participants