-
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.
initial category and product options
- Loading branch information
Showing
30 changed files
with
728 additions
and
3 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,28 @@ | ||
function initializeSorting() { | ||
var $tbody = $('.drag-handle').parents('table.data tbody'); | ||
Sortable.create($tbody[0], { | ||
handle: '.drag-handle', | ||
animation: 150, | ||
onEnd: function (evt) { | ||
var $inputs = $(evt.srcElement).find('td>div.drag-handle>input'); | ||
var $form = $('<form style="display: none;">'); | ||
$form.append($inputs.clone()) | ||
.request('onReorder', { | ||
complete: function () { | ||
$form.remove(); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
|
||
$(function () { | ||
initializeSorting(); | ||
|
||
/* change cursor on hover */ | ||
$(".drag-handle").hover(function() { | ||
$(this).css('cursor','move'); | ||
}, function() { | ||
$(this).css('cursor','auto'); | ||
}); | ||
}); |
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,38 @@ | ||
<?php namespace Lbaig\Catalog\Controllers; | ||
|
||
use BackendMenu; | ||
use Backend\Classes\Controller; | ||
use Lbaig\Catalog\Models\OptionItem; | ||
use Request; | ||
|
||
/** | ||
* Options Back-end Controller | ||
*/ | ||
class Options extends Controller | ||
{ | ||
public $implement = [ | ||
'Backend.Behaviors.FormController', | ||
'Backend.Behaviors.ListController', | ||
'Backend.Behaviors.RelationController' | ||
]; | ||
|
||
public $formConfig = 'config_form.yaml'; | ||
public $listConfig = 'config_list.yaml'; | ||
public $relationConfig = 'config_relation.yaml'; | ||
|
||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
|
||
BackendMenu::setContext('Lbaig.Catalog', 'catalog', 'options'); | ||
$this->addJs('/plugins/lbaig/catalog/assets/js/Sortable.min.js'); | ||
$this->addJs('/plugins/lbaig/catalog/assets/js/initialize_sorting.js'); | ||
} | ||
|
||
// to reorder the children OptionItem's | ||
public function onReorder() { | ||
$records = Request::input('rcd'); | ||
$model = new OptionItem; | ||
$model->setSortableOrder($records, range(1, count($records))); | ||
} | ||
} |
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/options/create') ?>" | ||
class="btn btn-primary oc-icon-plus"> | ||
New Option | ||
</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 Options?" | ||
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 @@ | ||
<?= $this->relationRender('optionItems') ?> |
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: Option | ||
|
||
# Model Form Field configuration | ||
form: $/lbaig/catalog/models/option/fields.yaml | ||
|
||
# Model Class name | ||
modelClass: Lbaig\Catalog\Models\Option | ||
|
||
# Default redirect location | ||
defaultRedirect: lbaig/catalog/options | ||
|
||
# Create page | ||
create: | ||
title: Create Option | ||
redirect: lbaig/catalog/options/update/:id | ||
redirectClose: lbaig/catalog/options | ||
|
||
# Update page | ||
update: | ||
title: Edit Option | ||
redirect: lbaig/catalog/options | ||
redirectClose: lbaig/catalog/options | ||
|
||
# Preview page | ||
preview: | ||
title: Preview Option |
Oops, something went wrong.