Homec4science

Simplify form/lightbox stuff

Authored by epriestley <git@epriestley.com> on Jan 29 2013, 03:12.

Description

Simplify form/lightbox stuff

Summary:
I broke this a bit a few revisions ago by making phabricator_render_csrf_magic() return array instead of string without actually grepping for callsites.

Instead of building a form in JS, build it in PHP and just change its action in JS. This is simpler and doesn't require us to expose CSRF magic in more places.

This change triggered a rather subtle bug: if we rendered a normal form on the page (and thus installed the "disable forms when submitted" behavior), the download button would incorrectly disable after being clicked. This doesn't currently happen in Files because we don't put a form on the same page as the download button.

Instead, make the "disable" behavior check if the form is downloading stuff, and not disable stuff if it is. Then mark the lightbox and Files form as both download forms.

Test Plan: Used lightbox; used Files. Verified download buttons download the right stuff and behave correctly. Grepped for other download forms, but all the other places where we write "download" don't appear to actually be download links.

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran

Maniphest Tasks: T2432

Differential Revision: https://secure.phabricator.com/D4685

Details

Committed
epriestley <git@epriestley.com>Jan 29 2013, 03:12
Pushed
aubortJan 31 2017, 17:16
Parents
rPHfc4cb5735702: Fix JSON encoding of PhutilSafeHTML for browser consumption
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPH08bcb8c30ab0: Simplify form/lightbox stuff (authored by epriestley <git@epriestley.com>).Jan 29 2013, 03:12