-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
23 changed files
with
524 additions
and
282 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
39 changes: 39 additions & 0 deletions
39
modules/Backend/Support/ElementBuilders/IndexResourceBuilder.php
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,39 @@ | ||
<?php | ||
/** | ||
* JUZAWEB CMS - Laravel CMS for Your Project | ||
* | ||
* @package juzaweb/cms | ||
* @author The Anh Dang | ||
* @link https://juzaweb.com | ||
* @license GNU V2 | ||
*/ | ||
|
||
namespace Juzaweb\Backend\Support\ElementBuilders; | ||
|
||
use Juzaweb\CMS\Interfaces\ElementBuilders\ElementBuilder as ElementBuilderInterface; | ||
use Juzaweb\CMS\Abstracts\ElementBuilders\ElementBuilder; | ||
|
||
class IndexResourceBuilder extends ElementBuilder implements ElementBuilderInterface | ||
{ | ||
public function __construct(protected array $params = []) | ||
{ | ||
// | ||
} | ||
|
||
public function toArray(): array | ||
{ | ||
$builder = $this->builder(); | ||
$builder->row() | ||
->col(['cols' => 12]) | ||
->buttonGroup()->addClass('float-right') | ||
->link(['href' => $this->params['linkCreate']]) | ||
->text(trans('cms::app.add_new')) | ||
->addClass('btn btn-success'); | ||
|
||
$builder->row() | ||
->col(['cols' => 12]) | ||
->dataTable($this->params['dataTable']); | ||
|
||
return $builder->toArray(); | ||
} | ||
} |
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,23 @@ | ||
<?php | ||
/** | ||
* JUZAWEB CMS - Laravel CMS for Your Project | ||
* | ||
* @package juzaweb/cms | ||
* @author The Anh Dang | ||
* @link https://juzaweb.com | ||
* @license GNU V2 | ||
*/ | ||
|
||
namespace Juzaweb\CMS\Abstracts\ElementBuilders; | ||
|
||
use Juzaweb\CMS\Support\Element\Contracts\ElementBuilder as ElementBuilderContract; | ||
|
||
abstract class ElementBuilder | ||
{ | ||
public function builder(): ElementBuilderContract | ||
{ | ||
return app()->make(ElementBuilderContract::class); | ||
} | ||
|
||
abstract public function toArray(): array; | ||
} |
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,21 @@ | ||
<?php | ||
/** | ||
* JUZAWEB CMS - Laravel CMS for Your Project | ||
* | ||
* @package juzaweb/cms | ||
* @author The Anh Dang | ||
* @link https://juzaweb.com | ||
* @license GNU V2 | ||
*/ | ||
|
||
namespace Juzaweb\CMS\Interfaces\ElementBuilders; | ||
|
||
use Illuminate\Contracts\Support\Arrayable; | ||
use Juzaweb\CMS\Support\Element\Contracts\ElementBuilder as ElementBuilderContract; | ||
|
||
interface ElementBuilder extends Arrayable | ||
{ | ||
public function builder(): ElementBuilderContract; | ||
|
||
public function toArray(): array; | ||
} |
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
38 changes: 38 additions & 0 deletions
38
modules/CMS/Support/Element/Elements/Buttons/ButtonGroup.php
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,38 @@ | ||
<?php | ||
/** | ||
* JUZAWEB CMS - Laravel CMS for Your Project | ||
* | ||
* @package juzaweb/cms | ||
* @author The Anh Dang | ||
* @link https://juzaweb.com | ||
* @license GNU V2 | ||
*/ | ||
|
||
namespace Juzaweb\CMS\Support\Element\Elements\Buttons; | ||
|
||
use Juzaweb\CMS\Support\Element\Interfaces\Element; | ||
use Juzaweb\CMS\Support\Element\Traits\HasChildren; | ||
use Juzaweb\CMS\Support\Element\Traits\HasClass; | ||
|
||
class ButtonGroup implements Element | ||
{ | ||
use HasClass, HasChildren; | ||
|
||
protected string $element = 'button-group'; | ||
|
||
protected string $class = 'btn-group'; | ||
|
||
public function toArray(): array | ||
{ | ||
$data = get_object_vars($this); | ||
|
||
$data['className'] = $this->class; | ||
|
||
return $data; | ||
} | ||
|
||
public function render(): string | ||
{ | ||
return ''; | ||
} | ||
} |
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
2 changes: 1 addition & 1 deletion
2
modules/CMS/Support/Element/Inputs/Input.php → ...Support/Element/Elements/Inputs/Input.php
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
2 changes: 1 addition & 1 deletion
2
...s/CMS/Support/Element/Inputs/Textarea.php → ...port/Element/Elements/Inputs/Textarea.php
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,51 @@ | ||
<?php | ||
/** | ||
* JUZAWEB CMS - Laravel CMS for Your Project | ||
* | ||
* @package juzaweb/cms | ||
* @author The Anh Dang | ||
* @link https://juzaweb.com | ||
* @license GNU V2 | ||
*/ | ||
|
||
namespace Juzaweb\CMS\Support\Element\Elements; | ||
|
||
use Juzaweb\CMS\Support\Element\Interfaces\Element; | ||
use Juzaweb\CMS\Support\Element\Traits\HasChildren; | ||
use Juzaweb\CMS\Support\Element\Traits\HasClass; | ||
use Juzaweb\CMS\Support\Element\Traits\HasId; | ||
|
||
class Link implements Element | ||
{ | ||
use HasClass, HasId, HasChildren; | ||
|
||
protected string $element = 'link'; | ||
|
||
protected string $href; | ||
|
||
protected string $target; | ||
|
||
protected string $text; | ||
|
||
public function __construct(array $configs = []) | ||
{ | ||
// | ||
} | ||
|
||
public function text(string $text): static | ||
{ | ||
$this->text = $text; | ||
|
||
return $this; | ||
} | ||
|
||
public function toArray(): array | ||
{ | ||
return get_object_vars($this); | ||
} | ||
|
||
public function render(): string | ||
{ | ||
return ''; | ||
} | ||
} |
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,25 @@ | ||
<?php | ||
/** | ||
* JUZAWEB CMS - Laravel CMS for Your Project | ||
* | ||
* @package juzaweb/cms | ||
* @author The Anh Dang | ||
* @link https://juzaweb.com | ||
* @license GNU V2 | ||
*/ | ||
|
||
namespace Juzaweb\CMS\Support\Element\Traits; | ||
|
||
use Juzaweb\CMS\Support\Element\Elements\Buttons\ButtonGroup; | ||
|
||
trait HasButtonElement | ||
{ | ||
public function buttonGroup(): ButtonGroup | ||
{ | ||
$btn = new ButtonGroup(); | ||
|
||
$this->pushChild($btn); | ||
|
||
return $btn; | ||
} | ||
} |
Oops, something went wrong.