Problem/Motivation

Now when we save a JobItem the form redirect us to the list of Jobs and we must be redirect to the Job which this JobItem belongs.
To reproduce that translate a node, go to 'admin/tmgmt/jobs' and click on 'Manage', (now this is the JobForm view) in the 'JOB ITEMS' section click on 'View', (now this is the JobItemForm) now click 'Save' the problem is that redirects to the list of jobs and should redirect to the JobForm you where before.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

edurenye created an issue. See original summary.

edurenye’s picture

Issue summary: View changes
edurenye’s picture

Issue summary: View changes
edurenye’s picture

Issue summary: View changes
edurenye’s picture

Status: Active » Needs review
StatusFileSize
new1.52 KB

Disabled the destination and added the redirect not just when the item is accepted.

Status: Needs review » Needs work

The last submitted patch, 5: redirect_back_to_job-2594705-5.patch, failed testing.

edurenye’s picture

Status: Needs work » Needs review
StatusFileSize
new2.9 KB
new1.37 KB

Fixed the failing tests.

berdir’s picture

+++ b/src/Form/JobItemForm.php
@@ -299,11 +299,6 @@ class JobItemForm extends TmgmtFormBase {
       $item->acceptTranslation();
-      // Check if the item could be saved and accepted successfully and redirect
-      // to the job item view if that is the case.
-      if ($item->isAccepted()) {
-        $form_state->setRedirectUrl($item->getJob()->urlInfo());
-      }
       // Print all messages that have been saved while accepting the reviewed
       // translation.
       foreach ($item->getMessagesSince() as $message) {
@@ -323,6 +318,7 @@ class JobItemForm extends TmgmtFormBase {

@@ -323,6 +318,7 @@ class JobItemForm extends TmgmtFormBase {
       ]));
     }
     $item->save();
+    $form_state->setRedirectUrl($item->getJob()->urlInfo());

I'm not sure about this change, actually.

berdir’s picture

Status: Needs review » Fixed

Discussed with miro, this makes sense. Committed.

  • Berdir committed 5773fb9 on 8.x-1.x authored by edurenye
    Issue #2594705 by edurenye: Redirect back to job when an item is saved
    

Status: Fixed » Closed (fixed)

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