Skip to content
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

Allow sidebar toggling on wide slideouts #14418

Merged
merged 2 commits into from
Feb 17, 2024
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG-WIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- Entries can now have multiple authors. ([#12380](https://github.com/craftcms/cms/pull/12380))
- Entry chips, cards, and blocks are now tinted according to their entry type’s color. ([#14187](https://github.com/craftcms/cms/pull/14187))
- Quick Post widgets now create entries via slideouts. ([#14228](https://github.com/craftcms/cms/pull/14228))
- Slideout sidebars are now always toggleable; not just when the slideout is too narrow to show the sidebar alongside the content. ([#14418](https://github.com/craftcms/cms/pull/14418))
- The “Save as a new entry” action is now available to all users with the “Create entries” permission, and will create a new unpublished draft rather than a fully-saved entry. ([#9577](https://github.com/craftcms/cms/issues/9577), [#10244](https://github.com/craftcms/cms/discussions/10244))
- Entry conditions can now have a “Matrix field” rule. ([#13794](https://github.com/craftcms/cms/discussions/13794))
- Money field condition rules now use money inputs. ([#14148](https://github.com/craftcms/cms/pull/14148))
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased

- Slideout sidebars are now always toggleable; not just when the slideout is too narrow to show the sidebar alongside the content. ([#14418](https://github.com/craftcms/cms/pull/14418))
- Field Layout Designers now hide the component library sidebar in favor of “Add” disclosure menus, when they’re too narrow to show the sidebar alongside configured tabs. ([#14411](https://github.com/craftcms/cms/pull/14411))

## 5.0.0-beta.2 - 2024-02-15
Expand Down
2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/cp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/cp.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/css/cp.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/css/cp.css.map

Large diffs are not rendered by default.

11 changes: 1 addition & 10 deletions src/web/assets/cp/src/css/_main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1663,7 +1663,6 @@ ul.icons {
width: 36px;
}

&.active,
&.loading {
cursor: default;
}
Expand Down Expand Up @@ -5475,15 +5474,7 @@ $min2ColWidth: 400px;

@container (width > 700px) {
.slideout {
&.has-sidebar {
.pane-header:not(.so-visible) {
display: none;
}

.sidebar-btn {
display: none;
}

&.showing-sidebar {
.so-body {
display: flex;
flex-direction: row;
Expand Down
12 changes: 10 additions & 2 deletions src/web/assets/cp/src/js/CpScreenSlideout.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@ Craft.CpScreenSlideout = Craft.Slideout.extend(
}

if (data.sidebar) {
this.$container.addClass('has-sidebar');
this.$sidebarBtn.removeClass('hidden');
this.$sidebar.html(data.sidebar);

Expand All @@ -340,8 +339,15 @@ Craft.CpScreenSlideout = Craft.Slideout.extend(
});

this.hasSidebar = true;

// is the slideout wide enough to show it alongside the content?
if (this.$container.width() > 700) {
this.showSidebar();
} else {
this.hideSidebar();
}
} else {
this.$container.removeClass('has-sidebar');
this.hideSidebar();
this.$sidebarBtn.addClass('hidden');
this.$sidebar.addClass('hidden').html('');
this.hasSidebar = false;
Expand Down Expand Up @@ -407,6 +413,7 @@ Craft.CpScreenSlideout = Craft.Slideout.extend(
return;
}

this.$container.addClass('showing-sidebar');
this.$body.scrollTop(0).addClass('no-scroll');

this.$sidebar
Expand Down Expand Up @@ -447,6 +454,7 @@ Craft.CpScreenSlideout = Craft.Slideout.extend(
return;
}

this.$container.removeClass('showing-sidebar');
this.$body.removeClass('no-scroll');

this.$sidebar
Expand Down