Skip to content

Commit 73f53ef

Browse files
author
hikki
committed
7.5
1 parent b0b67e5 commit 73f53ef

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

src/Assembly/Unit/Button.php

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class Button extends Input
1717
private $domId;
1818
private $title;
1919
private $trigger;
20+
private $color;
2021

2122
public function __construct(string $title)
2223
{
@@ -28,7 +29,7 @@ public function __construct(string $title)
2829
* @param array $xhr
2930
* @param string $formSelector
3031
*/
31-
public function bindRequest($xhr = ['url'=>'','method'=>'','data'=>[],'callback'=>'null'],$formSelector = '')
32+
public function bindRequest(array $xhr = ['url'=>'','method'=>'','data'=>[],'callback'=>'null'],$formSelector = '')
3233
{
3334
$xhr = array_merge(['url'=>'','method'=>'','data'=>[],'callback'=>'null'],$xhr);
3435
$data = json_encode($xhr['data']);
@@ -94,11 +95,36 @@ public function bindDialog(\Closure $closure,array $xhr = ['url' => '', 'method'
9495
return $this;
9596
}
9697

98+
/**
99+
* @param string $color red blue green yellow
100+
* @return $this
101+
*/
102+
public function color(string $color)
103+
{
104+
switch ($color){
105+
case 'red':
106+
$this->color = '-red';
107+
break;
108+
case 'blue':
109+
$this->color = '-blue';
110+
break;
111+
case 'green':
112+
$this->color = '-green';
113+
break;
114+
case 'yellow':
115+
$this->color = '-yellow';
116+
break;
117+
default:
118+
$this->color = '';
119+
}
120+
return $this;
121+
}
122+
97123
public function __toString()
98124
{
99125
$this->annotate();
100126
$content = <<<EOF
101-
<button type="{$this->type}" id="{$this->domId}" class="dlp dlp-button" {$this->annotation}>{$this->title}</button>
127+
<button type="{$this->type}" id="{$this->domId}" class="dlp dlp-button{$this->color}" {$this->annotation}>{$this->title}</button>
102128
<script>{$this->trigger}</script>
103129
EOF;
104130
return $content;

src/DLPServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ public function boot(DLP $extension)
2929
}
3030

3131
Admin::booting(function () {
32-
Admin::css('vendor/dlp/component.min.css?v7.3');
33-
Admin::headerJs('vendor/dlp/component.min.js?v7.3');
32+
Admin::css('vendor/dlp/component.min.css?v7.5');
33+
Admin::headerJs('vendor/dlp/component.min.js?v7.5');
3434
});
3535
}
3636
}

0 commit comments

Comments
 (0)