diff --git a/application/modules/admin/controllers/NewsletterController.php b/application/modules/admin/controllers/NewsletterController.php index 08c7e239fb23c1adec4f904d59aec3b62305e563..99e5a7c2a1a3fd6d89e968b610f5d5b163d73c83 100644 --- a/application/modules/admin/controllers/NewsletterController.php +++ b/application/modules/admin/controllers/NewsletterController.php @@ -44,7 +44,23 @@ class Admin_NewsletterController extends ZendAfi_Controller_Action { return $this->view->tag('span', $this->view->boutonIco("picto=users", "bulle=" . $this->_('Inscrits')) . $model->getNumberOfUsers(), ['style' => 'white-space:nowrap']); }], ['action' => 'sendtest', 'content' => $this->view->boutonIco('type=test')], - ['action' => 'send', 'content' => $this->view->boutonIco('type=mail')], + ['action' => 'send', + 'content' => function($model) { + Class_ScriptLoader::getInstance()->addJQueryReady(" +function sendNewsletterClick(event) { + var target = $(event.target).closest('a'); + var answer = confirm(\"".$this->_("Envoyer la lettre d'information ?")."\"); + if (answer == false) { + event.preventDefault(); + return; + } +} + + $(\"a[rel='send']\").click(sendNewsletterClick); +"); + + + return $this->view->boutonIco('type=mail');}], ['action' => 'duplicate', 'content' => $this->view->boutonIco('type=duplicate')], ['action' => 'delete', 'content' => $this->view->boutonIco('type=del')], ], diff --git a/application/modules/admin/views/scripts/newsletter/index.phtml b/application/modules/admin/views/scripts/newsletter/index.phtml index 533cff0e5c5fd4f3c93b8ba0e7cfb9f07fc7bbe3..cfb7cc73d7b2500d5fd26007523eca43d66d6236 100644 --- a/application/modules/admin/views/scripts/newsletter/index.phtml +++ b/application/modules/admin/views/scripts/newsletter/index.phtml @@ -15,18 +15,3 @@ echo $this->tagModelTable($this->newsletters, if (isset($this->subview)) echo $this->tag('div', $this->subview, ['class' => 'subview']); ?> - -<script type="text/javascript"> -function sendNewsletterClick(event) { - var target = $(event.target).closest('a'); - var answer = confirm("<?php echo $this->_("Envoyer la lettre d'information ?"); ?>"); - if (answer == false) { - event.preventDefault(); - return; - } -} - -$(document).ready(function() { - $("a[rel='send']").click(sendNewsletterClick); -}); -</script>