As far as i found out in views_ui_preview $js is (can be) 'nojs'. So we need the following patch to make it working for no-js users.

This does not fix the js preview. So needs work...

Comments

damien tournoud’s picture

Status: Needs work » Needs review
StatusFileSize
new1.56 KB

This is supposed to work, but there are two gotchas:

* we should really use class="use-ajax-submit", but that fails miserably on my testing (it triggers javascript errors!), so I implemented our own attach handler for now.
* ajax_command_replace() appends instead of replacing. No idea why. We seem to be doing the good thing, but jQuery misbehaves.

dawehner’s picture

StatusFileSize
new2.4 KB

I just changed the selector to #views-live-preview now it works fine...

damien tournoud’s picture

StatusFileSize
new2.01 KB

Works as expected. Free reroll.

merlinofchaos’s picture

Status: Needs review » Fixed

I committed a myriad of changes as part of this.

1) For some reason, the $js variable used to be TRUE/FALSE. This distinction was removed and it started sending ajax/nojs through, which was causing some subtle bugs (such as live preview not working without ajax). I put this back. In the process of putting this back, I discovered that code to handle the menu items were poorly formatted and somewhat obfuscated, causing me to spend significant time wondering why changes to menu items weren't taken. I reformatted the code and made it more straightforward.

2) The exposed plugins patch is causing problems with D7's form processing -- in particular, at least one handler was NOT checking to see if we were actually an exposed form before setting $form_state['input']. Once 'input' is set, form api assumes the form is submitted, and you lose access to the exposed form. I fixed it for the one handler i was testing with, but this needs to be evaluated for all filter handlers. A search for $form_state['input'] in filter handlers should quickly find all the instances where this might be wrong. We must test $form_state['exposed'] before setting the input.

3) admin.inc had mixed unix/dos CR/LFs. I thought I'd fixed this before, but apparently not. Fixed this again. Hopefully it stays fixed this time.

4) The auto trigger for live preview is now an ajax command. This will make it easy to integrate with the patch coming up to allow auto live preview to be turned off.

5) I set all the links to use the throbber. Throbber is currently broken for links. See this patch: http://drupal.org/node/697252 -- note that even with that patch, the throbber looks awful because it appears in bizarre places. It might be best to see if we can get that to allow a throbber callback so we can just make our own throbber.

Beyond that, regular AJAX was never converted. Sadly that code is a convoluted mess, but it still needs to happen. Also, the 'url' setting in the main form response is probably no longer necessary. The form #action should contain the URL. This is probably just a holdover from when I didn't really know any better. Setting the #action should be trivial and. Both of these items probably need new issues if they do not have them.

dawehner’s picture

Status: Fixed » Needs work

Thats not true. You didn't commited any patch http://drupal.org/project/cvs/38878

merlinofchaos’s picture

Status: Needs work » Fixed

Sorry,a conflict in the changelog prevented the commit. It's in now.

Status: Fixed » Closed (fixed)

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