Skip to content

Fancy crumbs and element action menus #13902

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

Merged
merged 68 commits into from
Nov 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
11152b8
WIP on additional menu in the toolbar
i-just Jul 31, 2023
f61f17c
refactor additional menu WIP
i-just Aug 2, 2023
93994f1
use anchor tag as default
i-just Aug 2, 2023
6d5924b
edit user to use the additional menu, not its own version
i-just Aug 2, 2023
c832d97
tweaks to support grouping - tbc
i-just Aug 2, 2023
b7c6c6e
asset additional components + cleanup
i-just Aug 16, 2023
28e9777
include additional menu btn in a slideout
i-just Aug 16, 2023
566bcf1
rename event
i-just Aug 16, 2023
1542d86
make formsubmit links work
i-just Aug 16, 2023
26e052b
compiled assets
i-just Aug 16, 2023
e5ece99
define menu component event needs to know the element
i-just Aug 16, 2023
cb18318
ensure formsubmit class only for action component
i-just Aug 16, 2023
34ca512
formsubmit - allow use of btn data-form
i-just Aug 16, 2023
c23a6c1
edit user - move compiling actions to user element
i-just Aug 16, 2023
a0ae6c5
Merge branch '5.0' into feature/dev-1165-edit-element-additional-tool…
i-just Aug 16, 2023
f2fde24
WIP formsubmit() in a disclosureMenu in a slideoout
i-just Aug 18, 2023
5f8ccf0
Merge branch '5.0' into feature/dev-1165-edit-element-additional-tool…
i-just Sep 26, 2023
6295d4a
formsubmit() in a disclosureMenu in a slideoout
i-just Sep 26, 2023
718a08c
cleanup
i-just Sep 26, 2023
bb04f44
Merge branch '5.0' into feature/dev-1165-edit-element-additional-tool…
i-just Sep 27, 2023
c540530
Merge branch '5.0' into feature/dev-1165-edit-element-additional-tool…
i-just Oct 19, 2023
dbc3eaa
Merge branch '5.0' into feature/dev-1165-edit-element-additional-tool…
i-just Oct 19, 2023
dff4811
Merge branch '5.0' into feature/dev-1165-edit-element-additional-tool…
brandonkelly Oct 19, 2023
c0bc5a1
Merge branch '5.0' into feature/dev-1165-edit-element-additional-tool…
brandonkelly Oct 30, 2023
3b13f70
Merge branch '5.0' into feature/dev-1165-edit-element-additional-tool…
brandonkelly Nov 1, 2023
a02ffa3
Merge branch '5.0' into feature/dev-1165-edit-element-additional-tool…
brandonkelly Nov 2, 2023
10874c1
A very crumby commit
brandonkelly Nov 2, 2023
7986754
Action menus
brandonkelly Nov 2, 2023
2716b15
Use a site crumb on element index pages
brandonkelly Nov 2, 2023
aed15b8
Action menu button cleanup
brandonkelly Nov 2, 2023
6e7bf9a
Bring the element action menu into selectable chips & cards
brandonkelly Nov 2, 2023
43e8465
"Open in Image Editor"
brandonkelly Nov 2, 2023
5f3afb1
Fixed a couple site menu bugs and made it more configurable
brandonkelly Nov 3, 2023
ef8af19
Element editor updates
brandonkelly Nov 3, 2023
ec84bb9
Merge branch '5.0' into feature/cms-1213-fancy-crumbs-action-menus
brandonkelly Nov 3, 2023
1c48313
Fill in missing user action icons
brandonkelly Nov 3, 2023
566b46b
Merge branch '5.0' into feature/cms-1213-fancy-crumbs-action-menus
brandonkelly Nov 6, 2023
7ac7392
Unused
brandonkelly Nov 7, 2023
c9d2525
Release notes
brandonkelly Nov 7, 2023
b09b3f8
Merge branch '5.0' into feature/cms-1213-fancy-crumbs-action-menus
brandonkelly Nov 7, 2023
23b193c
User inner focus ring for hamburger button
brianjhanson Nov 8, 2023
ccbcd3b
Make `.label-link` focus visible
brianjhanson Nov 8, 2023
54aeab4
Add ability to label disclosure menu button
brianjhanson Nov 9, 2023
0b0b9f8
Separate link from button
brianjhanson Nov 9, 2023
11b61c8
Fix scrollbar flash on load
brianjhanson Nov 9, 2023
61ce86d
Separate current label text from button
brianjhanson Nov 9, 2023
5a16d93
Move icon into link
brianjhanson Nov 9, 2023
de51736
Rebuild
brianjhanson Nov 9, 2023
59ecb94
Hamburger hover follows links
brianjhanson Nov 10, 2023
0ec795d
Darken button text on hover
brianjhanson Nov 10, 2023
2413807
Build assets
brianjhanson Nov 10, 2023
a417e73
Cleanup disclosure menu hover states
brianjhanson Nov 13, 2023
34ae329
Remove titles
brianjhanson Nov 13, 2023
f14da63
Context -> Select context
brianjhanson Nov 13, 2023
96428ac
Revert spacing
brianjhanson Nov 13, 2023
60f0f39
Hide icon
brianjhanson Nov 13, 2023
f18c47b
Fix speak property (hopefully)
brianjhanson Nov 13, 2023
bacfd8e
Remove h6 from revisions menu
brianjhanson Nov 13, 2023
426966f
Refactor status html
brianjhanson Nov 13, 2023
5392c6d
Better error fix
brianjhanson Nov 13, 2023
98f3b0e
Adjust heading level
brianjhanson Nov 13, 2023
bd2885b
Make checkmark unpronouncable
brianjhanson Nov 13, 2023
1f0dc6f
Add hidden selected text
brianjhanson Nov 15, 2023
9862a71
Ability to add `headingAttributes` for menu groups
brianjhanson Nov 15, 2023
0821c2d
Allow customizing item heading tags
brianjhanson Nov 16, 2023
5979732
Merge pull request #13923 from craftcms/feature/cms-1213-fancy-crumbs…
brandonkelly Nov 17, 2023
9713bb2
CSS cleanup
brandonkelly Nov 19, 2023
2edbe82
Merge branch '5.0' into feature/cms-1213-fancy-crumbs-action-menus
brandonkelly Nov 19, 2023
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
Prev Previous commit
Next Next commit
use anchor tag as default
  • Loading branch information
i-just committed Aug 2, 2023
commit 93994f1aded22073f83fd8e0cf583591b6068c94
4 changes: 0 additions & 4 deletions src/controllers/ElementsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,6 @@ private function _additionalMenuComponents(
if ($isCurrent) {
if ($canDeleteForSite) {
$components[] = [
'tag' => 'a',
'label' => Craft::t('app', 'Delete {type} for this site', [
'type' => $isUnpublishedDraft ? Craft::t('app', 'draft') : $type,
]),
Expand All @@ -793,7 +792,6 @@ private function _additionalMenuComponents(

if ($canDeleteCanonical) {
$components[] = [
'tag' => 'a',
'label' => Craft::t('app', 'Delete {type}', [
'type' => $isUnpublishedDraft ? Craft::t('app', 'draft') : $type,
]),
Expand All @@ -813,7 +811,6 @@ private function _additionalMenuComponents(
} elseif ($isDraft && $canDeleteDraft) {
if ($canDeleteForSite) {
$components[] = [
'tag' => 'a',
'label' => Craft::t('app', 'Delete {type} for this site', [
'type' => Craft::t('app', 'draft'),
]),
Expand All @@ -829,7 +826,6 @@ private function _additionalMenuComponents(
}

$components[] = [
'tag' => 'a',
'label' => Craft::t('app', 'Delete {type}', [
'type' => Craft::t('app', 'draft'),
]),
Expand Down
7 changes: 4 additions & 3 deletions src/elements/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -1435,13 +1435,11 @@ public function getAdditionalMenuComponents(): array
$userSession->checkPermission("editImages:$volume->uid") &&
($userSession->getId() == $this->uploaderId || $userSession->checkPermission("editPeerImages:$volume->uid"))
);
$isMobile = Craft::$app->getRequest()->isMobileBrowser(true);

$components = [];

if (($url = $this->getUrl()) !== null) {
$components[] = [
'tag' => 'a',
'label' => Craft::t('app', 'View'),
'options' => [
'href' => $url,
Expand Down Expand Up @@ -1557,7 +1555,10 @@ public function getAdditionalMenuComponents(): array
'label' => Craft::t('app', 'Preview'),
'options' => [
'id' => 'preview-btn',
'class' => ['btn', 'preview-btn'],
'class' => ['btn'],
],
'data' => [
'icon' => 'view',
],
];

Expand Down
58 changes: 30 additions & 28 deletions src/templates/_layouts/components/additional-menu.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,33 @@
{% set safeComponents = additionalMenuComponents|filter(a => not (a.data.destructive ?? false)) %}
{% set destructiveComponents = additionalMenuComponents|filter(a => a.data.destructive ?? false) %}

{% if safeComponents is not empty or destructiveComponents is not empty %}
<button class="btn" id="additional-menu-btn" title="{{ 'Additional Menu'|t('app') }}"
aria-label="{{ 'Additional Menu'|t('app') }}" aria-controls="{{ menuId }}"
data-icon="ellipsis" data-disclosure-trigger="true" role="listbox" type="button"></button>

<div id="{{ menuId }}" class="menu additional-menu">
<ul>
{% for component in safeComponents %}
<li>
{{ _self.renderComponent(component, false) }}
</li>
{% endfor %}
{% if safeComponents is not empty and destructiveComponents is not empty %}
<hr />
{% endif %}
{% for component in destructiveComponents %}
<li>
{{ _self.renderComponent(component, true) }}
</li>
{% endfor %}
</ul>
</div>
{% endif %}

{% macro renderComponent(component, destructive) %}
{% set tag = component.tag ?? 'a' %}

{% set dataAttrs = [] %}
{% if component.data is defined and component.data is not empty %}
{% for key,value in component.data %}
Expand Down Expand Up @@ -43,32 +69,8 @@
aria: ariaAttrs,
}|merge(otherAttrs) %}

<{{ component.tag }} {{ attr(componentAttributes) }}>
{{ component.label }}
</{{ component.tag }}>
<{{ tag }} {{ attr(componentAttributes) }}>
{{ component.label }}
</{{ tag }}>

{% endmacro %}

{% if safeComponents is not empty or destructiveComponents is not empty %}
<button class="btn" id="additional-menu-btn" title="{{ 'Additional Menu'|t('app') }}"
aria-label="{{ 'Additional Menu'|t('app') }}" aria-controls="{{ menuId }}"
data-icon="settings" data-disclosure-trigger="true" role="listbox" type="button"></button>

<div id="{{ menuId }}" class="menu additional-menu">
<ul>
{% for component in safeComponents %}
<li>
{{ _self.renderComponent(component, false) }}
</li>
{% endfor %}
{% if safeComponents is not empty and destructiveComponents is not empty %}
<hr />
{% endif %}
{% for component in destructiveComponents %}
<li>
{{ _self.renderComponent(component, true) }}
</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% endmacro %}