-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jan Loufek
committed
Feb 8, 2020
1 parent
d7008fe
commit 60fde1c
Showing
13 changed files
with
3,046 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Chap\AdminLTE\Components\ActionButtons; | ||
|
||
use Nette\Application\UI\Control; | ||
use Nette\Bridges\ApplicationLatte\Template; | ||
|
||
class ActionButtons extends Control | ||
{ | ||
/** @var Button[] */ | ||
private $buttons = []; | ||
|
||
/** @var DropLink[] */ | ||
private $dropLinks = []; | ||
|
||
/** | ||
* @param Button $button | ||
*/ | ||
public function addButton(Button $button): void | ||
{ | ||
$this->buttons[] = $button; | ||
} | ||
|
||
/** | ||
* @param DropLink $dropLink | ||
*/ | ||
public function addDropdownLink(DropLink $dropLink): void | ||
{ | ||
$this->dropLinks[] = $dropLink; | ||
} | ||
|
||
public function render(): void | ||
{ | ||
/** @var Template $template */ | ||
$template = $this->getTemplate(); | ||
$template->render(__DIR__ . DIRECTORY_SEPARATOR . 'template.latte', [ | ||
'buttons' => $this->buttons, | ||
'dropLinks' => $this->dropLinks, | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Chap\AdminLTE\Components\ActionButtons; | ||
|
||
class Button | ||
{ | ||
/** @var string */ | ||
public static $BUTTON_TYPE_PRIMARY = 'primary'; | ||
/** @var string */ | ||
public static $BUTTON_TYPE_SECONDARY = 'secondary'; | ||
/** @var string */ | ||
public static $BUTTON_TYPE_SUCCESS = 'success'; | ||
/** @var string */ | ||
public static $BUTTON_TYPE_DANGER = 'danger'; | ||
/** @var string */ | ||
public static $BUTTON_TYPE_WARNING = 'warning'; | ||
/** @var string */ | ||
public static $BUTTON_TYPE_INFO = 'info'; | ||
/** @var string */ | ||
public static $BUTTON_TYPE_LIGHT = 'light'; | ||
/** @var string */ | ||
public static $BUTTON_TYPE_DARK = 'dark'; | ||
|
||
/** @var string */ | ||
public $link; | ||
/** @var string */ | ||
public $type; | ||
/** @var string|null */ | ||
public $caption; | ||
/** @var string|null */ | ||
public $icon; | ||
/** @var string|null */ | ||
public $title; | ||
|
||
/** | ||
* @param string $link | ||
* @param string $type | ||
* @param string|null $caption | ||
* @param string|null $icon | ||
* @param string|null $title | ||
*/ | ||
public function __construct(string $link, string $type, ?string $caption = null, ?string $icon = null, ?string $title = null) | ||
{ | ||
$this->link = $link; | ||
$this->type = $type; | ||
$this->caption = $caption; | ||
$this->icon = $icon; | ||
$this->title = $title; | ||
} | ||
|
||
/** | ||
* @return ButtonBuilder | ||
*/ | ||
public static function builder(): ButtonBuilder | ||
{ | ||
return new ButtonBuilder(); | ||
} | ||
} |
Oops, something went wrong.