Skip to content

PageListTweaks

Roland Toth Pal edited this page Oct 28, 2019 · 9 revisions

Pagelist related tweaks

  • Highlight rows on hover: adds a slight background color on the hovered row. Works in pagelists and data tables (eg. Finder, modules list, etc). In pagelists an opened state item gets bold and a darker underline.

  • Show page IDs: adds the page ID after each page name in a superscript (visible for superusers only)

  • Add pagelist Delete action and page edit checkbox to bypass Trash: adds a new extra action to pagelist items called "Delete". Clicking on this will show a confirmation link and clicking on this the page will be permanently deleted (bypassing the Trash). The feature is disabled on pages having child pages and it's visible for superusers only. Tip: hold Ctrl while clicking to skip the confirmation part. If this tweak is enabled, superusers will have a "Skip Trash?" checkbox under the page edit Delete tab which allows deleting the page instead trashing.

  • Add Refresh button: adds a new extra action to pagelist items called "Refresh". Clicking on this will refresh the current pagelist item along with its children. This can be handy if you renamed a page or deleted it or its children in another browser tab, so you can refresh the branch without worrying to lose focus.

  • Add Sticky button to pagelist: adds a new extra action to pagelist items called "Sticky". This action will increase the page's "sticky" field value so it will go to the top of the pagelist (beneath its parent). If a page is set to "sticky" then you can unsticky it and the page will go back to its original position. On each sticky change the corresponding pagelist branch will refresh so you can immediately see the new sort order. The module modifies the sort order of the pages by prepending sort=-sticky but keeps the existing template or parent level order too. This affects the admin pagelists only but you can use it on the frontend by using sort=-sticky, sort=sort, where the second sort can be arbitrary (keep "sort=sort" to retain the admin order). This tweak requires a global FieldtypeInteger field called "sticky" that will be installed if it's not available. If you would like to uninstall the global "sticky" field, disable this tweak and remove manually.

  • Add unselect/restore buttons to PageListSelect: a rewrite of Bernhard Baumrock's PageListSelectUnselectButton module which allows clearing of PageListSelect field value using a dedicated button. Additionally, this tweak adds a "restore" functionality too. Note that if there is no previous value to restore, the restore button will not show up. Many thanks for Bernhard for the idea and help!

  • Icon-only pagelist actions: hide pagelist action texts and use icons instead. The action text is shown as a title attribute. This setting also replaces Lister actions with icons.

  • Use middle mouse click/ctrl+click to View/Edit page: if enabled, middle-mouse click on pagelist item name will open the corresponding page in a new tab (frontend). Holding down the ctrl key on middle-mouse click will open the page for editing (also in a new tab). Besides regular pagelists Lister items are also supported. Both actions fire only if the View or Edit links ar available on the item. Some browsers may ask for a permission to open a new tab.

  • Make active pagelist items bold: when a pagelist item is clicked (opened) then it becomes bold to make it move visible.

  • Always show pagelist actions: show all (non-extra) pagelist items by default (non only on hover)

  • Always show extra actions: do not hide extra actions - note that extra icons will appear only after the first mouse hover on the pagelist row

  • Allow markup tokens for "List of fields to display": enables adding custom markup to pagelist fields displayed. See details below.

  • Add counters to pagelist items: adds counters (01-...) before pagelist items, making it easy to see the the ordinal number of a page. Counters are reset on each branch.

  • Show pagelist actions on full row hover: makes pagelist actions visible on hovering anywhere in the pagelist, not only on the page title

  • Add Trash action also for non-SuperUsers: by default the Trash button is not available for non-SuperUsers but can be enabled here. Tip: hold Ctrl while clicking to skip the confirmation part.

Allow markup tokens for "List of fields to display"

Go to "Admin -> Setup -> Templates -> Advanced (tab) -> List of fields to display in the admin Page List" to enter fields and markup tokens. Surround fields with "[tag][/tag]".

You can use any tag, however it is recommended to use "em" as it doesn't conflict with existing pagelist tags, and the module has some built-in styles for them too, including a separator dot.

{title} [em.company][b]{company_ref.title}[/b][/em] [em][i]images: {images.count}[/i][/em]

Using classes

Use "[tag.className]" if you need to add a CSS class to add your own styling. Adding multiple classes is possible using additional dots, eg. "[tag className.anotherClassName]". ProcessWire strips slashes so you have to use double underscores if you need them. For example, adding a fontawesome icon is possible like this - this will output "":

[i.fa.fa__plane][/i]

Multi-language field properties

Displaying labels on multilanguage installs is possible using "%field.property%" syntax (ProcessWire by default shows property only in the default language). In this case AdminOnSteroids will try to load the property in the current language and falls back to the default language. Here is how to display the "images" field label (followed by the images count):

{%images.label%}: {images.count}

Date filter

This tweak adds a "date" filter to output human readable dates for date fields without output format set.

Using the following syntax - only "|date" is required, the date format is optional, defaults to "%Y-%m-%d". See PHP's strftime function for the available placeholders.

({date_created}|date:%Y/%m/%d)

From version 1.9.3 it is possible to use ProcessWire's relative date formatting too, see documentation here. For example, to add a "modified 2 hours ago by admin" to the pagelist, use this:

{title} [em][i]modified ({modified}|date:relative) by %modifiedUser%[/i][/em]

%modifiedUser% is a special token to be replaced by the user name who has modified the page the last time. You can also use %createdUser% if you need the user's name who originally created the page.

Empty values

To avoid empty values (eg. showing "images:" followed by no value) the module will add the "Ø" (slashed zero) character. This makes it easier to see that the field in question is empty ("images: Ø").

If this tweak is disabled, the module will remove the markup tokens and date filters and show the original content.

Pagelist markup:

PageListMarkup

Pagelist unselect in action:

PageListUnselect

PageListTweaks:

PageListTweaks

Clone this wiki locally