Skip to content

Commit

Permalink
IBX-1403: Removed grayed parts when scrolling in content type edit (#115
Browse files Browse the repository at this point in the history
)

Co-authored-by: Marek Nocoń <mnocon@users.noreply.github.com>
  • Loading branch information
dew326 and mnocon authored Dec 15, 2021
1 parent 866601a commit 21bb0f9
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@

btn.classList.toggle('ibexa-anchor-navigation-menu__item-btn--active', anchorTargetSectionId === sectionId);
});

doc.querySelectorAll('.ibexa-anchor-navigation-sections__section').forEach((section) => {
const { anchorSectionId } = section.dataset;

section.classList.toggle('ibexa-anchor-navigation-sections__section--active', anchorSectionId === sectionId);
});
};
const navigateTo = (event) => {
const { anchorTargetSectionId } = event.currentTarget.dataset;
Expand Down
10 changes: 0 additions & 10 deletions src/bundle/Resources/public/scss/_anchor-navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,3 @@
}
}
}

.ibexa-anchor-navigation-sections {
&__section {
opacity: 0.2;

&--active {
opacity: 1;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

<div
data-anchor-section-id="#{{ sanitized_key }}"
class="row ibexa-anchor-navigation-sections__section {{ loop.first ? 'ibexa-anchor-navigation-sections__section--active' }}"
class="row ibexa-anchor-navigation-sections__section"
>
<div class="offset-1 col-6">
{% for field in group %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
{% set attr = attr|default({})|merge({
class: (attr.class|default('')
~ ' ibexa-anchor-navigation-sections__section row'
~ (is_active|default(false) ? ' ibexa-anchor-navigation-sections__section--active')
)|trim,
'data-anchor-section-id': section_id,
}) %}
Expand Down
18 changes: 14 additions & 4 deletions src/lib/Behat/Page/ContentUpdateItemPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ protected function specifyLocators(): array
new VisibleCSSLocator('pageTitle', '.ibexa-edit-header__title'),
new VisibleCSSLocator('formElement', '[name=ezplatform_content_forms_content_edit]'),
new VisibleCSSLocator('closeButton', '.ibexa-anchor-navigation-menu__back'),
new VisibleCSSLocator('fieldLabel', '.ibexa-anchor-navigation-sections__section--active .ibexa-field-edit__label-wrapper label.ibexa-field-edit__label, .card-body > .row .ez-field-edit__label-wrapper label.ez-field-edit__label, .ez-field-edit__label-wrapper legend, .ez-card > .card-body > div > div > legend, .ibexa-field-edit--eznoneditable > legend.col-form-label'),
new VisibleCSSLocator('nthField', '.ibexa-field-edit:nth-of-type(%s)'),
new VisibleCSSLocator('noneditableFieldClass', 'ibexa-field-edit--eznoneditable'),
new VisibleCSSLocator('fieldOfType', '.ibexa-field-edit--%s'),
Expand All @@ -110,10 +109,10 @@ protected function getRoute(): string
public function getField(string $fieldName): FieldTypeComponent
{
$fieldLocator = new VisibleCSSLocator('', sprintf($this->getLocator('nthField')->getSelector(), $this->getFieldPosition($fieldName)));
$fieldtypeIdentifier = $this->getFieldtypeIdentifier($fieldLocator, $fieldName);
$fieldTypeIdentifier = $this->getFieldtypeIdentifier($fieldLocator, $fieldName);

foreach ($this->fieldTypeComponents as $fieldTypeComponent) {
if ($fieldTypeComponent->getFieldTypeIdentifier() === $fieldtypeIdentifier) {
if ($fieldTypeComponent->getFieldTypeIdentifier() === $fieldTypeIdentifier) {
$fieldTypeComponent->setParentLocator($fieldLocator);

return $fieldTypeComponent;
Expand All @@ -123,7 +122,18 @@ public function getField(string $fieldName): FieldTypeComponent

protected function getFieldPosition(string $fieldName): int
{
$fieldElements = $this->getHTMLPage()->setTimeout(5)->findAll($this->getLocator('fieldLabel'));
$activeSections = $this->getHTMLPage()->findAll(new VisibleCSSLocator('activeSection', '.ibexa-anchor-navigation-menu__item-btn--active'));
$fieldLabelLocator = $activeSections->any() ?
new VisibleCSSLocator(
'fieldLabelWithCategories',
sprintf(
'[data-anchor-section-id="%1$s"] .ibexa-field-edit .ibexa-field-edit__label, [data-anchor-section-id="%1$s"] .ibexa-field-edit--eznoneditable .ibexa-label',
$activeSections->single()->getAttribute('data-anchor-target-section-id')
)
) :
new VisibleCSSLocator('fieldLabel', ' .ibexa-field-edit .ibexa-field-edit__label, .ibexa-field-edit--eznoneditable .ibexa-label');

$fieldElements = $this->getHTMLPage()->setTimeout(5)->findAll($fieldLabelLocator);

$foundFields = [];
foreach ($fieldElements as $fieldPosition => $fieldElement) {
Expand Down

0 comments on commit 21bb0f9

Please sign in to comment.