Jump to content

AdminOnSteroids


tpr

Recommended Posts

Looks like the "Add links to edit previous and next pages" feature results in all sibling pages being loaded - this can be problematic if there are lots of siblings.

image.png.9a2bce06131feb681853234d46a863d0.png

As soon as I disable that feature it drops down to ~100 pages loaded.

Link to comment
Share on other sites

Just had a look for the cause of this and it's: 

$siblings = $this->editedPage->siblings;

which of course loads all siblings.

I think you'll need to do:

$numSiblings = $this->editedPage->parent->numChildren();

or you could separately check if prev and link page ids exist without the siblings check at all. I know you wanted the links to loop back to first when at the end etc, but I think that needs to be a separate page->get() if at end. Does that make sense?

  • Like 1
Link to comment
Share on other sites

14 hours ago, adrian said:

Does that make sense?

Sure, thanks for the help. I've managed to get the first children by using $parent->find('...., limit=1')->first(), so that it doesn't load all pages. For the last child I plan to use $parent->find('..., start=$numSiblings-1, limit=1')->first() which should not load all pages (haven't had the chance to try yet).

I think  these will be fine but if you know a simpler approach, please tell.

  • Like 2
Link to comment
Share on other sites

4 hours ago, tpr said:

Sure, thanks for the help. I've managed to get the first children by using $parent->find('...., limit=1')->first(), so that it doesn't load all pages. For the last child I plan to use $parent->find('..., start=$numSiblings-1, limit=1')->first() which should not load all pages (haven't had the chance to try yet).

I think  these will be fine but if you know a simpler approach, please tell.

How about:

$this->editedPage->siblings('sort=-sort, limit=1')->first()

 

Link to comment
Share on other sites

That would probably work too, will check both later, thanks. Btw "sort" could have been empty before todays update so this I guess would not worked (not sure if sort="-" is valid).

Link to comment
Share on other sites

10 hours ago, adrian said:

How about:


$this->editedPage->siblings('sort=-sort, limit=1')->first()

 

I have a feeling this won't work where a sort setting has been defined on the parent page or template. When that is done the sort property of the child pages does not change, so doing a reverse sort on that property would result in the wrong order.

Link to comment
Share on other sites

That wouldn't solve the template level sort issue when having pages with multiple templates under the same parent. I'm sure the answer lies somewhere in the core but I will leave it there for a while ?

Link to comment
Share on other sites

31 minutes ago, tpr said:

Actually @adrian's idea works better, even with template-level sort order too, but only if children are of the same template, or their template sort settings are identical.

Not sure if that was a reply to my comment, but Adrian's idea isn't working when I test it with sort settings applied to the parent page or template.

I think it would have to be something like this:

$parent = $this->editedPage->parent;
if($parent->id) {
    $sort = $parent->template->sortfield ?: $parent->sortfield;
} else {
    $sort = 'sort';
}
$first = $this->editedPage->siblings("sort=$sort, limit=1")->first();
$last = $this->editedPage->siblings("sort=-$sort, limit=1")->first();

Getting a single page could be simplified with findOne(), but not sure if you care about supporting < PW 3.0.3   scratch that

  • Like 2
Link to comment
Share on other sites

Are you sure that the template level sort order is taken from the parent page, and not from children pages? That would make things easier, I'll check tomorrow. 

Link to comment
Share on other sites

Everything looks fine to me in v1.8.9, thanks everyone for the help. It was new to me that template level sort order takes only the parent page into account, I thought the child pages' templates are also involved somehow.

  • Like 4
Link to comment
Share on other sites

@tpr, this is a minor thing, but I'm wondering if the magnifying glass icon could be changed perhaps.

One thing is that its direction changes in different usages:

2018-04-08_134847.png.142873d0059f90ce130bdbf35fb123b5.png2018-04-08_134833.png.f1a5ec4bfdd227c3d43d3de2699a77e7.png

Another thing (and this is a personal opinion) is that this coloured icon is kinda ugly. It's style is too different to other icons in the UI and it stands out too much. I see that the icon is rendered using Segoe UI Emoji, so maybe the coloured appearance is just a Windows thing? Maybe you could use the Font Awesome version that is bundled with PW (although the magnifying glass icon there is also pretty naff). Or maybe bundle the Material Icons font with AOS? That could be quite handy in general, because then those icons would be available for use in admin UI customisations. 

Link to comment
Share on other sites

Hey @tpr - there is an issue with the z-index when using the fixed/sticky navbar option. Tracy's panels appear under the navbar even though their z-index is higher. Setting the z-index of the navbar to 0 is the only value that puts it behind the Tracy panels. I don't honestly know what the correct solution is, but position:fixed and z-index does seem to have some weird issues. Maybe this is useful? https://developers.google.com/web/updates/2012/09/Stacking-Changes-Coming-to-position-fixed-elements 

  • Like 1
Link to comment
Share on other sites

3 minutes ago, adrian said:

Tracy's panels appear under the navbar

I can confirm this and there is a similar issue with Lister's "refresh" and "reset" icon buttons, which are also partially covered by the standard "Sticky header" (I never used the Compact option besides testing it once upon a time).  

  • Like 1
Link to comment
Share on other sites

Thanks, these should be fixed in v1.9.0. 

@adrian

Tracy panels are under one #tracy-debug div so I've added a high z-index to it - I guess nothing needs to be above them. This fix has been there for the individual panels for the Reno theme already though I'm not sure if it was effective. Now it seems to be OK in all the major admin themes.

Link to comment
Share on other sites

Just now, tpr said:

Tracy panels are under one #tracy-debug div so I've added a high z-index to it - I guess nothing needs to be above them.

Thanks for trying - not sure about this actually. I actually set Tracy to 100 so that panel appear under PW dropdown menus because it's a pain when a panel is open and you want to navigate in the PW admin.

If you don't know of another solution, I think I'd rather see the #tracy-debug z-index left alone because it is configurable in Tracy's settings for a reason. Is that ok?

Link to comment
Share on other sites

I see, forgot about that config setting in Tracy. Setting z-index: 1 for #tracy-debug looks like fixing the issue for the sticky header vs menus in Uikit theme, but I guess that would still spoil the Tracy config setting.

Edit: I've removed the #tracy-debug z-index rule, I think the safest is keeping the navbar above all.

  • Like 1
Link to comment
Share on other sites

AOS 1.8.9 crashing ProcessWire 3.0.94, when setting Misc->"Add language switcher to the admin".

Error Message:

Quote

Method Page::translator does not exist or is not callable in this context (in /wire/core/Wire.php line 519)

I have to remove the item in the database under modules AdminOnSteroids -> data to get PW running again.

What could this be?

Thank you.

Link to comment
Share on other sites

No problems here on PW 3.97 and 3.98, AOS 1.8.9 and 1.9.0. There was a related PHP warning that was fixed in AOS 1.8.7 but that's below your version.

Did you get that error right after saving AOS or happened elsewhere?

Link to comment
Share on other sites

4 minutes ago, tpr said:

Did you get that error right after saving AOS or happened elsewhere?

Right after. Click "Save" and goodbye.

Might be some interaction with other stuff, but I don't know what to look for.

Link to comment
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
×
×
  • Create New...