Jump to content

AdminHelperLinks - shortcut links to edit fields and template directly from page edit


Richard Jedlička
 Share

Recommended Posts

Hi I created new module for adding links to quickly edit a field directly from page edit. 

https://processwire.com/modules/admin-helper-links/

admin-helper-links.thumb.png.3220f23c38da003c6ed4b4b5d063c460.png

You probably already know existing module HelperFieldLinks created by @Soma which was my inspiration. I was using that module for a long time so thank you @Soma! The reasons for this new module are that HelperFieldLinks seems inactive and contains few bugs. I decided to try to fix them, but after a short time I realized a better (i think) and simpler solution and also got some new ideas how to improve. I used javascript instead of PHP and modified a code which is already in PW source code to show field names when you hover the inputfield's expand arrow (in debug mode). I also moved the cog icon next to the expand icons which doen't break the layout so much. What is missing is the field info panel with it's props, never used it, but it can be done too. The template edit links needs to be added too. 

If you got some ideas how to improve, tell me.

  • Like 11
  • Thanks 1
Link to comment
Share on other sites

Hello,

Thank you for sharing your module. I used to install AdminOnSteriods on all of the sites I work on, which module (among lots of other features) can do the same. However, since AdminOnSteroids might not be maintained in the future, I started not to use it. What I am really missing without AdminOnSteroids is this feature you implemented, and a similar one, which is a link to the edit template page.

So my first idea to improve the module would be to add an "Edit template: templatename" link next to the title of the page (H1 id="pw-content-title" in the html source of the page). 

BTW, I installed it and the cog icon does not show up, because you hardcoded the admin url into the module. Could you please us $pages->get($config->adminRootPageID)->url instead? Yeah, it involves PHP, but: https://processwire.com/talk/topic/8343-access-page-and-pages-variables-from-inside-a-javascript-file/

 

Or maybe some knows that the admin URL is already provided by the PW admin on the JavaScript side as well?

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

6 hours ago, szabesz said:

Thank you for sharing your module. I used to install AdminOnSteriods on all of the sites I work on, which module (among lots of other features) can do the same. However, since AdminOnSteroids will might not be maintained in the future, I started not to use it. What I am really missing without AdminOnSteroids is this feature you implemented, and a similar one, which is a link to the edit template page.

Same here ? So thx for you module!

@szabesz you know that tracy shows the template in the panel (and it's a link)

W741xwH.png

@Richard Jedlička you can add uk-tooltip attribute then AdminThemeUikit will show the title="foo" as nice tooltip on hover ?

  • Like 2
Link to comment
Share on other sites

38 minutes ago, bernhard said:

you know that tracy shows the template in the panel (and it's a link)

Thanks, since it is not so intuitive to look there (and AOS has probably spoiled me, and I often hide/disable Tracy anyway...) I keep forgetting it. Also, I do not work on PW projects these days too much, so my memory is fading, but I'm trying to keep it fresh by reading all the forum posts that look "interesting".

Side note: I could have just implemented my own module like this one as it is not rocket science to do it but I do not have free time these days I'm afraid, so I am happy to see that someone deals with these features, and puts those links into the positions where l would look for them.

Link to comment
Share on other sites

  • Richard Jedlička changed the title to AdminHelperLinks - shortcut links to edit fields and template directly from page edit
  • 2 weeks later...

Thanks @Richard Jedlička, seems like a very useful module!

One thing I would love to be able to do is to limit use of these links by user roles. I'm not sure I want some adventurous clients changing something I don't want them to ? In my opinion custom permission/role would be best for this. However sometimes I make client users "superusers" too, so it would be best to be able to disable/enable links for some superusers only. Do you think it's possible?

Thanks!

Link to comment
Share on other sites

  • 2 weeks later...
1 hour ago, bernhard said:

there's one slash too much on line 134

Ah ok, will fix it, does it make any problems (just curious)?

 

1 hour ago, bernhard said:

If it is easy to implement a "save + reload" button would be nice to have in the modal

You mean to reload the page edit after you update the field? Yeah it will be useful.

If you have time PR's are welcomed ? 

Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...
  • 4 months later...

Hey @Richard Jedlička thx again for your great module!

I'd have a request: Would it be possible to add a second icon to the template edit button on the page editor so that when clicked it opens the corresponding file in the IDE?

The link could easily be taken from tracy settings and the filename is easy to get via ReflectionClass:

$r = new \ReflectionClass($page);
db($r->getFileName());

Similar to the field edit links there could be a second icon on hover that, when clicked, takes you directly to the PHP file of the custom page class that is responsible for the currently viewed page's template ? 

BazxcwW.png

What do you think?

  • Like 2
Link to comment
Share on other sites

34 minutes ago, bernhard said:

I'd have a request: Would it be possible to add a second icon to the template edit button on the page editor so that when clicked it opens the corresponding file in the IDE?

This is a really good idea ? 

Link to comment
Share on other sites

  • 1 month later...

@bernhard @szabesz Hi gyus, sorry for very late reply. I don't have much to time work on these features right now, but I am open to PRs, so feel free to make one.

On 10/17/2022 at 11:24 AM, szabesz said:

When editing the pages of users, the module does not add its icons/links to the inputfields, in other words it does not work for user pages. Would it be possible to also make the module work there?

Can you explain it a little bit more? I am not sure what you mean. Show me please some example (screenshots).

Link to comment
Share on other sites

11 hours ago, Richard Jedlička said:

I am open to PRs, so feel free to make one

Not too much spare time either but if I have some, I will look into that. No promises though. Thanks anyway!

11 hours ago, Richard Jedlička said:

Show me please some example (screenshots).

 

image.png.94235c6c97ccb083d9a6ac8aeabcf838.png

As you can see, links do not appear when editing user pages. And it is not just for the user's name field but all the other additional fields I have added to the User template. (And the template edit link is missing too). It is probably because ProcessWire treats users differently from regular pages.

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...