Skip to content
This repository was archived by the owner on Jan 3, 2024. It is now read-only.

Commit 4f4d9d4

Browse files
author
David Yell
committed
Fixes #1. Updated the view template to load the model and inspect the behaviours
1 parent 8fb7ec1 commit 4f4d9d4

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Console/Templates/NiceAdmin/views/index.ctp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,15 @@
22
<h2><?php echo "<?php echo __('{$pluralHumanName}'); ?>"; ?></h2>
33
<?php echo "<?php echo \$this->Html->link('New', array('action'=>'add'), array('title'=>'Add new','class'=>'btn add-button'));?>\n"; ?>
44

5-
<?php echo "<?php echo \$this->Form->postLink(\"Purge (\$purgeable)\", array('action'=>'purge'), array('class' => 'btn btn-small btn-danger purge-button'), 'Are you sure you want to purge? This will remove records permanently!');?>\n"; ?>
6-
<?php echo "<?php echo \$this->Html->link(\"Deleted (\$deleted)\", array('action'=>'deleted'), array('title'=>\"Deleted (\$deleted)\", 'class' => 'btn btn-small btn-primary deleted-button'));?>\n"; ?>
5+
<?php
6+
App::uses($modelClass, 'Model');
7+
$model = ClassRegistry::init($modelClass);
8+
9+
if (in_array('SoftDelete', $model->Behaviors->loaded())) {
10+
echo "<?php echo \$this->Form->postLink(\"Purge (\$purgeable)\", array('action'=>'purge'), array('class' => 'btn btn-small btn-danger purge-button'), 'Are you sure you want to purge? This will remove records permanently!');?>\n";
11+
echo "<?php echo \$this->Html->link(\"Deleted (\$deleted)\", array('action'=>'deleted'), array('title'=>\"Deleted (\$deleted)\", 'class' => 'btn btn-small btn-primary deleted-button'));?>\n";
12+
}
13+
?>
714

815
<table cellpadding="0" cellspacing="0" class="table table-bordered table-striped">
916
<tr>

0 commit comments

Comments
 (0)