-
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-3523: Introduced tabs to left sidebar in Content Edit interface #526
IBX-3523: Introduced tabs to left sidebar in Content Edit interface #526
Conversation
…Meta fields in Content category
…_edit.form_templates notation
src/bundle/DependencyInjection/Configuration/Parser/AdminUiForms.php
Outdated
Show resolved
Hide resolved
@webhdx you must fix SonarCloud issues too. |
contentContainer.style.paddingBottom = '0px'; | ||
|
||
if (!firstSection.isSameNode(lastSection) && lastSection && lastSection.offsetHeight) { | ||
const headerContainer = doc.querySelector('.ibexa-edit-header .ibexa-edit-header__container'); |
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 need this parent in selector? .ibexa-edit-header
items.forEach((item) => item.classList.toggle('ibexa-navigation-menu__secondary--active', item.isSameNode(node))); | ||
}; | ||
const onSelectPrimaryMenuList = (event) => { | ||
const { targetId } = event.target.dataset; |
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 { targetId } = event.target.dataset; | |
const { targetId } = event.currentTarget.dataset; |
} | ||
}; | ||
const onSelectPrimaryMenuDropdown = (event) => { | ||
const targetId = event.target.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 targetId = event.target.value; | |
const targetId = event.currentTarget.value; |
{% set sanitized_item = item|slug %} | ||
<li class="ibexa-anchor-navigation-menu__item"> | ||
<button | ||
type="button" |
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.
indent
data-id="ibexa-edit-content-sections-content-fields" | ||
> | ||
{% block form_fields %} | ||
<div class="ibexa-anchor-navigation-sections"> |
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.
indent
@@ -0,0 +1,8 @@ | |||
<div | |||
class="ibexa-edit-content__primary-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.
indent
@@ -0,0 +1,6 @@ | |||
<div | |||
data-id="{{ data_id }}" |
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.
indent
tests/bundle/DependencyInjection/Configuration/Parser/AdminUiFormsTest.php
Outdated
Show resolved
Hide resolved
@webhdx nice description. If it lands in the Doc, I'd have one small nitpick for it - service name should follow our and SF guidelines, so rather |
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.
+1 for backend side, but other Reviewers had important remarks.
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.
#526 (comment) was left behind, other than this 👍
} | ||
}; | ||
|
||
bindPrimaryMenuListEvents(); |
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.
Why not attach<...>
as we have in other places?
const firstSection = primarySection.querySelector('.ibexa-edit-content__secondary-section:first-child'); | ||
const lastSection = primarySection.querySelector('.ibexa-edit-content__secondary-section:last-child'); |
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 can be confusing because :first-child
and :last-child
"ignore" the class. This will return null
in case .ibexa-edit-content__secondary-section
is not first/last element, but it is assumed below that firstSection
will never be null, so:
const firstSection = primarySection.querySelector('.ibexa-edit-content__secondary-section:first-child'); | |
const lastSection = primarySection.querySelector('.ibexa-edit-content__secondary-section:last-child'); | |
const firstSection = primarySection.firstElementChild; | |
const lastSection = primarySection.lastElementChild; |
|
||
contentContainer.style.paddingBottom = '0px'; | ||
|
||
if (!firstSection.isSameNode(lastSection) && lastSection && lastSection.offsetHeight) { |
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 that lastSection
will never be null, given firstSection
is not null.
if (!firstSection.isSameNode(lastSection) && lastSection && lastSection.offsetHeight) { | |
if (!firstSection.isSameNode(lastSection) && lastSection.offsetHeight) { |
const lastSection = primarySection.querySelector('.ibexa-edit-content__secondary-section:last-child'); | ||
const contentContainer = contentColumn.querySelector('.ibexa-edit-content__container'); | ||
|
||
contentContainer.style.paddingBottom = '0px'; |
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 have to set it even for a case in which we are setting it below again?
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's kinda of a reset, notice that we set this style after two if
s, in all other cases it should be set to 0
}; | ||
let currentlyVisibleSections = getSecondarySectionActiveItems(); | ||
const fitSecondarySections = () => { | ||
const primarySection = doc.querySelector('.ibexa-edit-content__primary-section--active'); |
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.
Sometimes you are using formContainerNode
and sometimes not, is there any reason behind it?
|
||
fitSecondarySections(); | ||
}; | ||
const showSecondaryMenu = (node) => { |
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 would be nice to have such a function also for the primary menu.
color: $ibexa-color-info; | ||
font-weight: 600; | ||
|
||
&: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.
here and in other places below:
&:before { | |
&::before { |
@@ -51,6 +51,34 @@ | |||
</div> | |||
{% endblock %} | |||
|
|||
{% block anchor_menu %} | |||
{% set content_edit_anchor_menu = knp_menu_get('ibexa.admin_ui.menu.content_edit.anchor_menu', [], { | |||
'content': content, |
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 here and in other places:
'content': content, | |
content, |
Small frontend issue: http://g.recordit.co/W2X0mTjQbM.gif |
@GrabowskiM the second level menu item width still changes |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
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.
QA Approved on Ibexa Commerce 4.2.x-dev.
This PR changes sidebar menu in content editing interface to use tabs. Idea behind this is to separate typical fieldtypes from fieldtypes enriching content with new functionality. Good example is SEO - it isn't a field per se but rather a fieldtype handling functionality for the whole Content object. Taxonomy is another good example. Items assigned to Meta tabs are configured using semantic configuration:
Extending the menu
For new tabs it's also required to render its section in content editing form. This is done with UI Component:
Deprecations
I've deprecated
admin_ui_forms.content_edit_form_templates
config setting in favor of makingcontent_edit
an array where we can add more settings related to content editing form (i.e.content_edit.fieldtypes
as in this PR)Both notations will work until deprecation is removed in 5.0. Matching siteaccess aware parameters have not been renamed as it's more difficult to provide backwards compatibility on those.
Checklist:
$ composer fix-cs
)