Skip to content

Commit

Permalink
feat: add PageListQuickActions tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardBaumrock committed Mar 23, 2023
1 parent f2be261 commit fa8f857
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tweaks/PageListQuickActions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace RockMigrations\Tweaks;

use ProcessWire\HookEvent;

class PageListQuickActions extends Tweak
{
public $description = "Shows action buttons instantly on row hover for superusers";

public function ready()
{
if (!$this->wire->user->isSuperuser()) return;
if ($this->wire->page->template != 'admin') return;
$this->wire->addHookAfter("Page(template=admin)::render", $this, "addStyle");
}

public function addStyle(HookEvent $event)
{
$event->return = str_replace(
"</head>",
"<style>
/* PageListQuickActions */
.PageListActions {
transition: opacity 0.3s ease;
}
.PageListItem:hover > .PageListActions {
display:inline !important;
opacity:1 !important;
}
</style></head>",
$event->return
);
}
}

0 comments on commit fa8f857

Please sign in to comment.