Jump to content
tpr

AdminOnSteroids

Recommended Posts

3 hours ago, tpr said:

@adrian I've modified field edit links to appear on every page, for non-system fields only, please check.

Looks to be great - thank you!

  • Like 2

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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()

 

Share this post


Link to post
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).

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Would it be easier/more efficient to have << first < prev > next >> last links instead of trying to loop around at the beginning and end?

Share this post


Link to post
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 😀

Share this post


Link to post
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

Share this post


Link to post
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. 

Share this post


Link to post
Share on other sites

Thanks @tpr and @Robin S for your work and thoughts on this. I haven't had time to test thoroughly regarding template level sort etc, but I just wanted to note that the initial issue of loading all siblings is definitely now fixed :) 

  • Like 1

Share this post


Link to post
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

Share this post


Link to post
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. 

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

While we're on z-index issues, all the AOS config settings sections appear above Tracy panels as well - not a big deal since it's not a common scenario, but just wanted to let you know.

Share this post


Link to post
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.

Share this post


Link to post
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?

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

I guess there's nothing more in the logs that you already wrote. Was it a ML site btw, and if yes, how any languages? Php version? 

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By gebeer
      I am happy to present my new fieldtype FieldtypeImageFromPage. It is made up of 2 modules:
      Fieldtype Image Reference From Another Page is a Fieldtype that stores a reference to a single image from another page. The image can be selected with the associated Inputfield.
      Inputfield Select Image From Page is an Inputfield to select a single image from images on a predefined page and it's children.
      And there also is a helper module that takes care of cleanup tasks.
      This module evolved out of a discussion about my other Module FieldtypeImagePicker.  It caters for use cases where a set of images is being reused multiple times across a site. With this fieldtype these images can be administered through a chosen page. All images uploaded to that page will be available in the inputfield.
      When to use ?
      Let editors choose an image from a set of images that is being used site-wide. Ideal for images that are being re-used across the site.
      Suited for images that are used on multiple pages throughout the site (e.g. icons).
      Other than the native ProcessWire images field, the images here are not stored per page. Only references to images on another page are stored. This has several advantages:
      one central place to organize images when images change, you only have to update them in one place. All references will be updated, too. (Provided the name of the image that has changed stays the same) Features
      Images can be manipulated like native ProcessWire images (resizing, cropping etc.) Image names are fully searchable through the API Accidental image deletion is prevented. When you want to delete an image from one of the pages that hold your site-wide images, the module searches all pages that use that image. If any page contains a reference to the image you are trying to delete, deletion will be prevented. You will get an error message to help you edit those pages and remove references there before you can finally delete the image. How to install and setup
      Download and install this module like any other modules in ProcessWire Create a page in the page tree that will hold your images. This page's template must have an images field Upload some images to the page you created in step 2 Create a new field. As type choose 'Image Reference From Another Page'. Save the field. In 'Details' Tab of the field choose the page you created in step 2 Click Save button Choose the images field name for the field that holds your images (on page template from step 2) Click Save button again Choose whether you want to include child pages of page from step 2 to supply images Add the field to any template You are now ready to use the field View of the inputfield on the page edit screen:

      View of the field settings

      The module can be installed from this github repo. Some more info in the README there, too.
      In my tests it was fairly stable. After receiving your valued feedback, I will eventually add it to the modules directory.
      My ideas for further improvement:
      - add ajax loading of thumbnails
      Happy to hear your feedback!
       
    • By gebeer
      Although the PW backend is really intuitive, ever so often my clients need some assistance. Be it they are not so tech savvy or they are not working in the backend often.
      For those cases it is nice to make some help videos available to editors. This is what this module does.
      ProcessHelpVideos Module
      A Process module to display help videos for the ProcessWire CMS. It can be used to make help videos (screencasts) available to content editors.
      This module adds a 'Help Videos" section to the ProcessWire backend. The help videos are accessible through an automatically created page in the Admin page tree. You can add your help videos as pages in the page tree. The module adds a hidden page to the page tree that acts as parent page for the help video pages. All necessary fields and templates will be installed automatically. If there are already a CKEditor field and/or a file field for mp4 files installed in the system, the module will use those. Otherwise it will create the necessary fields. Also the necessary templates for the parent help videos page and it's children are created on module install. The module installs a permission process-helpvideos. Every user role that should have access to the help video section, needs this permission. I use the help video approach on quite a few production sites. It is stable so far and well received by site owners/editors. Up until now I installed required fields, templates and pages manually and then added the module. Now I added all this logic to the install method of the module and it should be ready to share.
      The module and further description on how to use it is available on github: https://github.com/gebeer/ProcessHelpVideos
      If you like to give it a try, I am happy to receive your comments/suggestions here.
    • By Robin S
      A module created in response to the topic here:
      Page List Select Multiple Quickly
      Modifies PageListSelectMultiple to allow you to select multiple pages without the tree closing every time you select a page.
      The screencast says it all:

       
      https://github.com/Toutouwai/PageListSelectMultipleQuickly
      https://modules.processwire.com/modules/page-list-select-multiple-quickly/
    • By gebeer
      Hello all,
      sharing my new module FieldtypeImagePicker. It provides a configurable input field for choosing any type of image from a predefined folder.
      The need for it came up because a client had a custom SVG icon set and I wanted the editors to be able to choose an icon in the page editor.
      It can also be used to offer a choice of images that are used site-wide without having to upload them to individual pages.
      There are no image manipulation methods like with the native PW image field.
      Module and full description can be found on github https://github.com/gebeer/FieldtypeImagePicker
      Kudos to @Martijn Geerts. I used his module FieldTypeSelectFile as a base to build upon.
      Here's how the input field looks like in the page editor:

      Hope it can be of use to someone.
      If you like to give it a try, I'm happy to hear your comments or suggestions for improvement. Eventually this will go in the module directory soon, too.
    • By bernhard
      @Sergio asked about the pdf creation process in the showcase thread about my 360° feedback/survey tool and so I went ahead and set my little pdf helper module to public.
      Description from PW Weekly:
       
      Modules Directory: https://modules.processwire.com/modules/rock-pdf/
      Download & Docs: https://github.com/BernhardBaumrock/RockPDF
       
      You can combine it easily with RockReplacer: 
      See also a little showcase of the RockPdf module in this thread:
       
×
×
  • Create New...