Skip to content

Commit

Permalink
Move form buttons in a separate element so that they can be easily mo…
Browse files Browse the repository at this point in the history
…dified.
  • Loading branch information
ADmad committed Mar 20, 2016
1 parent dec2324 commit a5866b7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
17 changes: 1 addition & 16 deletions src/Template/Element/form.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,7 @@
<div class="row">
<div class="col-lg-<?= $this->exists('form.sidebar') ? '8' : '12' ?>">
<div class="form-group">
<div class="col pull-right">
<?php
echo $this->Form->button(__d('crud', 'Save'), ['class' => 'btn btn-primary', 'name' => '_save']);
if (empty($disableExtraButtons)) {
if (!in_array('save_and_continue', $extraButtonsBlacklist)) {
echo $this->Form->button(__d('crud', 'Save & continue editing'), ['class' => 'btn btn-success btn-save-continue', 'name' => '_edit', 'value' => true]);
}
if (!in_array('save_and_create', $extraButtonsBlacklist)) {
echo $this->Form->button(__d('crud', 'Save & create new'), ['class' => 'btn btn-success', 'name' => '_add', 'value' => true]);
}
if (!in_array('back', $extraButtonsBlacklist)) {
echo $this->Html->link(__d('crud', 'Back'), ['action' => 'index'], ['class' => 'btn btn-default', 'role' => 'button', 'value' => true]);
}
}
?>
</div>
<?= $this->element('form/buttons') ?>
</div>
</div>
</div>
Expand Down
16 changes: 16 additions & 0 deletions src/Template/Element/form/buttons.ctp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<div class="col pull-right">
<?php
echo $this->Form->button(__d('crud', 'Save'), ['class' => 'btn btn-primary', 'name' => '_save']);
if (empty($disableExtraButtons)) {
if (!in_array('save_and_continue', $extraButtonsBlacklist)) {
echo $this->Form->button(__d('crud', 'Save & continue editing'), ['class' => 'btn btn-success btn-save-continue', 'name' => '_edit', 'value' => true]);
}
if (!in_array('save_and_create', $extraButtonsBlacklist)) {
echo $this->Form->button(__d('crud', 'Save & create new'), ['class' => 'btn btn-success', 'name' => '_add', 'value' => true]);
}
if (!in_array('back', $extraButtonsBlacklist)) {
echo $this->Html->link(__d('crud', 'Back'), ['action' => 'index'], ['class' => 'btn btn-default', 'role' => 'button', 'value' => true]);
}
}
?>
</div>

0 comments on commit a5866b7

Please sign in to comment.