From 8172bb24f0e7164b1a7568f763982749914ff811 Mon Sep 17 00:00:00 2001 From: Pinga <121483313+getpinga@users.noreply.github.com> Date: Wed, 6 Dec 2023 22:31:01 +0200 Subject: [PATCH] Small UI fixes --- cp/app/Controllers/DomainsController.php | 4 +++- cp/resources/views/partials/js-domains.twig | 24 ++++++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/cp/app/Controllers/DomainsController.php b/cp/app/Controllers/DomainsController.php index 3589c02..7fb62c0 100644 --- a/cp/app/Controllers/DomainsController.php +++ b/cp/app/Controllers/DomainsController.php @@ -1586,7 +1586,7 @@ class DomainsController extends Controller foreach ($results as $row) { $status = $row['status']; if (preg_match('/.*(UpdateProhibited|DeleteProhibited)$/', $status) || preg_match('/^pending/', $status)) { - $this->container->get('flash')->addMessage('error', 'It has a status that does not allow renew, first change the status'); + $this->container->get('flash')->addMessage('error', 'It has a status that does not allow deletion, first change the status'); return $response->withHeader('Location', '/domains')->withStatus(302); } } @@ -2350,6 +2350,7 @@ class DomainsController extends Controller [ 'name' => $domainName ] + ); $this->container->get('flash')->addMessage('success', 'Transfer for ' . $domainName . ' has been rejected successfully'); return $response->withHeader('Location', '/transfers')->withStatus(302); @@ -2411,6 +2412,7 @@ class DomainsController extends Controller [ 'name' => $domainName ] + ); $this->container->get('flash')->addMessage('success', 'Transfer for ' . $domainName . ' has been cancelled successfully'); return $response->withHeader('Location', '/transfers')->withStatus(302); diff --git a/cp/resources/views/partials/js-domains.twig b/cp/resources/views/partials/js-domains.twig index c9daf4a..e957e5b 100644 --- a/cp/resources/views/partials/js-domains.twig +++ b/cp/resources/views/partials/js-domains.twig @@ -13,11 +13,25 @@ } function actionsFormatter(cell, formatterParams, onRendered) { - return ` - - - - `; + var rowData = cell.getRow().getData(); + var actionButtons = ''; + + var hasPendingDelete = rowData.domain_status.some(statusObj => statusObj.status && statusObj.status.includes('pendingDelete')); + var hasPendingRestore = rowData.domain_status.some(statusObj => statusObj.status && statusObj.status.includes('pendingRestore')); + + // Common action button for all statuses + actionButtons += ` `; + + if (hasPendingDelete) { + actionButtons += ``; + } else if (hasPendingRestore) { + actionButtons += ``; + } else { + actionButtons += ` `; + actionButtons += ``; + } + + return actionButtons; } function statusFormatter(cell) {