Jump to content

Recommended Posts

Posted

Hi everyone,

AdminThemeBridge 0.29.0 is out.

Sorry for not being very active publicly during some days. I was preparing something special for you all: Bridge extensions, a new, hopefully easier way to write Bridge-compatible modules.

What is a Bridge extension?

It is an ordinary ProcessWire module. The difference is that it changes the Bridge admin only through a published surface (the theme's hookable methods, a few public methods and settings, named slots in the admin shell, window.Bridge and DOM events), and it says what it uses in a small manifest. Bridge reads that manifest, loads the extension's JavaScript module and stylesheets, and puts its markup into the slots. Because everything goes through the published surface, your module should keep working when Bridge changes inside.

The manifest is either a getBridgeExtension() method or just a bridge key in your module info, so a simple extension needs no extra code:

public function getBridgeExtension() {

return array(
'contract' => '^0.2', // which extension contract it was written for
'module' => 'BridgeHello.mjs', // an ES module loaded in the admin
'styles' => array('BridgeHello.css'),
'slots' => array('footer' => 'renderFooter'),
'hooks' => array('renderBreadcrumbs'),
);
}

Slots: head, masthead, masthead-right, user-nav, content-head-buttons, footer, drawer and body. The drawer slot even gives your extension its own drawer next to the logo, like the page tree and history drawers. If a slot method throws, Bridge logs it and the page renders without it.

Styles and tokens (new in contract 0.2): an extension's stylesheets are printed after the theme's own, so your rules win ties without !important. 73 CSS custom properties (colours, font size, line height, field spacing...) are now public tokens you can read or set, so a styling extension can restyle the admin without touching theme internals.

The kit (in the theoretic/bridge repo):

  • a scaffold that writes a new extension for you (module, manifest, slot methods, JS module, stylesheet, checks, README);
  • contract tests that check your manifest and run your extension in a sandbox and in a browser;
  • a compatibility checker that tells you, from the files alone, whether your extensions will work with a given Bridge version;
  • a dev mode that reloads your edited JS module and stylesheets in an open admin page.

Bridge's own modules are built the same way: Bridge CSP, the demo module, the BridgeSample module (the scaffold's output, a good place to start) and a new one:

Admin access control (BridgeAdminAccessControl, optional): per-role limits on the page tree, any branch in it, and the main admin menus (Pages, Setup, Modules, Access), enforced on the server. It only narrows what ProcessWire already grants, never gives extra access, and superusers are not affected. Rules are set on the module's configuration screen.

Smaller things:

  • Content in draggable rows (the template's field list, repeater item headers) is now vertically centred.

All the details are in docs/extensions.md and the CHANGELOG in the theoretic/bridge repo.

Special thanks to @interrobang, @matjazp, @Markus Thomas and all of you for your ideas and advices giving me motivation to move further! I still have some unresolved cases; will try to resolve them later.

  • Like 1
  • Thanks 2
Posted

Hi friends!

AdminThemeBridge is out of beta. Meet AdminThemeBridge 1.x!

Battle tested in several different web projects, this admin theme is now stable, and 1.x comes with a written promise: the hooks, settings and design tokens that extensions use won't break before 2.0. The full list is in the repository (docs/surface-1.0.md), and existing extensions keep working unchanged.

A ProcessWire look by default

There are many changes under the hood, but the most obvious one is the appearance. AdminThemeBridge's default look and feel is now as close as possible to ProcessWire's own visual standards: the familiar ProcessWire red, a light grey page with white cards, and softer blue-grey borders. And it can be customized in several ways:

  • Per project: colours, logo, favicon, login screen, admin title, corner radius and field density, with Bridge Customizer (a separate module, see its own topic) or the theme's Appearance settings.
  • Per admin user: each user can pick their own colour in the user menu.
  • Light or dark: by default the admin follows the operating system's light or dark mode, and each user can switch it in the masthead.

Also new since 0.24

  • The page tree in a drawer on every screen, and a history of the screens you visited.
  • An extension kit: modules can add to the admin through documented slots, hooks and design tokens, with a scaffold and contract tests.
  • Admin access control (an optional bundled module): per-role rules on page branches and main menus.
  • Phones: no sideways scrolling any more; the search turns into an icon on small screens.
  • Many smaller fixes from an audit of the whole project, and an untranslated language tab now shows faded instead of in italics.

Thanks

Special thanks to @matjazp for his regular and detailed feedback! And, of course, many thanks to this perfect community for the kind help which made this possible 😉

Update as usual: Modules > New > "Add module from URL" with https://github.com/theoretic/AdminThemeBridge/archive/refs/tags/v1.2.0.zip or a pull of the module repository. The CHANGELOG in the repository lists every change.

  • Like 3
  • Thanks 1
  • theoretic changed the title to AdminThemeBridge – a native web-component admin that keeps your existing modules working
Posted

The per project colors and logo change is just what I needed. Thank you. I’ll be installing it this week.

  • Like 1
  • 2 weeks later...
Posted

Hi friends!

AdminThemeBridge 1.5.1 is out. Here is what changed since 1.2.0, the version announced above.

Ctrl+click opens a new tab, everywhere (1.5)

Ctrl+click (Cmd+click on a Mac) and middle click now open a new tab on things in the admin that look like links but aren't. Before, they ignored the key and opened in the same tab, or opened a dialog.

  • The module list's Settings, Install and Delete buttons. Install and Delete still ask first, then run in the new tab while your list stays where it was.
  • Buttons such as Add New on the Templates, Fields and Users lists.
  • Links that normally open a dialog, such as a field's edit link in the template editor or a PageTable row. In a new tab they open as a normal page.
  • A page title in the page tree, or a row title in Lister, opens that page's editor in a new tab. A plain click still just opens the row as before.

Shift+click and plain clicks behave as before. Module authors can make their own elements work the same way: a data-pw-href attribute is enough.

Live filter on the Modules, Fields and Templates lists (1.3)

Lists with ten or more rows get a small filter field. Type three letters and the list narrows as you type, by name, title or label, with no reload. The × button or Escape clears it. On the Modules page it follows you from tab to tab.

Readable text on light custom colours (1.4)

With a very light custom colour (a pale yellow, say), buttons and selections used to get white text you could hardly read. They now get near-black text. Mid-tone colours keep white text. This goes together with Bridge Customizer 0.4.0, which adds colour presets and contrast warnings (see its own topic).

Smoother upgrades (1.2.1)

Upgrading from an old version through Modules > Upgrades could end with an error page on the first request. That's fixed for upgrades from any earlier version.

As promised for 1.x, nothing here breaks existing extensions: the extension contract is still 1.0.

Update as usual: Modules > New > "Add module from URL" with https://github.com/theoretic/AdminThemeBridge/archive/refs/tags/v1.5.1.zip, or a pull of the module repository. The CHANGELOG in the repository lists every change.

As always, feedback and ideas are very welcome!

  • Like 2
Posted

Hi everyone,

AdminThemeBridge 1.8.2 is out. Quite a lot happened since 1.2.0, mostly things that make daily editing smoother. Here are the highlights.

One Save button, always in reach (1.7.0)

  • Edit screens used to show Save twice, at the top and at the bottom of the form. Now there is one, and it floats just below the masthead while you scroll, so it's always one click away on long pages.
  • The Save menu, Publish and "Save unpublished" float with it. Shift+click still does a classic save, and modal windows keep their buttons in the dialog footer.
  • Notices that come in while you scroll sit below the button row, so they never cover Save. TinyMCE's sticky toolbar stops below it too.

A live search that finds pages by any text field, in any language (1.8.0)

  • The masthead search now looks in every text field (Page Title, Text, Email, URL, their multi-language versions and third-party types based on Text), in every language, whatever language you're using. Textareas and rich text fields stay out.
  • Each result names the field that matched after the template, with the language in brackets when the match is in another one, for example basic-page · Subtitle (Deutsch).
  • Access is checked as for any search, and a field with access control only counts where the user may view it.
  • It runs as one query with one join, so a site with many fields and languages doesn't hit MySQL's join limit.

A warning when something changed in another tab (1.6.0)

When you come back to an admin tab, Bridge checks whether the screen you have open is still current. If the page, its template, a field on it or the field and template settings were saved elsewhere (another tab, another browser, a colleague), a dialog shows what changed, who changed it and when, and what it means for you here: for example upload types that are no longer allowed, or fields another save may overwrite. You can reload, or keep editing with a note under the headline. Saves in the same tab never warn. It can be turned off under Features.

Ctrl+click opens admin buttons in a new tab (1.5.0)

Ctrl+click (Cmd+click on a Mac) and the middle button now work on everything that behaves like a link, not only on real links: Settings, Install and Delete on the Modules list, Add New and other button links, links that open a dialog, page titles in the tree and Lister rows.

A live filter on the Modules, Fields and Templates lists (1.3.0)

A small text field filters these lists as you type, by name, title or label, from three characters on. The cross or Escape clears it. It appears only on lists of ten rows or more.

Readable text on very light colours (1.4.0)

If you pick a very light custom colour (your own colour in the user menu, or the theme's custom colour), buttons and selections on it now get near-black text instead of white. Mid-tones keep white. Bridge Customizer 0.4.0, in its own topic, adds the rest: presets, key colours and contrast warnings.

Fixes

  • In Firefox, the floating Save could push the whole page down by the scroll distance when something reflowed, so an images field seemed to vanish on thumbnail hover. Fixed in 1.8.1.
  • On file fields, a click on the "Choose file" text did nothing; only the bottom edge of the button reacted. Fixed in 1.8.2, in every browser.
  • Upgrading from the Modules page could end in an error page on the first request (the upgrade itself had completed). From 1.2.1 on, the template files check the class and ask for a Modules > Refresh instead.

For module authors

  • The form's own submit buttons are now hidden on edit screens (the floating copies click them). A script that looks for a visible original button should look for its <id>_copy instead.
  • data-pw-href makes any element open in a new tab on Ctrl+click; ProcessWireAdminTheme.newTab.add(selector, fn) adds your own kind of element.
  • A new hook, changeDeps(), lets a module add what a screen depends on to the change warning.
  • All additions, so the 1.0 promise holds: existing extensions keep working unchanged. Details are in docs/contract.md and docs/extensions.md.

Updating

Modules > New > "Add module from URL" with https://github.com/theoretic/AdminThemeBridge/archive/refs/tags/v1.8.2.zip or a pull of the module repository, then Modules > Refresh. The CHANGELOG in the repository lists every change.

Many thanks to everyone who sent reports and ideas. As always, I'm open to any suggestions, so don't hesitate to write to me 😉

  • Like 1
  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...