-
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
28 changed files
with
953 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*~ |
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,108 @@ | ||
<?php namespace Lbaig\Catalog; | ||
|
||
use Backend; | ||
use System\Classes\PluginBase; | ||
|
||
/** | ||
* Catalog Plugin Information File | ||
*/ | ||
class Plugin extends PluginBase | ||
{ | ||
/** | ||
* Returns information about this plugin. | ||
* | ||
* @return array | ||
*/ | ||
public function pluginDetails() | ||
{ | ||
return [ | ||
'name' => 'Catalog', | ||
'description' => 'No description provided yet...', | ||
'author' => 'Lbaig', | ||
'icon' => 'icon-leaf' | ||
]; | ||
} | ||
|
||
/** | ||
* Register method, called when the plugin is first registered. | ||
* | ||
* @return void | ||
*/ | ||
public function register() | ||
{ | ||
|
||
} | ||
|
||
/** | ||
* Boot method, called right before the request route. | ||
* | ||
* @return array | ||
*/ | ||
public function boot() | ||
{ | ||
|
||
} | ||
|
||
/** | ||
* Registers any front-end components implemented in this plugin. | ||
* | ||
* @return array | ||
*/ | ||
public function registerComponents() | ||
{ | ||
return []; // Remove this line to activate | ||
|
||
return [ | ||
'Lbaig\Catalog\Components\MyComponent' => 'myComponent', | ||
]; | ||
} | ||
|
||
/** | ||
* Registers any back-end permissions used by this plugin. | ||
* | ||
* @return array | ||
*/ | ||
public function registerPermissions() | ||
{ | ||
return []; // Remove this line to activate | ||
|
||
return [ | ||
'lbaig.catalog.some_permission' => [ | ||
'tab' => 'Catalog', | ||
'label' => 'Some permission' | ||
], | ||
]; | ||
} | ||
|
||
/** | ||
* Registers back-end navigation items for this plugin. | ||
* | ||
* @return array | ||
*/ | ||
public function registerNavigation() | ||
{ | ||
return [ | ||
'catalog' => [ | ||
'label' => 'Catalog', | ||
'url' => Backend::url('lbaig/catalog/products'), | ||
'icon' => 'icon-leaf', | ||
'permissions' => ['lbaig.catalog.*'], | ||
'order' => 500, | ||
'sideMenu' => [ | ||
'categories' => [ | ||
'label' => 'Categories', | ||
'icon' => 'icon-sitemap', | ||
'url' => Backend::url('lbaig/catalog/categories'), | ||
'permissions' => ['lbaig.lshop.some_permission'] | ||
], | ||
'products' => [ | ||
'label' => 'Products', | ||
'icon' => 'icon-book', | ||
'url' => Backend::url('lbaig/catalog/products'), | ||
'permissions' => ['lbaig.lshop.some_permission'] | ||
], | ||
] | ||
], | ||
]; | ||
} | ||
} |
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 namespace Lbaig\Catalog\Controllers; | ||
|
||
use BackendMenu; | ||
use Backend\Classes\Controller; | ||
|
||
/** | ||
* Categories Back-end Controller | ||
*/ | ||
class Categories extends Controller | ||
{ | ||
public $implement = [ | ||
'Backend.Behaviors.FormController', | ||
'Backend.Behaviors.ListController' | ||
]; | ||
|
||
public $formConfig = 'config_form.yaml'; | ||
public $listConfig = 'config_list.yaml'; | ||
|
||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
|
||
BackendMenu::setContext('Lbaig.Catalog', 'catalog', 'categories'); | ||
} | ||
} |
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 namespace Lbaig\Catalog\Controllers; | ||
|
||
use BackendMenu; | ||
use Backend\Classes\Controller; | ||
|
||
/** | ||
* Products Back-end Controller | ||
*/ | ||
class Products extends Controller | ||
{ | ||
public $implement = [ | ||
'Backend.Behaviors.FormController', | ||
'Backend.Behaviors.ListController' | ||
]; | ||
|
||
public $formConfig = 'config_form.yaml'; | ||
public $listConfig = 'config_list.yaml'; | ||
|
||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
|
||
BackendMenu::setContext('Lbaig.Catalog', 'catalog', 'products'); | ||
} | ||
} |
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 @@ | ||
<div data-control="toolbar"> | ||
<a | ||
href="<?= Backend::url('lbaig/catalog/categories/create') ?>" | ||
class="btn btn-primary oc-icon-plus"> | ||
New Category | ||
</a> | ||
|
||
<button | ||
class="btn btn-danger oc-icon-trash-o" | ||
disabled="disabled" | ||
onclick="$(this).data('request-data', { checked: $('.control-list').listWidget('getChecked') })" | ||
data-request="onDelete" | ||
data-request-confirm="Are you sure you want to delete the selected Categories?" | ||
data-trigger-action="enable" | ||
data-trigger=".control-list input[type=checkbox]" | ||
data-trigger-condition="checked" | ||
data-request-success="$(this).prop('disabled', 'disabled')" | ||
data-stripe-load-indicator> | ||
Delete selected | ||
</button> | ||
</div> |
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,31 @@ | ||
# =================================== | ||
# Form Behavior Config | ||
# =================================== | ||
|
||
# Record name | ||
name: Category | ||
|
||
# Model Form Field configuration | ||
form: $/lbaig/catalog/models/category/fields.yaml | ||
|
||
# Model Class name | ||
modelClass: Lbaig\Catalog\Models\Category | ||
|
||
# Default redirect location | ||
defaultRedirect: lbaig/catalog/categories | ||
|
||
# Create page | ||
create: | ||
title: Create Category | ||
redirect: lbaig/catalog/categories/update/:id | ||
redirectClose: lbaig/catalog/categories | ||
|
||
# Update page | ||
update: | ||
title: Edit Category | ||
redirect: lbaig/catalog/categories | ||
redirectClose: lbaig/catalog/categories | ||
|
||
# Preview page | ||
preview: | ||
title: Preview Category |
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,47 @@ | ||
# =================================== | ||
# List Behavior Config | ||
# =================================== | ||
|
||
# Model List Column configuration | ||
list: $/lbaig/catalog/models/category/columns.yaml | ||
|
||
# Model Class name | ||
modelClass: Lbaig\Catalog\Models\Category | ||
|
||
# List Title | ||
title: Manage Categories | ||
|
||
# Link URL for each record | ||
recordUrl: lbaig/catalog/categories/update/:id | ||
|
||
# Message to display if the list is empty | ||
noRecordsMessage: backend::lang.list.no_records | ||
|
||
# Records to display per page | ||
recordsPerPage: 20 | ||
|
||
# Display page numbers with pagination, disable to improve performance | ||
showPageNumbers: true | ||
|
||
# Displays the list column set up button | ||
showSetup: true | ||
|
||
# Displays the sorting link on each column | ||
showSorting: true | ||
|
||
# Default sorting column | ||
# defaultSort: | ||
# column: created_at | ||
# direction: desc | ||
|
||
# Display checkboxes next to each record | ||
showCheckboxes: true | ||
|
||
# Toolbar widget configuration | ||
toolbar: | ||
# Partial for toolbar buttons | ||
buttons: list_toolbar | ||
|
||
# Search widget configuration | ||
search: | ||
prompt: backend::lang.list.search_prompt |
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,48 @@ | ||
<?php Block::put('breadcrumb') ?> | ||
<ul> | ||
<li><a href="<?= Backend::url('lbaig/catalog/categories') ?>">Categories</a></li> | ||
<li><?= e($this->pageTitle) ?></li> | ||
</ul> | ||
<?php Block::endPut() ?> | ||
|
||
<?php if (!$this->fatalError): ?> | ||
|
||
<?= Form::open(['class' => 'layout']) ?> | ||
|
||
<div class="layout-row"> | ||
<?= $this->formRender() ?> | ||
</div> | ||
|
||
<div class="form-buttons"> | ||
<div class="loading-indicator-container"> | ||
<button | ||
type="submit" | ||
data-request="onSave" | ||
data-hotkey="ctrl+s, cmd+s" | ||
data-load-indicator="Creating Category..." | ||
class="btn btn-primary"> | ||
Create | ||
</button> | ||
<button | ||
type="button" | ||
data-request="onSave" | ||
data-request-data="close:1" | ||
data-hotkey="ctrl+enter, cmd+enter" | ||
data-load-indicator="Creating Category..." | ||
class="btn btn-default"> | ||
Create and Close | ||
</button> | ||
<span class="btn-text"> | ||
or <a href="<?= Backend::url('lbaig/catalog/categories') ?>">Cancel</a> | ||
</span> | ||
</div> | ||
</div> | ||
|
||
<?= Form::close() ?> | ||
|
||
<?php else: ?> | ||
|
||
<p class="flash-message static error"><?= e($this->fatalError) ?></p> | ||
<p><a href="<?= Backend::url('lbaig/catalog/categories') ?>" class="btn btn-default">Return to categories list</a></p> | ||
|
||
<?php endif ?> |
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,2 @@ | ||
|
||
<?= $this->listRender() ?> |
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,19 @@ | ||
<?php Block::put('breadcrumb') ?> | ||
<ul> | ||
<li><a href="<?= Backend::url('lbaig/catalog/categories') ?>">Categories</a></li> | ||
<li><?= e($this->pageTitle) ?></li> | ||
</ul> | ||
<?php Block::endPut() ?> | ||
|
||
<?php if (!$this->fatalError): ?> | ||
|
||
<div class="form-preview"> | ||
<?= $this->formRenderPreview() ?> | ||
</div> | ||
|
||
<?php else: ?> | ||
|
||
<p class="flash-message static error"><?= e($this->fatalError) ?></p> | ||
<p><a href="<?= Backend::url('lbaig/catalog/categories') ?>" class="btn btn-default">Return to categories list</a></p> | ||
|
||
<?php endif ?> |
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,56 @@ | ||
<?php Block::put('breadcrumb') ?> | ||
<ul> | ||
<li><a href="<?= Backend::url('lbaig/catalog/categories') ?>">Categories</a></li> | ||
<li><?= e($this->pageTitle) ?></li> | ||
</ul> | ||
<?php Block::endPut() ?> | ||
|
||
<?php if (!$this->fatalError): ?> | ||
|
||
<?= Form::open(['class' => 'layout']) ?> | ||
|
||
<div class="layout-row"> | ||
<?= $this->formRender() ?> | ||
</div> | ||
|
||
<div class="form-buttons"> | ||
<div class="loading-indicator-container"> | ||
<button | ||
type="submit" | ||
data-request="onSave" | ||
data-request-data="redirect:0" | ||
data-hotkey="ctrl+s, cmd+s" | ||
data-load-indicator="Saving Category..." | ||
class="btn btn-primary"> | ||
<u>S</u>ave | ||
</button> | ||
<button | ||
type="button" | ||
data-request="onSave" | ||
data-request-data="close:1" | ||
data-hotkey="ctrl+enter, cmd+enter" | ||
data-load-indicator="Saving Category..." | ||
class="btn btn-default"> | ||
Save and Close | ||
</button> | ||
<button | ||
type="button" | ||
class="oc-icon-trash-o btn-icon danger pull-right" | ||
data-request="onDelete" | ||
data-load-indicator="Deleting Category..." | ||
data-request-confirm="Delete this category?"> | ||
</button> | ||
<span class="btn-text"> | ||
or <a href="<?= Backend::url('lbaig/catalog/categories') ?>">Cancel</a> | ||
</span> | ||
</div> | ||
</div> | ||
|
||
<?= Form::close() ?> | ||
|
||
<?php else: ?> | ||
|
||
<p class="flash-message static error"><?= e($this->fatalError) ?></p> | ||
<p><a href="<?= Backend::url('lbaig/catalog/categories') ?>" class="btn btn-default">Return to categories list</a></p> | ||
|
||
<?php endif ?> |
Oops, something went wrong.