Big improvement in CP flows

This commit is contained in:
Pinga 2024-01-09 11:47:18 +02:00
parent 7c2e6d4388
commit f3fa1f1855
15 changed files with 244 additions and 961 deletions

View file

@ -98,10 +98,8 @@ class RegistrarsController extends Controller
// Trim the final semicolon and space
$errorText = rtrim($errorText, '; ');
return view($response, 'admin/registrars/create.twig', [
'countries' => $countries,
'error' => $errorText,
]);
$this->container->get('flash')->addMessage('error', 'Error creating registrar: ' . $errorText);
return $response->withHeader('Location', '/registrar/create')->withStatus(302);
}
$db->beginTransaction();
@ -270,16 +268,12 @@ class RegistrarsController extends Controller
$db->commit();
} catch (Exception $e) {
$db->rollBack();
return view($response, 'admin/registrars/create.twig', [
'error' => $e->getMessage(),
'countries' => $countries,
]);
$this->container->get('flash')->addMessage('error', 'Database failure: ' . $e->getMessage());
return $response->withHeader('Location', '/registrar/create')->withStatus(302);
}
return view($response,'admin/registrars/create.twig', [
'registrar' => $data['name'],
'countries' => $countries,
]);
$this->container->get('flash')->addMessage('success', 'Registrar ' . $data['name'] . ' successfully created and is now active.');
return $response->withHeader('Location', '/registrars')->withStatus(302);
}
$iso3166 = new ISO3166();