A plugin to refresh views when submitting a form

jide - March 22, 2009 - 14:21
Project:Ajax
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:jide
Status:closed
Description

A new plugin for ajax : a plugin that reloads the view when submitting a form.

The ideal combination is a view listing nodes of a certain content type sitting next to the node submission form.
When you submit the form, the view would be refreshed and show the newly created node.

I have made such a plugin, but i have some problems to make it compatible with disable_redirect.
The problem is that disable_redirect hook 'complete' is fired before the plugin, and since it returns false, the hook is not fired for other plugins (that's what i guess, but i might be wrong). To make it work, i recreated the redirection disabling feature. Any help on this ? Otherwise, it works great !

The plugin is attached below.

AttachmentSize
views_refresh.zip2.69 KB

#1

jide - March 22, 2009 - 14:27

Whoops ! It should have a dependency to the views module of course.

AttachmentSize
views_refresh.zip 3.27 KB

#2

brendoncrawford - March 23, 2009 - 05:25

Jide,

Thanks for your submission. This is actually the first user-submitted ajax plugin that has been submitted. I will test this plugin, and if all goes well, i will setup a page with a listing to all user-submitted plugins -- perhaps in a similar way that CCK lists cck plugins. I will keep you posted.

#3

brendoncrawford - April 17, 2009 - 07:25
Status:active» fixed

Jide,

1) I have updated the ajax.js so that additional hooks will fire even after a hook returns false.

2) I have added an "unofficial contributed plugins" page, where a link to your module has been added. The page can be found here: http://drupal.org/node/436390 . Please be responsible for making sure this plugin is updated when appropriate and is in good working condition.

#4

jide - April 17, 2009 - 12:12

Brendon,

This is great ! I would have prefered if it was included in the default plugins but i can imagine why you did not include it (you would have to maintain a plugin you did not create). Maybe i will publish a ajax_extra_plugins or something someday to make it easier for users to find, and then if other plugins are created they may be included in the package, what do you think ? In the meantime maybe you could add a link on the project page ? I'll try to watch for any change that may need an update. I already have to make changes to make it work along with disable_redirect now that you committed these changes.

#5

System Message - May 1, 2009 - 12:20
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

#6

phonydream2 - May 5, 2009 - 11:17
Category:feature request» bug report

The 'complete' hook isn't being fired for me. To test the module out I changed the line:

if (hook === 'complete') {

to

if (hook === 'afterMessage') {

and it works for a single view (a view embedded within a view is a separate issue).

#7

christopher_skauss - May 29, 2009 - 05:53

Hello, has there been any updates to this plugin?

#8

jide - June 13, 2009 - 13:42

I have updated the module according to recent changes in Ajax module.
I have implemented the change to the hook suggested by phonydream2 though it seemed to work for me with 'complete'.
Read the README.txt file for more information.
Enjoy !

AttachmentSize
ajax_views_refresh.zip 5.24 KB

#9

kevin riggen - July 12, 2009 - 19:16

The refresh does not work for me using the default 'afterMessage'.

If I change that to 'complete' on line 22 of ajax_views_refresh.js then it works.

GMap has an issue with Ajax where it does not refresh, and there is an issue about it here : http://drupal.org/node/315236

This is using the Ajax Refresh .zip in #8 and Ajax 6.x-1.14

Cheers!

#10

jide - July 18, 2009 - 11:11

I have published the plugin as a module which can be found here : Ajax views refresh.
Submit issues on the module's page.

kvnBushi : I changed the hook back to "complete" since i had the same issue and it seems to work well.

I updated Unofficial Contributed Ajax.module Plugins page accordingly.

#11

phonydream2 - July 21, 2009 - 04:58

jide,

Perhaps you could make an OR condition to test for either hook.

 
 

Drupal is a registered trademark of Dries Buytaert.