-
Notifications
You must be signed in to change notification settings - Fork 16
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
IBX-1339: DateTime Widget #297
Conversation
2474f60
to
69ed9d3
Compare
ad96dcd
to
46e3466
Compare
{% set is_small = is_small|default(false) %} | ||
{% set inline_flatpickr = inline_flatpickr|default(false) %} | ||
|
||
{% set wrapper_attr = wrapper_attr|default({})|merge({ |
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 think these attributes should be called just attr
because you are applying them directly on ibexa-date-time-picker
.
{% set wrapper_attr = wrapper_attr|default({})|merge({ | |
{% set attr = wrapper_attr|default({})|merge({ |
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.
Not exactly, I'm using here our input_text component, which uses wrapper_attr
https://github.com/ibexa/admin-ui/blob/main/src/bundle/Resources/views/themes/admin/ui/component/input_text.html.twig#L4 so without changing it there (or adding extra div here, but it's pointless IMO) it can't be changed to attr
init() { | ||
this.flatpickrInstance = flatpickr(this.inputField, this.flatpickrConfig); | ||
|
||
this.inputField.addEventListener('input', this.onInputBtn, false); |
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 is not a button
this.inputField.addEventListener('input', this.onInputBtn, false); | |
this.inputField.addEventListener('input', this.onInput, false); |
|
||
onChange(dates) { | ||
const isDateSelected = !!dates[0]; | ||
const restArgument = { inputField: this.inputField, flatpickrDates: dates }; |
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.
What do you think about keeping the name dates
in case we would like to e.g. change internals and abandon flatpickr in the future?
const restArgument = { inputField: this.inputField, flatpickrDates: dates }; | |
const otherArguments = { inputField: this.inputField, dates }; |
@@ -0,0 +1,36 @@ | |||
{% import '@ibexadesign/ui/component/macros.html.twig' as html %} |
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 think it may be better to put this file inside its own directory:
component/inputs/input_date_and_time.html.twig
WDYT?
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.
But then we should probably move input_text.html.twig
widget as well, WDYT guys? @lucasOsti @dew326
|
||
{% embed '@ibexadesign/ui/component/input_text.html.twig' with { has_search: false } %} | ||
{% block content %} | ||
<input {{ input_attr_rendered }} /> |
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.
nitpick: I think this is simpler and clearer.
<input {{ input_attr_rendered }} /> | |
<input {{ html.attributes(input_attr) }} /> |
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.
But it's not working, it claims that html is not defined
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.
You have to import html
inside embed
.
{% import '@ibexadesign/ui/component/macros.html.twig' as html %} | ||
|
||
{% set is_small = is_small|default(false) %} | ||
{% set inline_flatpickr = inline_flatpickr|default(false) %} |
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 think it's better to avoid using flatpickr
in the "interface" of our components. Maybe:
{% set inline_flatpickr = inline_flatpickr|default(false) %} | |
{% set is_datetime_popup_inline = is_datetime_popup_inline|default(false) %} |
time_24hr: true, | ||
formatDate: (date) => formatShortDateTime(date, null), | ||
}; | ||
class DateAndTime { |
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.
Maybe to be consistent with css ibexa-date-time-picker
class DateAndTime { | |
class DateTimePicker { |
694d31f
to
fd45594
Compare
When input field is empty then 'X' button should be hidden. Take a look on mockup to compare -> https://projects.invisionapp.com/d/main#/console/21342437/456307022/preview |
c677d94
to
1d6b678
Compare
Creating new content page. 'X' button have to be removed when input field is empty. |
https://github.com/ibexa/scheduler/pull/47
https://github.com/ibexa/page-builder/pull/99
https://github.com/ibexa/personalization/pull/125
Checklist:
$ composer fix-cs
)