Recommended Posts

Hey @Robin S - weird bug when editing a language page:

image.png.78a881b4c6a4b81c2eed7c6444c2dadc.png

 

PS - same goes for:  Admin > Access > Users and I expect probably anything else that isn't a "normal" page.

  • Like 2

Share this post


Link to post
Share on other sites
7 hours ago, adrian said:

weird bug when editing a language page

Thanks, should be fixed in v0.1.4.

  • Like 2

Share this post


Link to post
Share on other sites
2 minutes ago, Robin S said:

Thanks, should be fixed in v0.1.4.

Looks to be working great here - thanks!

  • Like 1

Share this post


Link to post
Share on other sites

Hey Robin - I am really loving this module - it's becoming one of my key navigation tools, so thank you!

This might be feature creep so I definitely won't mind if you don't think this is a good idea, but I was thinking an "Add New" link at the top of each list could be quite useful.

  • Like 2

Share this post


Link to post
Share on other sites

v0.1.6 released - introduces a feature for adding a new sibling page, as requested above by Adrian.

2018-09-06_102418.png.ea11157a4f5c5b6fda79f47d6700d424.png

  • Like 4

Share this post


Link to post
Share on other sites

Awesome thanks so much - this is really speeding my workflow up today.

  • Like 3

Share this post


Link to post
Share on other sites

Hey @Robin S - any reason why the find siblings method doesn't use "include=all" ?

I am assuming it was just an oversight, but it would be nice to have please.

Thanks!

  • Like 1

Share this post


Link to post
Share on other sites
On 9/11/2018 at 9:50 AM, adrian said:

any reason why the find siblings method doesn't use "include=all" ?

Yes, it was an oversight.

As more states need to be indicated in the dropdown items it gets harder to come up with distinguishable and tasteful styles for all of them. I think the hidden and unpublished pages need to use the same styling as in Page List, so that means I've had to change the styling for uneditable pages - these are now indicated by italics and reduced opacity (and the "not-allowed" cursor for devices that support hover).

Other changes introduced in v0.1.7:

  • The dropdowns now take $page->listable into account, so non-listable pages do not appear in the dropdowns.
  • There is now a hookable BreadcrumbDropdowns::getSiblings method in case anyone wants to override the listed siblings for a page. This won't be needed in most cases though.
  • Like 1

Share this post


Link to post
Share on other sites

Just had another thought 🙂

For pages with more than 25 siblings, I wonder if it would be worth putting the current page in the middle of the list of options, with 12 before and 12 after. At the moment, if the page being edited is beyond the first 25 it doesn't show in the list and so there is no way to access pages on either side of the current one.

I think this is fairly efficient:

    public function ___getSiblings($page) {
        $numSiblings = $page->parent->numChildren();
        $start = $numSiblings > 25 ? ($page->index - 12 > 0 ? $page->index - 12 : 0) : 0;
        while($numSiblings - $start < 25) $start--;
        $siblings = $page->siblings("start=$start, limit=25, include=all");
        $siblings->filter("listable=1");
        return $siblings;
    }

Instead of this where you can't see page "27" in the list:

image.png.b4e28caaec0dc30e45adfc267a39b311.png

 

you now get this with it right in the middle:

image.png.c6c9b15b78002df51899b53a7fee42dc.png

 

You probably need to do some more testing to make sure there are no issues with sorting. Maybe the selector needs: sort=sort

Did some testing here and it seems to be working great.

 

  • Like 3

Share this post


Link to post
Share on other sites

Sorry, just updated above to make sure $start is not less than 0

Share this post


Link to post
Share on other sites

One more update to handle when you're close to the end of the siblings. There might be a better way to do this - this was just what came to mind quickly 🙂

  • Like 1

Share this post


Link to post
Share on other sites
5 hours ago, adrian said:

For pages with more than 25 siblings, I wonder if it would be worth putting the current page in the middle of the list of options, with 12 before and 12 after.

Great idea, thanks! Added in v0.1.8.

  • Like 3

Share this post


Link to post
Share on other sites

v0.1.10 released. Fulfilling a request by @adrian, if the currently edited page has children or the user may add children, a caret at the end of the breadcrumbs reveals a dropdown of up to the first 25 children and/or an "Add New" link.

2018-09-14_122245.png.c96005626bae59aacdf75b21e77f5c18.png

 

  • Like 4

Share this post


Link to post
Share on other sites
5 minutes ago, Robin S said:

v0.1.10 released. Fulfilling a request by @adrian, if the currently edited page has children or the user may add children, a caret at the end of the breadcrumbs reveals a dropdown of up to the first 25 children and/or an "Add New" link.

2018-09-14_122245.png.c96005626bae59aacdf75b21e77f5c18.png

 

Awesome - thank you!

Share this post


Link to post
Share on other sites

v0.1.11 released.

Thanks to a pull request from @adrian, this update wraps the last breadcrumb item in a link to the page tree (like the other breadcrumb items) and also standardises the page tree links so they always include an "open" parameter to load the tree opened to the clicked page. This is a change from the core breadcrumbs, which treats the link on parent breadcrumb item differently. There is discussion on this topic here: https://github.com/processwire/processwire-issues/issues/22

My opinion is that the breadcrumb tree links should be treated consistently, and if you want to go back to the page tree in its last state you can click the ProcessWire logo or "Pages" or "Pages > Tree" in the main admin menus.

  • Like 2

Share this post


Link to post
Share on other sites

Hey @Robin S - looks like there is a bug when you're editing an unpublished page - it ends up messing up the $start value for the siblings selector so I end up with a list of pages that are nowhere near the page I am editing.

Let me know if you can't reproduce and I'll see if I can figure out the problem later.

Share this post


Link to post
Share on other sites
22 minutes ago, adrian said:

Hey @Robin S - looks like there is a bug when you're editing an unpublished page - it ends up messing up the $start value for the siblings selector so I end up with a list of pages that are nowhere near the page I am editing

Thanks, seems like a core issue with Page::index(): https://github.com/processwire/processwire-issues/issues/751

Will see if I can find a workaround for the short term.

  • Like 1

Share this post


Link to post
Share on other sites

@adrian, I've added a substitute getPageIndex() method to the module so the issue should be fixed in v0.1.12. Probably not as efficient as the core Traversal methods but should be okay unless you have a massive number of siblings.

  • Like 2

Share this post


Link to post
Share on other sites

Thanks @Robin S - really appreciate the quick fix. I actually have ~5000 siblings and it still seems to be working ok.

  • Like 3

Share this post


Link to post
Share on other sites

@Robin S Thanks a lot for this module.

Is it possible to show also custom page list names?

i.e. if I define in my template to use certain fields for page list

{title} {client_name} {pl_active_only} {year}

(edit template > tab "advanced")

I still only see the default title being displayed.

  • Like 1

Share this post


Link to post
Share on other sites
Just now, dragan said:

@adrian Thanks a lot for this module.

I think you mean @Robin S 🙂

Share this post


Link to post
Share on other sites

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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Anssi
      A simple module to enable easy navigation between the public and the admin side of the site. After installation a green bar will appear to the upper side of the screen, containing a few navigation elements and displaying the PW version number.
      Heavily inspired by @apeisa's great AdminBar (Thanks!). I needed a bit simpler tool for my projects and as a result, this was made. Available on GitHub .

    • By Sebi
      I've created a small module which lets you define a timestamp after which a page should be accessible. In addition you can define a timestamp when the release should end and the page should not be accessable any more.
      Github: https://github.com/Sebiworld/PageAccessReleasetime
      Usage
      PageAccessReleasetime can be installed like every other module in ProcessWire. Check the following guide for detailed information: How-To Install or Uninstall Modules
      After that, you will find checkboxes for activating the releasetime-fields at the settings-tab of each page. You don't need to add the fields to your templates manually.
      Check e.g. the checkbox "Activate Releasetime from?" and fill in a date in the future. The page will not be accessable for your users until the given date is reached.
      If you have $config->pagefileSecure = true, the module will protect files of unreleased pages as well.
      How it works
      This module hooks into Page::viewable to prevent users to access unreleased pages:
      public function hookPageViewable($event) { $page = $event->object; $viewable = $event->return; if($viewable){ // If the page would be viewable, additionally check Releasetime and User-Permission $viewable = $this->canUserSee($page); } $event->return = $viewable; } To prevent access to the files of unreleased pages, we hook into Page::isPublic and ProcessPageView::sendFile.
      public function hookPageIsPublic($e) { $page = $e->object; if($e->return && $this->isReleaseTimeSet($page)) { $e->return = false; } } The site/assets/files/ directory of pages, which isPublic() returns false, will get a '-' as prefix. This indicates ProcessWire (with activated $config->pagefileSecure) to check the file's permissions via PHP before delivering it to the client.
      The check wether a not-public file should be accessable happens in ProcessPageView::sendFile. We throw an 404 Exception if the current user must not see the file.
      public function hookProcessPageViewSendFile($e) { $page = $e->arguments[0]; if(!$this->canUserSee($page)) { throw new Wire404Exception('File not found'); } } Additionally we hook into ProcessPageEdit::buildForm to add the PageAccessReleasetime fields to each page and move them to the settings tab.
      Limitations
      In the current version, releasetime-protected pages will appear in wire('pages')->find() queries. If you want to display a list of pages, where pages could be releasetime-protected, you should double-check with $page->viewable() wether the page can be accessed. $page->viewable() returns false, if the page is not released yet.
      If you have an idea how unreleased pages can be filtered out of ProcessWire selector queries, feel free to write an issue, comment or make a pull request!
    • By David Karich
      Thanks to the great Pro module "RepeaterMatrix" I have the possibility to create complex repeater items. With it I have created a quite powerful page builder. Many different content modules, with many more possible design options. The RepeaterMatrix module supports the cloning of items, but only within the same page. Now I often have the case that very design-intensive pages and items are created. If you want to use this module on a different page (e.g. in the same design), you have to rebuild each item manually every time.
      With this proof of concept I have created a module which adds the feature to copy a repeater item to the clipboard so that you can paste this item to another page with the same repeater field. The module has been developed very rudimentarily so far. It is currently not possible to copy nested items. There is also no check of Min/Max. You can also only copy items that have the same field on different pages. And surely you can solve all this more elegantly with AJAX. But personally I lack the deeper understanding of the repeaters. Also missing on the Javascript side are event triggers for the repeaters, which would make it easier. Like e.g. RepeaterItemInitReady or similar.
      it would be great if @ryan would implement this functionality in the core of RepeaterMatrix. I think he has better ways to implement this. Or what do you think, Ryan?
      Everybody is welcome to work on this module and improve it, if it should not be integrated into the matrix core. Therefore I put it for testing and as download on GitHub: https://github.com/FlipZoomMedia/InputfieldRepeaterMatrixDublicate
      You can best see the functionality in the screencast: 
       
    • By anderson
      Hi,
      Please take a look at this:
      https://templatemag.com/demo/Good/
      The upper nav bar, including dropdowns like "pages" and "portfolios", what do you call this whole thing? At first I guess it's called "dropdown nav bar", but seems not.
      AND of course, what's the simplest way/module to achieve this in PW?
      Thanks in advance.
    • By Sebi2020
      Hey, I'm new and I created a simple module for tagging pages because I didn't found a module for it (sadly this is not a core feature). This module is licensed under the GPL3 and cames with absolutly no warranty at all. You should test the module before using it in production environments. Currently it's an alpha release. if you like the module or have ideas for improvements feel free to post a comment. Currently this fieldtype is only compatible with the Inputfield I've created to because I haven't found  an Inputfield yet, that returns arrays from a single html input.
      Greetings Sebi2020
      FieldtypeTags.zip.asc
      InputfieldTagify.zip
      InputfieldTagify.zip.asc
      FieldtypeTags.zip