Skip to content

Commit

Permalink
hide script button (#15)
Browse files Browse the repository at this point in the history
Co-authored-by: msouto <[email protected]>
  • Loading branch information
msouto346 and msoutopdmfc authored Oct 28, 2020
1 parent eb12d75 commit 18be035
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/js/field.js

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion resources/js/components/IndexField.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<template>
<div>
<button
class="btn btn-default btn-primary"
class="btn btn-default btn-primary"
:class="{hidden:hidden}"
@click="confirmActionModalOpened = true"
:disabled="field.readonly"
>
Expand Down Expand Up @@ -176,6 +177,10 @@
buttonText() {
return this.field.text || this.__('Run');
},
hidden() {
return this.field.hidden || false;
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions src/ActionButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,14 @@ public function text(string $text)
{
return $this->withMeta(compact('text'));
}

/**
* Hide button
*
* @param callable
*/
public function hide($callback)
{
return $this->withMeta(['hidden' => call_user_func($callback)]);
}
}

0 comments on commit 18be035

Please sign in to comment.