From a52c447d7094f761d2ade39395398afa8850ad24 Mon Sep 17 00:00:00 2001 From: Rachman Chavik Date: Tue, 10 Mar 2020 17:57:05 +0700 Subject: [PATCH] Translate: Reuse admin/buttons element --- src/Controller/Admin/TranslateController.php | 2 +- src/Template/Admin/Translate/edit.ctp | 26 +++++++------------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/Controller/Admin/TranslateController.php b/src/Controller/Admin/TranslateController.php index 3e143cd..c3c2e73 100644 --- a/src/Controller/Admin/TranslateController.php +++ b/src/Controller/Admin/TranslateController.php @@ -180,7 +180,7 @@ public function edit($id = null) 'locale' => $locale, ], ]; - if (isset($this->getRequest()->data['apply'])) { + if (isset($this->getRequest()->data['_apply'])) { $redirect['action'] = 'edit'; } diff --git a/src/Template/Admin/Translate/edit.ctp b/src/Template/Admin/Translate/edit.ctp index 2191100..2acd085 100644 --- a/src/Template/Admin/Translate/edit.ctp +++ b/src/Template/Admin/Translate/edit.ctp @@ -70,23 +70,15 @@ $this->end(); $this->start('panels'); echo $this->Html->beginBox(__d('croogo', 'Publishing')); - $out = - $this->Form->button(__d('croogo', 'Apply'), [ - 'name' => 'apply', - 'class' => 'btn-outline-primary', - ]) . - $this->Form->button(__d('croogo', 'Save'), [ - 'class' => 'btn-outline-success', - ]) . - $this->Html->link(__d('croogo', 'Cancel'), ['action' => 'index', - '?' => [ - 'id' => $this->getRequest()->query('id'), - 'model' => urldecode($this->getRequest()->query('model')), + echo $this->element('admin/buttons', [ + 'cancelUrl' => [ + 'action' => 'index', + '?' => [ + 'id' => $this->getRequest()->query('id'), + 'model' => urldecode($this->getRequest()->query('model')), + ], ], - ], [ - 'class' => 'cancel', - 'button' => 'outline-danger' ]); - echo $this->Html->div('card-buttons d-flex justify-content-center', $out); + echo $this->Html->endBox(); - $this->end(); +$this->end();