Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Vote now uses ajax, the other buttons do not yet. Ideally, all of them would work with ajax.
There is one problem and that is that cancel has a confirmation form.
Proposed resolution
Add #ajax everywhere, implement it correctly.
Remove the confirmation form. If someone clicks the button accidently, they can just vote again.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#7 | interdiff-all_poll_actions_should-2599124-5-7.txt | 4.83 KB | edurenye |
#7 | all_poll_actions_should-2599124-7.patch | 9.24 KB | edurenye |
| |||
#5 | interdiff-all_poll_actions_should-2599124-3-5.txt | 7.42 KB | edurenye |
#5 | all_poll_actions_should-2599124-5.patch | 8.68 KB | edurenye |
| |||
#3 | all_poll_actions_should-2599124-3.patch | 5.24 KB | edurenye |
|
Comments
Comment #2
edurenye CreditAttribution: edurenye at MD Systems GmbH commentedRemoved the confirmation, "added ajjax call" but I don't know why tha ajax function is never called. I upload the patch for @Berdir to take a look at it.
Comment #3
edurenye CreditAttribution: edurenye at MD Systems GmbH commentedForgot the patch, sorry.
Comment #5
edurenye CreditAttribution: edurenye at MD Systems GmbH commentedCreated a followup #2610150: Readd tests for Ajax Poll Vote to readd the tests PollVoteTest::testAjaxPollVote as we have to use a class in the Ajax insertCommand, and we can not test it until this simpletest issue #2469713: Step 2: Create a JavaScriptTestBase using PhantomJs Driver/Binary is solved.
Now the Ajax works but we can not test it, just manual test until the simpletest issue is fixed.
Comment #6
BerdirYeah, this is a lot better :)
More something like "Ajax callback to replace the poll form."
Also, drop the @param and @return, those are usually left out for callbacks like this. And they're wrong now anyway (we no longer return an array)
We should add some inline docs to describe what we are doing here (embed status messages into the form and then render and return it, replacing the existing form completely)
useless ". ''"
Follow-up: Improve log message, this is pretty useless for an anonymous user currently.
Add a comment here and below, explaining this:
// In case of an ajax submission, trigger a form rebuild so that we can return an updated form through the ajax callback.
Same here, additionally, the comment above doesn't really make sense here. Maybe move that below the new code.
Sorry, I wasn't aware that this *only* tests ajax and needs to be disabled. Yes, in that case, add a @todo.
I think we no longer need this. Same in the vote form. can also be dropped from preprocess then.
Comment #7
edurenye CreditAttribution: edurenye at MD Systems GmbH commentedI did all those points and created the follow up: #2611642: Improve log message for anonymous users
Comment #8
BerdirVery nice. Committed!