Macrura Posted December 4, 2014 Posted December 4, 2014 (edited) this is a work in progress... needs testing. in this module the edit links are added to the green boxes using 2 methods: jquery for the page list select and page auto complete, and the native asm select feature for asmSelects (thanks to Soma). Since the PageAutoComplete and PageListSelect are using the hover and icon from asmSelect, the asmSelect assets need to be loaded now on every page edit, in order to make the links look right. if you downloaded this before, please replace with the latest version, as there have been many changes, corrections/bugfixes and improvements. Please report any issues. Updated 12/6/14 at 10PM - please delete earlier versions due to issue with links being added on template editor. Updated 5/7/15: Module removed in anticipation of new official version release: https://processwire.com/talk/topic/9857-module-page-field-edit-links/?p=94599 Edited May 8, 2015 by Macrura removed obsolete module 7
owzim Posted December 4, 2014 Posted December 4, 2014 Can you describe in more detail what this does/is for? And perhaps some use cases. I have no clue. Edit: Guess I got it (dead tired), links to the edit page are added to the asm select field items. The Module name is misleading, I think, because it is NOT a Process module. Wouldn't the JqueryMagnific scrips and styles be loaded automatically if you just load the module? $this->modules->get('JqueryMagnific');
Macrura Posted December 4, 2014 Author Posted December 4, 2014 yeah - open to suggestions, have no clue what to call this properly.. Use cases so far: - record label where there are albums and each album needs to have a page select for artists, but very often need fast access to edit that artist page. - during development when adding categories sometimes users misspell things, or maybe use the wrong word.. so easier to have that link right there rather than go click through the page tree - email app where a page is an email and users can be selected, but you might want to check that user's email address, or see/edit something..
Macrura Posted December 4, 2014 Author Posted December 4, 2014 @ozwim - thanks, again, yeah, sorry for being clueless about the name and how to load the magnific.. will work on fixing that - also if you have any suggestion for name let me know..
Soma Posted December 4, 2014 Posted December 4, 2014 You know Asm select plugin has this functionality just disabled? 3
Macrura Posted December 4, 2014 Author Posted December 4, 2014 You know Asm select plugin has this functionality just disabled? whoah - so how to enable.. ? guess that would make this module useless...
Soma Posted December 4, 2014 Posted December 4, 2014 Well look at the source https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Inputfield/InputfieldAsmSelect/asmselect/jquery.asmselect.js#L51 I don't know why it isn't used in PW (ASM was a standalone jquery plugin by Ryan, also used quite lot in drupal) But why not ask him I used it (tried) on my proof of concept block content module https://github.com/somatonic/BlocksContent/blob/master/BlocksContent.module#L106 Golden treasure not? 1
mr-fan Posted December 4, 2014 Posted December 4, 2014 (edited) Here we go added some more things... - first owzim is right for the Magnific part this should load all needed scripts - second added some CSS for the Links that the work like in the templatefield section. Many usecase if you have a cathegorie with a pagefield for the articles of that cat so you could really easy change this pages in popup modal! Or for my usecase i've companies with clients and different companies could have the same clients from a stock so i use a pagefield with autocomplete to get the clients binded to the right companies....for a fast look or changes i've now direct acces to the clients. This is very fast since the clientpool could raise to x000 clients, but companies should stay less than 100....it's a complicated usecase. But thanks again to Macrura - i always learn a lot from your examples!! Edited May 8, 2015 by Macrura removed obsolete module
Macrura Posted December 4, 2014 Author Posted December 4, 2014 @mr fan - also there is something that needs to be fixed in the module: // attach js+css to the page only on edit page public function loadAssets($event) { if($this->process == 'ProcessPageEdit') { //load jQueryMagnific $this->modules->get('JqueryMagnific'); //load module scripts and styles for the list links $this->config->scripts->add($this->config->urls->ProcessPageSelectLinks . "ProcessPageSelectLinks.js"); $this->config->styles->add($this->config->urls->ProcessPageSelectLinks . "ProcessPageSelectLinks.css"); } } forgot the brackets after the conditional (copied original code from a module that only had 1 script after the conditional).. without this it will break the admin 1
Macrura Posted December 4, 2014 Author Posted December 4, 2014 so thanks to Soma, there will be a new version of this that doesn't require all of the jquery stuff; currently using soma's code and have it working for asm selects, so now just need to do the same for page list select and autocomplete... 3
kongondo Posted December 4, 2014 Posted December 4, 2014 About renaming the module...(it isn't a process module ) https://processwire.com/talk/topic/741-a-guideline-for-module-naming/?p=6267 https://processwire.com/talk/topic/1313-modules-process-and-the-difference/ 2
Macrura Posted December 4, 2014 Author Posted December 4, 2014 ok, well in the current state it would be JqueryPageSelectEditLinks but once it is changed to hook into the render methods of the fields like InputfieldAsmSelect, then will it be a process module, or if not, i don't know what to call it - maybe AdminHelperPageSelectResurrectEditLinks
nurkka Posted May 5, 2015 Posted May 5, 2015 Thanks for the module, Macrura. Currently I have page fields and option fields with InputAsmSelect on my pages. Now, with the module, the options are editable too, which leads to strange results. Is it possible to restrict the module to only modify page fields? I tried $field->type within InputfieldAsmSelect::render, but got no value back.
Macrura Posted May 5, 2015 Author Posted May 5, 2015 thetuningspoon extended this module and made it configurable, and it should be released soon.. will check in on that. this was made before options field, so i don't know about that we'll have to take a look; once you have the configurable version you would only enable it on a per-field basis
Macrura Posted May 8, 2015 Author Posted May 8, 2015 this topic will now be closed and all discussions moved to the official module for this: https://processwire.com/talk/topic/9857-module-page-field-edit-links/?p=94599
Recommended Posts