ProcessWire core updates (2.5.24)

Minification

This week I saw the Optical Circuit demo by 0x4015 and my mind was blown. This is a 4k demo… no, not a demo for 4k screens, an actual self executing demo (.exe file) that takes up just 4096 bytes (soundtrack included), and runs in real-time (if you download it rather than watching it on YouTube). But for your convenience, here it is on YouTube:

Just for comparison sake, the small ProcessWire logo that you see in the ProcessWire admin (or the one you see on this page in the upper left corner, not including the P mark) takes up about 4k. And those are already compressed images.

Seeing what could be done with 4096 bytes in that demo made me think the least we could do was to slim down our JS and CSS assets. This week support was added for all modules to have alternate minified assets in addition to the current non-minified assets. When the minified JS or CSS files are present, and debug mode is off, the minified versions get used instead of the non-minified versions.

For example, a file like inputfields.js was getting well above 30k, and the minified version runs at about 13k. Similar results appear in dozens of JS files used throughout the system.

Minified versions of CSS files are also supported, but many are already minified (those that come from Sass origins at least), and there aren't many large CSS files in the system outside of the admin theme.

If you are a module developer, you may find it useful to include YourModule.min.js and YourModule.min.css files in addition to your YourModule.js and YourModule.css files. The core now recognizes and uses them when appropriate.

Field dependencies upgrades

Field dependencies now support OR values, thanks to a PR from LostKobrakai. Where you could previously only specify field=foo, now you can specify field=foo|bar to say that "field" can contain "foo" or "bar" (or more OR conditions if you'd like). While we were in there, we went ahead and upgraded it so that you could also specify OR conditions for the field portion. Meaning, you could do: this_field|that_field=value. You can combine them too, though we're guessing not many will need to go that far.

Something else you can now do is match checkbox and radio button fields by their label. Previously you had to specify the page ID, and perhaps it's best that you still do that… But for quick needs or FormBuilder use, you may find it more convenient to say page_field=Something rather than page_field=123.

These field dependencies work in both the ProcessWire core and FormBuilder. They can be specified globally for a field, and/or contextually for a field in a specific template.

Shift-click with multi-checkbox fields

Multi-checkbox fields now support shift-click to select a group of checkboxes at once, thanks to a PR from awt2542. In addition to working with InputfieldCheckboxes, it also works for checkboxes in any table (that uses MarkupAdminDataTable).

More options for modal windows

We've had a couple of requests to provide more options for modal window configuration, beyond just the width/height offset for the 4 different modal sizes (small, medium, large, full). As a result, we've added the ability to specify additional configuration settings for each of those modal window sizes, including: draggable, resizable, time to reveal (show), time to close (hide), modal behavior, and more. See the commit to config.php comments for more.

ProcessUser dropdown upgrade

When you've got 100+ users in your system, the current dropdown menu for Access > Users isn't particularly useful, because you'll only see the first 100 users in alpha order. We've updated it so that when you've got more than 50 (or 100) users, it now defaults to showing a list of roles and a count of how many users are in that role. Click it and it takes you to a Lister showing those users. If you have fewer than that threshold number of users and still want that behavior, you can set the threshold quantity of users in the ProcessUser module settings.

More PRs on the way

Special thanks this week to those that submitted pull requests and/or helped update the core: LostKobrakai, esrch, teppokoivula, diogo, boundaryfunctions, adrianbj, awt2542, and anyone else I've forgotten to mention here. We've also got many more pull requests to get through in the coming weeks, thank you coding with PW!

Comments

  • adrian

    adrian

    • 10 years ago
    • 163

    An awesome week of updates and refinements! So cool to see more devs getting involved in contributing to PW.

  • Benjamin

    Benjamin

    • 10 years ago
    • 43

    With http/2 coming up concatenation will become less of an issue (more on that here https://mattwilcox.net/web-development/http2-for-front-end-web-developers). So I don't know if it would be worth the effort.

    • Teppo

      Teppo

      • 10 years ago
      • 33

      Seems to me that HTTP/2 is still going to require support from web-servers, and the big guys have just started working on that, which means that it could take a while before this gets serious footing.

      Taking a quick look around, nginx has planned to support HTTP/2 by the end of 2015, IIS is currently in beta-testing mode, and Apache doesn't seem to have any (official & public) plans yet.

      Valid point either way, and definitely something to keep an eye out for. I've got a tendency to expect the worst, which in this case means that I don't expect this to be really common and/or usable until years from now (at best), and even then there will be late adopters who won't benefit from this until much later.

      Hopefully I'm wrong, though (sure wouldn't be the first time), and thanks for bringing this up! :)

  • Tom Reno

    Tom Reno

    • 10 years ago
    • 104

    Great work everyone! Dependencies supporting OR values is an update I've been hoping for, and it's really rocking my world!

  • Yannick Albert

    Yannick Albert

    • 10 years ago
    • 44

    For sure, the browser would do its best to give us the best expirience to the user. But what if we destroy this behaviour, as someone did earlier in main.js for AdminThemeDefault?! (By the way, i liked the comment "prevent a clicked link from jumping back to the top of page (makes the UI nicer)". Nope, not nicer. ;)

    In admin, this is fixed due https://github.com/ryancramerdesign/ProcessWire/commit/85ed72cc563d0b0c88dd7456036d593ac39a18ae#diff-f7d34faebc2f7d015f7cd242a13b9a05

    But, links in the modules-section, on this site, always fails as of this shitty thing: "/site/templates/scripts/main.js" (jQuery("ul.modules li").click...). We could prevent that by adding something like this: `event.metaKey || event.shiftKey || event.ctrlKey || event.which > 1`.

  • Teppo

    Teppo

    • 10 years ago
    • 43

    I'm particularly thrilled about the minification support; performance is a wonderful thing!

    Coincidentally I've been wondering whether it would be possible to combine requests for static assets (mainly JS/CSS) while in the admin. While technically possible, I'm not entirely sure if it would really be feasible, though.

    Since each page could potentially load different assets, we might end up with page-specific cache files, and that could get very ugly very fast. Perhaps I'm missing something obvious here, though.. anyone? :)

    • ryan

      ryan

      • 10 years ago
      • 33

      Cmd/Ctrl-Click has always worked fine for me. You don't need JS for that. The browser handles that one natively.

      • Yannick Albert

        Yannick Albert

        • 10 years ago
        • 34

        My rant for this week...

        "Fancy Shift-click multi-checkbox fields", but cmd/ctrl-click is still a pain.

         

        Latest news

        • ProcessWire Weekly #552
          In the 552nd issue of ProcessWire Weekly we'll check out the latest weekly update from Ryan, take a quick look at a new e-commerce solution for ProcessWire, and more. Read on!
          Weekly.pw / 7 December 2024
        • Custom Fields Module
          This week we look at a new ProFields module named Custom Fields. This module provides a way to rapidly build out ProcessWire fields that contain any number of subfields/properties within them.
          Blog / 30 August 2024
        • Subscribe to weekly ProcessWire news

        “The end client and designer love the ease at which they can update the website. Training beyond how to log in wasn’t even necessary since ProcessWire’s default interface is straightforward.” —Jonathan Lahijani