bernhard Posted August 18, 2015 Share Posted August 18, 2015 Awesome!! It's already installed and working great on my personal invoicing system thank you, that's a great addition to PW and i think i will need this quite often! One question: What do you think about an even more flexible way of defining the parent like i stated in my posting above. For example when i have a site for a sports club with different sections (soccer, tennis etc) and all of them manage their own chunk of persons. tennis/data/john-doe soccer/data/max-muster now if i had a template "team" and wanted a pagefield to select the coach from the /data-children it should choose the corresponding page (/tennis or /soccer, depending on where the "team" page lives under). would a textarea like the "Custom PHP code to find selectable pages" be hard to implement? oh, one more: as you seem to be a pagefield expert now, what would you think about an additional "unselect" button for the pagefield? https://processwire.com/talk/topic/9677-unselectclear-button-for-pagelistselect/ i think that would also be a great addition and would not harm anybody if you did it the same way like you are doing it with the view and add buttons (having to check the checkbox). thank's for your great work! Link to comment Share on other sites More sharing options...
thetuningspoon Posted August 18, 2015 Author Share Posted August 18, 2015 Hi BernhardB, glad you like it! This feature has been indispensable on my own projects as well. If I understand correctly, it sounds like you need the ability to alter the parent page of new items based on the location of the current field in the page tree. Right now if you leave the parent option blank it should give you the option of where you want to add the page each time you create a new one. But I know this isn't ideal for what you want to do. I'll look into creating a Custom PHP field for that. I'm not completely sure if it's even possible, but my guess is that it shouldn't be too hard if I can look at how Ryan did it. I agree that an unselect button would be nice. I haven't looked into how the page list select works under the hood, but it sounds like that might be a fun challenge if I can find the time to look into it. It might be as simple as adding a button and overlaying a bit of javascript to trigger the other button that's hidden in the list. 1 Link to comment Share on other sites More sharing options...
bernhard Posted August 18, 2015 Share Posted August 18, 2015 But I know this isn't ideal for what you want to do jep unselect would be great - i tried it but i failed still have to learn a lot custom php code would be the most flexible solution! it would even make the page select unnecessary ( return $page->get(/somepage); ) - but of course the page select you implemented now is much more user friendly, especially for non-coders Link to comment Share on other sites More sharing options...
thetuningspoon Posted August 18, 2015 Author Share Posted August 18, 2015 Any opinion on the "View" vs. "Edit" link label? Originally I had just changed it to "View" for one of my projects, but then I realized this might be clearer for the majority of applications, since "Edit" could imply editing the field itself rather than the selected page(s). 1 Link to comment Share on other sites More sharing options...
bernhard Posted September 5, 2015 Share Posted September 5, 2015 I think "view" is good. there have been some additions to the core page field. it supports edit links with asmselect now: https://processwire.com/blog/posts/processwire-2.6.16-core-updates-more-on-prodrafts/#asmselect-gets-new-option-to-edit-selected-pages still i'm a huge fan of this module! thank you Link to comment Share on other sites More sharing options...
thetuningspoon Posted September 14, 2015 Author Share Posted September 14, 2015 Thanks BernhardB. Have you had a chance to test the module with the new asmselect, and does it still work okay? I haven't had a chance to test the latest dev yet. Link to comment Share on other sites More sharing options...
bernhard Posted September 14, 2015 Share Posted September 14, 2015 everything working fine on 2.6.17 Link to comment Share on other sites More sharing options...
bernhard Posted October 7, 2015 Share Posted October 7, 2015 Hi, Today I had an issue with this module: I use it to create kind of library. All stored under "globals". There I can categorize things further like /globals/html and /globals/JavaScript... parent of selectable pages is set to "globals" and therefore this is used as parent for newly created pages. So every new page is stored under globals but it would be better to be able to choose the exact parent further down the tree under "globals" Clear what I mean? don't know how that could be solved Link to comment Share on other sites More sharing options...
thetuningspoon Posted October 8, 2015 Author Share Posted October 8, 2015 I think I know what you mean. Try changing line 119 in AdminPageFieldEditLinks.module from this: $newPageParent = $event->object->newPageParent ?: $event->object->parent_id; to this: $newPageParent = $event->object->newPageParent; Now just make sure that you are specifying a particular template and don't select a parent for new pages. Now when you click "New" it should now ask you where you want to put the new page, based on the template's family settings. I haven't tested, so let me know if that works. 2 Link to comment Share on other sites More sharing options...
bernhard Posted October 10, 2015 Share Posted October 10, 2015 hi tuningspoon, sorry can't test it because i was only working on this intranet project for the last week and had more important issues to deal with. it's ok to create pages under globals, link them and afterwards move them to their right location. the pagefield will keep the right reference. thanks anyhow for your help i just wanted to mention this usecase maybe to keep it in mind for further updates. but i also think that this is a quite special one. Link to comment Share on other sites More sharing options...
Robin S Posted November 7, 2015 Share Posted November 7, 2015 I have an idea for an enhancement: for the "Enable + New link?" option it would be great if the newly added page was automatically selected in the Page field. Ideally it would show as selected immediately after closing the modal window (reload the Page field via AJAX?), or otherwise show as selected after saving/refreshing Page Edit. If a person is adding a new page from within Page Edit I think it's likely they want to select that option also. I also noticed a quirk in that the "+ New" link is not rendered unless the "Enable view/edit link(s)?" option is also selected. Link to comment Share on other sites More sharing options...
thetuningspoon Posted November 9, 2015 Author Share Posted November 9, 2015 I have an idea for an enhancement: for the "Enable + New link?" option it would be great if the newly added page was automatically selected in the Page field. Ideally it would show as selected immediately after closing the modal window (reload the Page field via AJAX?), or otherwise show as selected after saving/refreshing Page Edit. If a person is adding a new page from within Page Edit I think it's likely they want to select that option also. Hi Cerulean. I definitely agree with your suggestion that the new page should be automatically selected when created. Unfortunately there isn't a straightforward way that I know of to do this, which is why I haven't done it yet. I am sure that it can be done (PageTable does something like it), but it will take me a while to figure out. Hopefully I will get some time to look at this soon since it is a feature I would like as well, and the "+New" link is a bit confusing without it. I also noticed a quirk in that the "+ New" link is not rendered unless the "Enable view/edit link(s)?" option is also selected. Thanks for the bug report. I'll look into this as well. Link to comment Share on other sites More sharing options...
LostKobrakai Posted November 9, 2015 Share Posted November 9, 2015 Adding the new page to the inputfield is not trivial as the actual code does completely depend on the used inputfield. With a few 3rd party inputfields this will be quite some work if all of them should be covered. 1 Link to comment Share on other sites More sharing options...
bernhard Posted January 4, 2016 Share Posted January 4, 2016 Just throwing in an idea: could you trigger the ajax loading of the field somehow after adding a new page? BTW: I managed to add the unselect button on my own https://processwire.com/talk/topic/11805-pagelistselectunselectbutton/ 1 Link to comment Share on other sites More sharing options...
thetuningspoon Posted January 4, 2016 Author Share Posted January 4, 2016 @BernhardB - AJAX reload of the field sounds like a promising idea. I have not looked into how that works yet, but I will as soon as I get a chance! At this point I recommend only using the Add New feature if you're using the autocomplete field, since that doesn't require a page refresh to select the new item. I saw your unselect module and it looks great 1 Link to comment Share on other sites More sharing options...
kixe Posted January 6, 2016 Share Posted January 6, 2016 Could you implement a translation option for the javascript? (buttons ' New' and ' View'). I am really looking forward for the Ajax Solution to provide the new created page immediately. Link to comment Share on other sites More sharing options...
thetuningspoon Posted January 9, 2016 Author Share Posted January 9, 2016 Currently working on an update with bug fixes, translatable links, and (hopefully) ajax refresh when new pages are added. I should have something ready tomorrow. Edit: Made a lot of progress this weekend but will need a bit more time to iron things out. I was able to get the field to refresh when the Add New modal dialog is closed, which works great for single item selects and allows you to select the new item without refreshing the page. However, for asm-style multi-selects, the refresh wipes out your existing selection when it reloads. Because of this I think that another approach will be required. 5 Link to comment Share on other sites More sharing options...
thetuningspoon Posted January 13, 2016 Author Share Posted January 13, 2016 I'm close to the finish line on this latest update. I've added support for ALL types of inputfields as well as automatic selection of a new page when it's added. I'm still working on the autocomplete inputfield and a few optimizations and then I will push the changes to GitHub. 2 Link to comment Share on other sites More sharing options...
thetuningspoon Posted January 15, 2016 Author Share Posted January 15, 2016 New in version 3.0 Removes the limitations of the previous releases! Now compatible with all Inputfield types including Select, SelectMultiple, Checkboxes, Radios, AsmSelect, PageListSelect, PageListSelectMultiple, and PageAutocomplete. When using the create new page feature, new pages are added to the field and selected automatically as soon as the modal is closed. No further input is required from the user. The "View" and "+ New" strings are now translatable The add new page links may be enabled independent of the view/edit links Code performance improvements GitHub: https://github.com/thetuningspoon/AdminPageFieldEditLinks Direct Download: https://github.com/thetuningspoon/AdminPageFieldEditLinks/archive/master.zip I ended up using a combination of different methods for populating the field with the new page once it's created. Some of the input types were fairly easy and could be updated without reloading the field, while others required some pretty wild code acrobatics, taking advantage of Ryan's new AJAX reload and repopulating the input with pages that were already selected but not yet saved. Please let me know if you run into any bugs. This was built mainly in Chrome with limited testing outside of it so far, so I expect some issues. I hope you guys enjoy the new features! Let me know if you have other suggestions for further enhancements. 11 Link to comment Share on other sites More sharing options...
kixe Posted February 17, 2016 Share Posted February 17, 2016 If 'View/ Edit links on selected pages' is enabled this option should be hidden in case user has no edit permission for the selected page. Now an ugly error message is shown in the modal. Would be nice to not provide the link in this case.Apart from this module is working properly under 3.0.8. Thumbs up and many thanks for the last fixes. 2 Link to comment Share on other sites More sharing options...
thetuningspoon Posted February 17, 2016 Author Share Posted February 17, 2016 Ah, great point, kixe. I hadn't even considered permissions since it hasn't been an issue in any of my use cases yet. If you have a github account, would you mind adding this as an issue? Thanks. Link to comment Share on other sites More sharing options...
Robin S Posted April 11, 2016 Share Posted April 11, 2016 The latest update to this module is really great. I notice that when adding a new page in the modal window the "Save" button does not close the modal like it does when using the native modal page edit feature (for AsmSelect). Could the Save button action be consistent with the native modal edit Save action, or do you think it's better to keep the modal open after save for newly added pages? Link to comment Share on other sites More sharing options...
thetuningspoon Posted April 11, 2016 Author Share Posted April 11, 2016 Hi Robin, glad you are finding this module useful! The reason why the modal stays open is that there are several scenarios in which I think this would be desirable. One is when you're creating a new page and it is a 2-step process. The modal needs to stay open after the initial page creation so that you can then edit the new page. The second is when there is an error on the page. I wanted the user to be able to see the error and make any corrections before closing. Ideally, I would just have the modal stay open only in those scenarios, but accomplishing that in the PW admin isn't straightforward at this point. It is something that I would like to look into, though right now I'm pretty swamped with other projects. 1 Link to comment Share on other sites More sharing options...
Robin S Posted April 11, 2016 Share Posted April 11, 2016 Fair enough. Looking a bit closer at the native edit modal I see that the normal Save button is hidden and a replacement Save button is rendered as part of the modal frame. I don't see how that could work with a 2-step page creation process. And keeping the modal open for errors is something I hadn't considered - it's actually a bit of a shortcoming of the native edit modal, which closes without displaying required field warnings, etc. Link to comment Share on other sites More sharing options...
kixe Posted July 1, 2016 Share Posted July 1, 2016 The module is not compatible with PW 3.0.22. Please check. Module configuration is not loaded properly. If I can figure out details I will post here. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now