Jump to content

AdminPageSelectEditLinks [module for enabling edit links on multipage selects]


Macrura
 Share

Recommended Posts

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

post-136-0-86134600-1417740079_thumb.png

Edited by Macrura
removed obsolete module
  • Like 7
Link to comment
Share on other sites

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');
Link to comment
Share on other sites

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..

Link to comment
Share on other sites

Well look at the source :D

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? ;)

  • Like 1
Link to comment
Share on other sites

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 by Macrura
removed obsolete module
Link to comment
Share on other sites

@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

  • Like 1
Link to comment
Share on other sites

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...

  • Like 3
Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 5 months later...

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.
 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...