Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow dynamic PJAX type change when building a HTTPResponse #488

Closed
wants to merge 4 commits into from

Conversation

mateusz
Copy link
Contributor

@mateusz mateusz commented May 23, 2012

Previous approach as done in #464 is not very clean. I don't entirely like this (more discussion in #472), so here is I think a better approach, that allows dynamic modification of the response at the end of the control flow.

It also removes the problem of changing the FormAction API, puts PJAX related stuff into PJAX related class, and removes the css class dependency.

chillu added a commit that referenced this pull request May 29, 2012
…directs. Fixes GridFieldDetailForm redirect after delete, e.g. in ModelAdmin. Partially reverts 8b4b896. Closes pull request #488
@chillu
Copy link
Member

chillu commented May 29, 2012

Hey Mateusz, I think Sam was referring to an overridden X-Pjax in the response headers, rather than the request. I've solved it through this custom header, rather than an explicit override property on the handler, but kept your logic in principle. One assumption that we're still making is that the returned content still replaces the same selector. So in the case of deleting a ModelAdmin record, that's '.cms-edit-form', which happens to work for both X-Pjax=Content and X-Pjax=CurrentForm. We could override an X-Pjax-Selector the same way of course, but I'd rather not encode these templating assumptions in controllers, too much coupling. Haven't come across this situation yet. If we do, I'd suggest that we implement a "hard redirect" setting in the response headers, which acts conservatively and refreshes the whole window via document.location.

See 5b03f49. By the way, I'm also looking into handling multiple Pjax fragments in the response, which will further complicate these edge cases sigh http://open.silverstripe.org/ticket/7176

@chillu chillu closed this May 29, 2012
bergice pushed a commit to open-sausages/silverstripe-framework that referenced this pull request Nov 18, 2018
…-cam-pain

MINOR: Modal response not covering modal properly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants