Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/bundle/Resources/public/js/scripts/admin.anchor.navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

const header = doc.querySelector('.ibexa-edit-header');
const headerContainer = header?.querySelector('.ibexa-edit-header__container');
const anchorNavigationSwitcher = doc.querySelector('.ibexa-tabs--switcher');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const anchorNavigationSwitcher = doc.querySelector('.ibexa-tabs--switcher');
const anchorNavigationSwitcher = doc.querySelector('.ibexa-anchor-navigation .ibexa-tabs--switcher');

for safety, .ibexa-tabs--switcher can be used in other contexts as well

const SECTION_ADJUST_MARGIN_TOP = 36;
const formContainerNode = doc.querySelector('.ibexa-edit-content');
const lastSectionObserver = new ResizeObserver(() => {
Expand Down Expand Up @@ -88,8 +89,15 @@
let firstVisibleSection = visibleSections.find((section) => {
const { top, height } = section.getBoundingClientRect();
const headerBottomContainerHeight = header.offsetHeight - headerContainer?.offsetHeight;

return top + height >= headerContainer?.offsetHeight + headerBottomContainerHeight + SECTION_ADJUST_MARGIN_TOP;
const anchorNavigationSwitcherHeight = anchorNavigationSwitcher?.offsetHeight || 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const anchorNavigationSwitcherHeight = anchorNavigationSwitcher?.offsetHeight || 0;
const anchorNavigationSwitcherHeight = anchorNavigationSwitcher?.offsetHeight ?? 0;


return (
top + height >=
headerContainer?.offsetHeight +
headerBottomContainerHeight +
anchorNavigationSwitcherHeight +
SECTION_ADJUST_MARGIN_TOP
);
});

if (!firstVisibleSection) {
Expand Down
55 changes: 31 additions & 24 deletions src/bundle/Resources/public/scss/_anchor-navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

.ibexa-anchor-navigation {
$self: &;
background-color: $ibexa-color-white;
padding: calculateRem(24px) calculateRem(32px) 0 calculateRem(32px);

&__sections {
.card {
Expand Down Expand Up @@ -49,13 +51,10 @@
&__header {
height: calculateRem(87px);
padding: calculateRem(20px) 0 0 calculateRem(17px);
border-bottom: calculateRem(1px) solid $ibexa-color-light;
}

&__body {
height: calc(100% - #{calculateRem(87px)});
overflow: auto;
padding: calculateRem(25px);
font-size: $ibexa-text-font-size-medium;
}

Expand All @@ -73,39 +72,48 @@

&__sections {
min-width: calculateRem(240px);
max-width: calculateRem(240px);
list-style: none;
display: none;
margin: calculateRem(24px) 0 0;
padding: calculateRem(24px) 0 0;
border-top: calculateRem(1px) solid $ibexa-color-light;
position: absolute;
right: calculateRem(30px);
z-index: 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

personally I would use at least sth like z-index 10 to leave possibility to add sth between 0 and &__sections


&--active {
display: block;
}
}

&--no-border {
border: 0;
margin-top: 0;
padding-top: 0;
}
&__sections-header {
font-size: $ibexa-text-font-size-extra-large;
font-weight: 600;
color: $ibexa-color-primary;
margin: calculateRem(16px) 0;
}

&__sections-item {
height: calculateRem(32px);
}

&__sections-item-btn {
display: inline-flex;
width: 100%;
padding: calculateRem(11px) calculateRem(15px);
padding: 0;
border: calculateRem(1px) solid transparent;
border-radius: $ibexa-border-radius;
text-align: left;
color: $ibexa-color-dark-400;
align-items: center;
font-weight: 600;
border-left: 1px solid $ibexa-color-light;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
border-left: 1px solid $ibexa-color-light;
border-left: calculateRem(1px) solid $ibexa-color-light;


&::before {
content: '';
display: block;
width: calculateRem(8px);
height: calculateRem(8px);
margin: calculateRem(8px) calculateRem(16px) 0 0;
border-radius: 50%;
background-color: $ibexa-color-light;
width: calculateRem(2px);
height: calculateRem(32px);
margin: 0 calculateRem(16px) 0 0;
opacity: 0;
}

&::after {
Expand All @@ -119,21 +127,20 @@
}

&:hover {
color: $ibexa-color-info;
font-weight: 600;
color: $ibexa-color-primary;

&::before {
background-color: $ibexa-color-info;
opacity: 1;
background-color: $ibexa-color-primary;
}
}

&--active {
color: $ibexa-color-info;
background: $ibexa-color-info-100;
font-weight: 600;
color: $ibexa-color-primary;

&::before {
background-color: $ibexa-color-info;
opacity: 1;
background-color: $ibexa-color-primary;
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/bundle/Resources/public/scss/_content-edit.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
.ibexa-edit-content {
@include edit-right-side-container;

&-width-wrapper {
width: calc(100% - calculateRem(300px));
}

&__container {
max-width: calculateRem(820px);

Expand Down
5 changes: 5 additions & 0 deletions src/bundle/Resources/translations/ibexa_anchor_menu.en.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
<target state="new">More</target>
<note>key: anchor_menu.more</note>
</trans-unit>
<trans-unit id="fc987cbd27f6b39135fba2e19aec6ab4fd8fe088" resname="anchor_menu.sections">
<source>Sections</source>
<target state="new">Sections</target>
<note>key: anchor_menu.sections</note>
</trans-unit>
</body>
</file>
</xliff>
45 changes: 20 additions & 25 deletions src/bundle/Resources/translations/messages.en.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
</header>
<body>
<trans-unit id="9177237415bf4199961eb8de9353011a5b22a039" resname="anchor_navigation.close">
<source>Close</source>
<target state="new">Close</target>
<note>key: anchor_navigation.close</note>
</trans-unit>
<trans-unit id="8ace6daf300d4e12a28054d996c185db9ce7fe91" resname="authentication.credentials_expire_in.warning">
<source>Your current password will expire in %days% day(s). You can change it in User settings/My account settings.</source>
<target state="new">Your current password will expire in %days% day(s). You can change it in User settings/My account settings.</target>
Expand Down Expand Up @@ -351,6 +346,16 @@
<target state="new">We’ve sent to your email account a link to reset your password.</target>
<note>key: ibexa.forgot_user_password.success.alert</note>
</trans-unit>
<trans-unit id="ed391233ecfa73eeaf4884c184b6b07e30d8f8fa" resname="ibexa.notifications.search_form.label.from">
<source>From</source>
<target state="new">From</target>
<note>key: ibexa.notifications.search_form.label.from</note>
</trans-unit>
<trans-unit id="b5ffcfba814a8539a4257894dc59affdfb49f1c6" resname="ibexa.notifications.search_form.label.to">
<source>To</source>
<target state="new">To</target>
<note>key: ibexa.notifications.search_form.label.to</note>
</trans-unit>
<trans-unit id="a806cedb66ffc2616efb687174a31441d15d6b29" resname="ibexa_author.Email">
<source>Email</source>
<target state="new">Email</target>
Expand All @@ -371,6 +376,16 @@
<target state="new">Name</target>
<note>key: ibexa_author.name</note>
</trans-unit>
<trans-unit id="a8c78354005b82690d25244c10c2914d1c7cc620" resname="ibexa_notifications">
<source>Notifications</source>
<target state="new">Notifications</target>
<note>key: ibexa_notifications</note>
</trans-unit>
<trans-unit id="3fb3513f9d1afa70eca71242490ec7b403bdd41c" resname="ibexa_notifications.btn.mark_all_as_read">
<source>Mark all as read</source>
<target state="new">Mark all as read</target>
<note>key: ibexa_notifications.btn.mark_all_as_read</note>
</trans-unit>
<trans-unit id="599a4e82a1f7e8220dc4f792e1541cd3f0963dac" resname="ibexa_object_relation_list.cta.limit.multi">
<source>Set up a Relation with one or several Items</source>
<target state="new">Set up a Relation with one or several Items</target>
Expand All @@ -396,26 +411,6 @@
<target state="new">Delete</target>
<note>key: ibexa_object_relation_list.delete_selected_relations</note>
</trans-unit>
<trans-unit id="ed391233ecfa73eeaf4884c184b6b07e30d8f8fa" resname="ibexa.notifications.search_form.label.from">
<source>From</source>
<target state="new">From</target>
<note>key: ibexa.notifications.search_form.label.from</note>
</trans-unit>
<trans-unit id="b5ffcfba814a8539a4257894dc59affdfb49f1c6" resname="ibexa.notifications.search_form.label.to">
<source>To</source>
<target state="new">To</target>
<note>key: ibexa.notifications.search_form.label.to</note>
</trans-unit>
<trans-unit id="a8c78354005b82690d25244c10c2914d1c7cc620" resname="ibexa_notifications">
<source>Notifications</source>
<target state="new">Notifications</target>
<note>key: ibexa_notifications</note>
</trans-unit>
<trans-unit id="3fb3513f9d1afa70eca71242490ec7b403bdd41c" resname="ibexa_notifications.btn.mark_all_as_read">
<source>Mark all as read</source>
<target state="new">Mark all as read</target>
<note>key: ibexa_notifications.btn.mark_all_as_read</note>
</trans-unit>
<trans-unit id="8390c7c1adbff8a264583f6f060256c993023787" resname="language.delete">
<source>Delete</source>
<target state="new">Delete</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
'location': location,
'parent_location': parent_location,
'language': language,
'grouped_fields': grouped_fields,
'grouped_fields': grouped_fields
}) %}

{% embed '@ibexadesign/ui/anchor_navigation_menu.html.twig' with anchor_params %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,8 @@

{% form_theme form with form_templates %}

{% block left_sidebar %}
{% if without_close_button is not defined or without_close_button != true %}
{% set referrer_location = content is defined and is_published ? location : parent_location %}
{% endif %}

{% block anchor_menu %}
{% include '@ibexadesign/ui/anchor_navigation_menu.html.twig' with anchor_params %}
{% endblock %}
{% block anchor_menu %}
{% include '@ibexadesign/ui/anchor_navigation_menu.html.twig' with anchor_params %}
{% endblock %}

{% block content %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
]
} %}

{% block main_container_class %}{{ parent() }} ibexa-content-type-edit ibexa-main-container--with-anchor-menu-items{% endblock %}
{% block main_container_class %}{{ parent() }} ibexa-content-type-edit ibexa-main-container--without-anchor-menu-items{% endblock %}

{% block left_sidebar %}
{% block anchor_menu %}
{% set content_type_edit_anchor_menu = knp_menu_get('ibexa.admin_ui.menu.content_type_edit.anchor_menu', [], {
'content_type': content_type,
}) %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
<div class="ibexa-anchor-navigation-menu">
<div class="ibexa-anchor-navigation-menu__header">
{% if close_href is defined and close_href is not null %}
<a
class="btn ibexa-btn ibexa-btn--ghost ibexa-anchor-navigation-menu__close"
href="{{ close_href }}"
>
<svg class="ibexa-icon ibexa-icon--small-medium">
<use xlink:href="{{ ibexa_icon_path('discard') }}"></use>
</svg>
<span class="ibexa-btn__label">
{{ 'anchor_navigation.close'|trans|desc('Close') }}
</span>
</a>
{% endif %}
</div>
{% trans_default_domain 'ibexa_anchor_menu' %}

<div class="ibexa-anchor-navigation-menu">
<div class="ibexa-anchor-navigation-menu__body">
{% block navigation_menu_body %}
{% if items|default([])|length > 1 %}
<ul class="ibexa-anchor-navigation-menu__sections ibexa-anchor-navigation-menu__sections--active ibexa-anchor-navigation-menu__sections--no-border">
<li class="ibexa-anchor-navigation-menu__sections-header">
{{ 'anchor_menu.sections'|trans|desc('Sections') }}
</li>
{% for item in items %}
{% set item_label = item is iterable ? item.label : item %}
{% set sanitized_item = item is iterable and item.target_id is defined ? item.target_id : item_label|lower|slug %}
Expand Down
20 changes: 9 additions & 11 deletions src/bundle/Resources/views/themes/admin/ui/edit_base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,26 @@

{% block main_container_class %}
ibexa-main-container--edit-container

{%- set has_anchor_menu_items = anchor_params.items|default([])|length > 1 or ignored_content_fields|default([]) is not empty -%}
{%- set has_anchor_close_btn = anchor_params.close_href|default(null) is not empty -%}

{{- has_anchor_menu_items ? ' ibexa-main-container--with-anchor-menu-items ' : ' ibexa-main-container--without-anchor-menu-items ' -}}
{{- not has_anchor_close_btn ? ' ibexa-main-container--without-anchor-close-btn ' -}}
ibexa-main-container--without-anchor-menu-items
{% endblock %}

{% block header_row %}{% endblock %}

{% block left_sidebar %}
{% include '@ibexadesign/ui/anchor_navigation_menu.html.twig' with anchor_params|default({}) %}
{% endblock %}
{% block left_sidebar %}{% endblock %}

{% block back_to_top %}{% endblock %}

{% block content_column %}
<div class="ibexa-main-container__content-column">
{% block header %}{% endblock %}

{% block anchor_menu %}
{% include '@ibexadesign/ui/anchor_navigation_menu.html.twig' with anchor_params|default({}) %}
{% endblock %}
<div class="ibexa-edit-content">
{% block content %}{% endblock %}
<div class="ibexa-edit-content-width-wrapper">
{% block content %}{% endblock %}
</div>
</div>
</div>
</div>
{% endblock %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
{% endblock %}

{% block children_2nd_level %}
<div class="ibexa-anchor-navigation-menu__sections-header">
{{ 'anchor_menu.sections'|trans|desc('Sections') }}
</div>
{% for item in currentItem.children %}
{%- set itemClass = 'ibexa-anchor-navigation-menu__sections-item-btn' %}
{%- if loop.first %}
Expand Down
Loading