Skip to content

Commit

Permalink
Update VDialog.php
Browse files Browse the repository at this point in the history
  • Loading branch information
usernane committed Oct 10, 2022
1 parent b85c1ba commit a0f100d
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion wfc/ui/vuetify/VDialog.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public function __construct($model, $toolbar = false) {

if ($toolbar === true) {
$this->vToolbar = $this->vCard->addChild('v-toolbar', [
'color' => 'primary'
'color' => 'primary',
'max-height' => 64
]);
return;
}
Expand All @@ -63,6 +64,31 @@ public function __construct($model, $toolbar = false) {
]
])->text("{{ ".$model.".title }}");
}
/**
* Adds close button to the toolbar of the dialog.
*
* This only applies of the dialog has a toolbar added to it.
*
* @param string $closeAction An optional javaScript function to call
* in case of button click.
*
* @return VBtn|null If a button is added, the method will return it as
* an object of type 'VBtn'. Other than that, null is returned.
*/
public function addCloseBtn(string $closeAction = null) {
$toolbar = $this->getToolbar();

if ($toolbar !== null) {
$clickEvnt = $closeAction !== null ? $closeAction : $this->getModel().".visible = false";

return $toolbar->addChild(new VBtn([
'icon',
'dark',
'@click' => $clickEvnt,
'icon' => 'mdi-close'
]));
}
}
/**
* Returns the name of dialog model that will contain dialog properties.
*
Expand Down

0 comments on commit a0f100d

Please sign in to comment.