-
Notifications
You must be signed in to change notification settings - Fork 62
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-397: Implement the new design for content item editing screen #1770
IBX-397: Implement the new design for content item editing screen #1770
Conversation
723d539
to
2db6c51
Compare
src/bundle/Resources/public/js/scripts/admin.anchor.navigation.js
Outdated
Show resolved
Hide resolved
src/bundle/Resources/public/js/scripts/admin.anchor.navigation.js
Outdated
Show resolved
Hide resolved
src/bundle/Resources/public/js/scripts/admin.anchor.navigation.js
Outdated
Show resolved
Hide resolved
src/bundle/Resources/public/js/scripts/admin.anchor.navigation.js
Outdated
Show resolved
Hide resolved
const navigateTo = (event) => { | ||
const { anchorTargetSection } = event.currentTarget.dataset; | ||
|
||
getSectionsCords(); |
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 put definition of this func before?
}; | ||
|
||
doc.querySelectorAll('.ibexa-anchor-navigation-menu__btn').forEach((button) => { | ||
button.addEventListener('click', navigateTo); |
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.
button.addEventListener('click', navigateTo); | |
button.addEventListener('click', navigateTo, false); |
}); | ||
|
||
doc.addEventListener('scroll', (event) => { | ||
const pos = global.scrollY + scrollOffset; |
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 position insead of pos? No need to shorten it
@@ -105,4 +141,4 @@ | |||
|
|||
{% block stylesheets %} | |||
{% include '@ezdesign/content/edit/stylesheets.html.twig' %} | |||
{% endblock %} | |||
{% endblock %} |
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.
unnecessary change
f25465f
to
03b091e
Compare
let endSection = 0; | ||
const { anchorTargetSectionId } = event.currentTarget.dataset; | ||
|
||
doc.querySelectorAll('.ibexa-anchor-navigation-sections__section').forEach((section) => { |
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 would you say for sth like
let prevSection = 0;
doc.querySelectorAll('.ibexa-anchor-navigation-sections__section').forEach((section) => {
const { anchorSectionId } = section.dataset;
sectionsPosition[anchorSectionId] = prevSection;
prevSection = section.offsetHeight;
});
as far as I understand you dont need both variables
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 am not sure what you are proposing, @GrabowskiM. You only changed startSection
name to prevSection
and position of its declaration? Maybe I missed something in your code excerpt.
I like change of the variable name, but I wonder, do we even need sectionsPosition
, @lucasOsti?
Because it is used only in 1 place AFAIK:
https://github.com/ezsystems/ezplatform-admin-ui/pull/1770/files#diff-2b5ffe8475c06a6575af7905596bab7de43658bb4bd13a9b658da19d8d5de2b1R36
top: sectionsPosition[anchorTargetSectionId],
My proposition in other comment.
const button = primaryButtons[i]; | ||
const isLastButton = i === primaryButtons.length - 1; | ||
const allPreviousButtonVisible = hiddenPrimaryButtons.length === 0; | ||
const isButtonNarrowerThanMoreButton = button.offsetWidth < moreButton.offsetWidth + BUTTON_MARGIN; // ?? |
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.
comment?
src/bundle/Resources/views/themes/admin/ui/menu/content_edit_menu.html.twig
Outdated
Show resolved
Hide resolved
src/bundle/Resources/views/themes/admin/ui/menu/content_edit_menu.html.twig
Outdated
Show resolved
Hide resolved
src/bundle/Resources/views/themes/admin/ui/menu/content_edit_menu.html.twig
Outdated
Show resolved
Hide resolved
const invalidTabLink = doc.querySelector(`a[href="#${invalidTab.id}"]`); | ||
|
||
invalidTabLink.click(); | ||
invalidButton.click(); |
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.
Do we click it to basically call navigateTo
function from admin.anchor.navigation.js
?
validationResults.filter((result) => !result.isValid).reduce((total, result) => { | ||
total.add(result.validatorName); |
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 me it is confusing to have reduce,
which acts basically as map
and at the same time adds items to Set
to take only unique results. What do you think about approach, which splits reduce
into map
and [...new Set()]
:
const allValidatorsWithErrors = validationResults.filter((result) => !result.isValid).map((result) => result.validatorName);
btn.dataset.validatorsWithErrors = [...new Set(allValidatorsWithErrors)].join();
I have just noticed, that it is old code and you only formatted it. :D
Too much writing to delete it :P
let endSection = 0; | ||
const { anchorTargetSectionId } = event.currentTarget.dataset; | ||
|
||
doc.querySelectorAll('.ibexa-anchor-navigation-sections__section').forEach((section) => { |
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 am not sure what you are proposing, @GrabowskiM. You only changed startSection
name to prevSection
and position of its declaration? Maybe I missed something in your code excerpt.
I like change of the variable name, but I wonder, do we even need sectionsPosition
, @lucasOsti?
Because it is used only in 1 place AFAIK:
https://github.com/ezsystems/ezplatform-admin-ui/pull/1770/files#diff-2b5ffe8475c06a6575af7905596bab7de43658bb4bd13a9b658da19d8d5de2b1R36
top: sectionsPosition[anchorTargetSectionId],
My proposition in other comment.
const navigateTo = (event) => { | ||
let startSection = 0; | ||
const { anchorTargetSectionId } = event.currentTarget.dataset; | ||
|
||
doc.querySelectorAll('.ibexa-anchor-navigation-sections__section').forEach((section) => { | ||
const { anchorSectionId } = section.dataset; | ||
|
||
sectionsPosition[anchorSectionId] = startSection; | ||
startSection = section.offsetHeight; | ||
}); | ||
|
||
if (isVerticalScrollVisible()) { | ||
formContainerNode.scrollTo({ | ||
top: sectionsPosition[anchorTargetSectionId], | ||
behavior: 'smooth', |
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? Am I missing something? @lucasOsti
const navigateTo = (event) => { | |
let startSection = 0; | |
const { anchorTargetSectionId } = event.currentTarget.dataset; | |
doc.querySelectorAll('.ibexa-anchor-navigation-sections__section').forEach((section) => { | |
const { anchorSectionId } = section.dataset; | |
sectionsPosition[anchorSectionId] = startSection; | |
startSection = section.offsetHeight; | |
}); | |
if (isVerticalScrollVisible()) { | |
formContainerNode.scrollTo({ | |
top: sectionsPosition[anchorTargetSectionId], | |
behavior: 'smooth', | |
const navigateTo = (event) => { | |
const { anchorTargetSectionId } = event.currentTarget.dataset; | |
const anchorTargetSection = doc.querySelector(`.ibexa-anchor-navigation-sections__section[data-anchor-section-id=${anchorTargetSectionId}]`); | |
const anchorTargetSectionPreviousSibling = anchorTargetSection.previousSibling; | |
const scrollTop = anchorTargetSectionPreviousSibling?.offsetHeight ?? 0; | |
if (isVerticalScrollVisible()) { | |
formContainerNode.scrollTo({ | |
top: scrollTop, | |
behavior: 'smooth', |
doc.querySelectorAll('.ibexa-anchor-navigation-sections__section').forEach((section) => { | ||
const { anchorSectionId } = section.dataset; | ||
const start = section.offsetTop; | ||
const end = section.offsetHeight + section.offsetTop; | ||
|
||
if (position > start && position < end) { | ||
showSection(anchorSectionId); | ||
} | ||
}); |
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.
From my perspective, you basically try to find one and only one section and then call showSection
on it, so in my opinion it would be more expressive to do it this way:
doc.querySelectorAll('.ibexa-anchor-navigation-sections__section').forEach((section) => { | |
const { anchorSectionId } = section.dataset; | |
const start = section.offsetTop; | |
const end = section.offsetHeight + section.offsetTop; | |
if (position > start && position < end) { | |
showSection(anchorSectionId); | |
} | |
}); | |
const allSections = doc.querySelectorAll('.ibexa-anchor-navigation-sections__section'); | |
const activeSection = allSelections.find((section) => { | |
const { anchorSectionId } = section.dataset; | |
const start = section.offsetTop; | |
const end = section.offsetHeight + section.offsetTop; | |
return position > start && position < end; | |
}); | |
const activeSectionId = activeSection.dataset.anchorSectionId | |
showSection(activeSectionId); |
44efa2a
to
0be377a
Compare
363bbfd
to
e8f125a
Compare
9a3bec0
to
4bd77d4
Compare
z-index: 1000; | ||
} | ||
|
||
.ez-icon { |
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.
.ez-icon { | |
.ibexa-icon { |
?
border-bottom-right-radius: $ibexa-border-radius; | ||
} | ||
|
||
.ez-icon { |
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.
.ez-icon { | |
.ibexa-icon { |
} | ||
} | ||
|
||
.btn-dark { |
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.
probably should not be styled by this class
{% endblock %} | ||
|
||
{% block label %} | ||
<span class="ez-btn__label">{{ parent() }}</span> |
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.
<span class="ez-btn__label">{{ parent() }}</span> | |
<span class="ibexa-btn__label">{{ parent() }}</span> |
?
@@ -177,3 +177,12 @@ | |||
} | |||
} | |||
} | |||
|
|||
// TO DO: remove when redesigning !! |
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 it stay? If so:
// TO DO: remove when redesigning !! | |
// TODO: remove when redesigning !! |
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 it stay? If so:
yes, because after whole redesign we have to change it
itemHiddenClass: 'ibexa-context-menu__item--hidden', | ||
container: adapatItemsContainer, | ||
getActiveItem: () => { | ||
return adapatItemsContainer.querySelectorAll('.ibexa-context-menu__item')[0]; |
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 🤔
return adapatItemsContainer.querySelectorAll('.ibexa-context-menu__item')[0]; | |
return adapatItemsContainer.querySelector('.ibexa-context-menu__item'); |
const popupMenuElement = adapatItemsContainer.querySelector('.ibexa-popup-menu'); | ||
const showPopupButton = adapatItemsContainer.querySelector('.ibexa-btn--more'); | ||
const adaptiveItems = new eZ.core.AdaptiveItems({ | ||
items: [...adapatItemsContainer.querySelectorAll('.ibexa-context-menu__item:not(.ibexa-context-menu__item--more)')], |
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 can add a special class to the items and AdaptiveItems will find items on its own.
position: () => { | ||
popupMenuElement.style.right = 0; | ||
}, |
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.
And proper styles in CSS. Would it work?
position: () => { | |
popupMenuElement.style.right = 0; | |
}, | |
position: () => {}, |
border: calculateRem(1px) solid transparent; | ||
border-radius: $ibexa-border-radius; | ||
|
||
&:before { |
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.
CSS3 syntax - here and in other places
&:before { | |
&::before { |
ref. https://developer.mozilla.org/en-US/docs/Web/CSS/::before#syntax
'label': label, | ||
'class': item.class|default('') | ||
}) }} | ||
{% endfor %} |
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.
Bad indentation?
@@ -1,3 +1,3 @@ | |||
<li class="ibexa-popup-menu__item {{ class|default('') }}"> | |||
{{ label }} | |||
{{ label }} |
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.
Tab instead of 4 spaces? What about other places?
{% extends '@KnpMenu/menu.html.twig' %} | ||
|
||
{% block root %} | ||
<ul class="ibexa-context-menu"> |
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.
Tabs should be changed to spaces?
@@ -25,9 +25,9 @@ public function __construct(BrowserContext $context) | |||
parent::__construct($context); | |||
$this->fields = [ | |||
'formElement' => '[name=ezplatform_content_forms_content_edit],[name=ezplatform_content_forms_user_create],[name=ezplatform_content_forms_user_update]', | |||
'closeButton' => '.ez-content-edit-container__close', | |||
'closeButton' => '.ez-content-edit-container__close, .ibexa-content-edit-sidebar__header .ibexa-content-edit-sidebar__back', // TO DO: Set one selector after redesign |
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.
TODO? Here and in other places.
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.
TODO? Here and in other places.
yes, because after whole redesign we have to change it
{% block root %} | ||
<ul class="ibexa-context-menu"> | ||
{% for item in item.children %} | ||
{ block('item') }} |
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.
Missing {
026a744
to
2670c61
Compare
0b34056
to
889e745
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Redesign content create and main layout
Checklist:
$ composer fix-cs
)