Stealing a bit code from the node-edit example from the mapi example module and using a Views Custom Field with a single line of PHP code i created a field in my view which pops up a node edit form using mapi.

Was wondering how cool it would be to have this as an actual views handler?

Comments

liquidcms’s picture

Status: Active » Needs review
StatusFileSize
new2.6 KB

thought i would take a crack at this even though i am no views handler expert...

so here is a first crack at this.. it is still pulling some required JS from the example module so that would need to change; but maybe someone can comment on whether this is on the right track and worthy of be added to the modalframe_contrib folder.

it basically does what i suggested above.. it adds a new [Node] field handler for Views called "Edit link Modal" which simply provides a link which will pull up the associated node in a modalframe popup.

liquidcms’s picture

StatusFileSize
new7.97 KB

this version fixes the left over form submits i had still tied to the example module

it also raises the issue of how to have the data refreshed after the popup form is saved.. not sure there is an easy way to do this since this may not have been the edit form for the node that is being viewed. in my case it is a related node on a panel page with numerous views. simplest method would be to simply initiate a page refresh after the form is submitted - but wasnt sure the cleanest way to do this. Anyone??

liquidcms’s picture

Title: Views field to edit node in popup » New Contrib module - Views field to add edit link with popup
markus_petrux’s picture

Related issue: #959172: how do i add an onSubmit handler

This kind of integrations is pretty dependent on the particular use case. One may need to update the parent page, but only a portion, and that may vary a lot...

Maybe this module can live as an example for others here, or maybe it could be included to the Modal Frame Contrib Package? I would prefer it rather than adding it to the main Modal Frame API package... or you could create a separate project for it.

liquidcms’s picture

here's a new ZIP that

- cleans up the code a bit
- uses its own JS so no dependency on the example module
- does the page reload after modal closes to refresh the page so we can see the changes that were just made

thanks to Markus for pointing me in the right direction to sort out the last bit (and for this great framework).

liquidcms’s picture

StatusFileSize
new3.94 KB

oops.. getting late.. and the ZIP file

liquidcms’s picture

yea, i sort of thought adding to Contrib package would be the right place.. which is why i set title as New Contrib :)

tim.plunkett’s picture

Project: Modal Frame API » Modal Frame Contrib Package
Component: Code » New module

I have yet to look at the code, but this sounds like something I'd use. Also, fixing project.

liquidcms’s picture

ah.. yes.. contrib project would be right. not sure if Markus is going to add it though.

i do find it very useful... have it in numerous places now on one site and sure will use it on most other sites i do.

liquidcms’s picture

StatusFileSize
new5.79 KB

i see this still hasn't been committed to the modalframe_contrib package; which is sad as it is pretty cool...

here is new version which includes a modal delete link views field plugin to go with the modal edit field.

jvieille’s picture

Great!!!

A must would be to add a "View node modal" handler...