aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilly Micieli <micieli@laposte.net>2019-10-23 18:14:12 +0200
committerWilly Micieli <micieli@laposte.net>2019-10-23 18:14:12 +0200
commit9ad399b069575068afccf2ae26115386e6bb756a (patch)
treebc71eea1664650d21f15a7ee74374b97b8b0ebad
parentb51681ccd0bddd262a587b1635e7cf3090d1fc10 (diff)
downloadimperium-9ad399b069575068afccf2ae26115386e6bb756a.zip
imperium-9ad399b069575068afccf2ae26115386e6bb756a.tar.gz
add confirmation before delete
-rw-r--r--config/crud.yaml1
-rw-r--r--imperium/Action/Crud.php5
2 files changed, 5 insertions, 1 deletions
diff --git a/config/crud.yaml b/config/crud.yaml
index 2eb557a..234bc1c 100644
--- a/config/crud.yaml
+++ b/config/crud.yaml
@@ -13,3 +13,4 @@ edit_class: 'btn btn-outline-primary'
remove_class: 'btn btn-outline-danger'
truncated: 'The table has been empty successfully'
no_truncated: 'The table has not been altered'
+sure: 'Are you sure you want to delete this item?' \ No newline at end of file
diff --git a/imperium/Action/Crud.php b/imperium/Action/Crud.php
index 71a816c..b846e2c 100644
--- a/imperium/Action/Crud.php
+++ b/imperium/Action/Crud.php
@@ -343,8 +343,11 @@
foreach ($value as $v)
append($html,'<td>'.substr($v,0,50).'</td>');
+ $confirm = $this->config('crud','sure');
+ $sure = "onclick=\"return confirm('$confirm');\"";
+
append($html,'<td><a href="'.route('edit',true,[$this->current,$value->id]).'" class="'.$this->config('crud','edit_class').'">'.$this->config('crud','edit_text').'</a></td>');
- append($html,'<td><a href="'.route('remove',true,[$this->current,$value->id]).'" class="'.$this->config('crud','remove_class').'"> '.$this->config('crud','remove_text').'</a></td>');
+ append($html,'<td><a href="'.route('remove',true,[$this->current,$value->id]).'" class="'.$this->config('crud','remove_class').'" '.$sure.'> '.$this->config('crud','remove_text').'</a></td>');
return $html . '</tr>';
}
/**