Have a popup modal dialog box for the node delete confirmation form. This patch uses #87994: Quit clobbering people's work when they click the filter tips link.

Comments

dww’s picture

Status: Active » Needs work
StatusFileSize
new58.59 KB
new23.24 KB

This is pretty slick. ;) In the default case, it works well. However, when I altered my node_delete_confirm form from a contrib module, it only sort of worked. The fieldset was rendered (although with a pretty weird style -- all caps, etc), but my checkboxes just showed up as text, not as actual form elements. :(

Here's the altered confirm form before the patch:

And here it is as the dialog with the patch:

Bojhan’s picture

Noooooo..... its bad we had confirmation screens,we are now going to put them in annoying popups as well? Bah

robloach’s picture

StatusFileSize
new2.05 KB

The fieldset styling that dww got was inherited from Seven's CSS. Having confirmation screens is annoying, but its quite necessary when deleting content. This patch tries to make it less annoying by sticking it in a modal dialog box instead of needing a full page switch.

This patch fixes the title.

yched’s picture

Gosh, I've been waiting for *years* for confirmation forms to use popups.
The most annoying part about confirm forms is the additional page load time. It seems that the D7 page rendering changes (an the fact that blocks are not computed if not displayed), should make the popup content, even retrieved through AHAH, much faster than a full page load.

robloach’s picture

Technically, this patch is a whole page load as well, but it uses the jQuery Load function to retrieve and show only the form.

    // When the dialog box displays, load the delete form and display the button.
    $form['#attached']['ui'][] = array(
      'action' => 'load',
      'selector' => '#dialog-confirm',
      'arguments' => array(base_path() . "node/{$node->nid}/delete form.confirmation", array(), 'loadComplete'),
      // ...
    );

The "action" states that we want to use jQuery.load, and the "arguments" say that we want to retrieve node/#/delete but only show "form.confirmation", which ends up just displaying the confirmation form in the dialog box. #145551: Enable loading and rendering into multiple formats (html, xml, json, atom, etc.) would've been really nice because then we could load forms remotely through Form API via JSON. Even though it is technically another page load, it is still saving the user a lot of time, as their browser doesn't have to re-render the whole page and load it's associated JavaScript/CSS. It just displays the form in the popup without the browser needing to change the pages. In the end, it saves the user some time, and improves usability.

Bojhan’s picture

Sure, lets do it - just on principle hating dialog boxes for confirmations (*cough* Vista). Can anyone make a reviewable patch, all of this adds weight to getting dialogs in.

robloach’s picture

I think the only thing missing for this stuff is touching up #87994: Quit clobbering people's work when they click the filter tips link, and then getting that in.

seutje’s picture

subscribe

just like to point out that node delete form is currently not being rendered in the admin theme, but the form you are displaying the popup on is

this could potentially mean that you're taking a form as themed by theme X and showing it in the context of theme Y

fortunately, in this case it doesn't rly matter, but I can think of use-cases where it does matter

scroogie’s picture

subscribing

robloach’s picture

The #attached ui API patch doesn't have the function callbacks anymore.

Bojhan’s picture

Version: 7.x-dev » 8.x-dev
dealancer’s picture

subscribing

Everett Zufelt’s picture

cweagans’s picture

Title: Usability: Popup node delete confirmation form » UX: Use modal dialogs for confirmation forms.

We should do this for all of our confirmation forms. Retitling.

Everett Zufelt’s picture

IMO we are going to need to complete #1175830: Update to jQuery UI 1.10.2 before tackling this issue. If we are going to use modals in Core we should abstract the functionality.

andypost’s picture

subscribe

Dharmendra.s’s picture

i am using this patch but it's not working in drupal6 , i added this patch but nothing to happen ....so anyone can help me...

seutje’s picture

The issue is currently marked for version 8.x, but the patch was attached when the version for the issue was still 7.x.
Additionally, the issue is marked "needs work", not "needs review".

So if it did work on 6.x, it would be purely coincidental. I would imagine applying the patch to fail.

nod_’s picture

Component: node system » base system
nod_’s picture

jibran’s picture

Status: Needs work » Closed (duplicate)
mgifford’s picture

Adding related issue to see it's visible.