Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
sampoyigi committed Sep 30, 2020
2 parents 7e81f52 + 4a7f4ac commit 7de4026
Show file tree
Hide file tree
Showing 542 changed files with 5,386 additions and 5,517 deletions.
4 changes: 2 additions & 2 deletions app/admin/assets/js/ratings.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ $(function () {

html = '<tr id="table-row' + table_row + '">'
html += ' <td class="list-action text-center handle"><i class="fa fa-arrows-alt-v"></i></td>'
html += ' <td class="list-action handle"><a role="button" class="btn btn-outline-danger" onclick="confirm(\''+confirmMessage+'\') ? $(this).parent().parent().remove() : false;"><i class="fa fa-times-circle"></i></a></td>'
html += ' <td class="list-action handle"><a role="button" class="btn btn-outline-danger" onclick="confirm(\''+confirmMessage+'\') ? $(this).parent().parent().remove() : false;"><i class="fa fa-trash-alt"></i></a></td>'
html += ' <td><input type="text" name="ratings[' + table_row + ']" class="form-control" value="" /></td>'
html += '</tr>'

Expand All @@ -20,4 +20,4 @@ $(function () {
Sortable.create($('#ratings-field tbody').get(0), {
handle: '.handle',
})
})
})
15 changes: 14 additions & 1 deletion app/admin/classes/BasePaymentGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class BasePaymentGateway extends ModelAction

protected $configFields = [];

protected $configRules = [];

/**
* Class constructor
*
Expand All @@ -36,7 +38,10 @@ public function __construct($model = null)

$calledClass = strtolower(get_called_class());
$this->configPath = extension_path(File::normalizePath($calledClass));
$this->configFields = $this->loadConfig($this->defineFieldsConfig(), ['fields'], 'fields');

$formConfig = $this->loadConfig($this->defineFieldsConfig(), ['fields']);
$this->configFields = array_get($formConfig, 'fields');
$this->configRules = array_get($formConfig, 'rules');

if (!$model)
return;
Expand Down Expand Up @@ -81,6 +86,14 @@ public function getConfigFields()
return $this->configFields;
}

/**
* Returns the form configuration used by this model.
*/
public function getConfigRules()
{
return $this->configRules;
}

/**
* Registers a entry page with specific URL. For example,
* PayPal needs a landing page for the auto-return feature.
Expand Down
1 change: 1 addition & 0 deletions app/admin/classes/BaseWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public function __construct($controller, $config = [])
$this->partialPath[] = '$/'.$classPath;

$this->assetPath[] = '~/app/'.$classPath.'/assets';
$this->assetPath[] = '$/'.$classPath.'/assets';

$this->configPath = $controller->configPath;

Expand Down
1 change: 1 addition & 0 deletions app/admin/controllers/Mealtimes.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class Mealtimes extends \Admin\Classes\AdminController
public $implement = [
'Admin\Actions\ListController',
'Admin\Actions\FormController',
'Admin\Actions\LocationAwareController',
];

public $listConfig = [
Expand Down
6 changes: 3 additions & 3 deletions app/admin/controllers/Payments.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,13 @@ public function formValidate($model, $form)
['name', 'lang:admin::lang.label_name', 'required|min:2|max:128'],
['code', 'lang:admin::lang.payments.label_code', 'sometimes|required|alpha_dash|unique:payments,code'],
['priority', 'lang:admin::lang.payments.label_priority', 'required|integer'],
['description', 'lang:admin::lang.label_description', 'required|max:255'],
['description', 'lang:admin::lang.label_description', 'max:255'],
['is_default', 'lang:admin::lang.payments.label_default', 'required|integer'],
['status', 'lang:admin::lang.label_status', 'required|integer'],
];

if (isset($form->config['rules']))
$rules = array_merge($rules, $form->config['rules']);
if ($mergeRules = $form->model->getConfigRules())
array_push($rules, ...$mergeRules);

return $this->validatePasses($form->getSaveData(), $rules);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
<div class="dashboard-widget widget-charts">
<h6 class="widget-title"><?= e(trans($this->property('title'))) ?></h6>
<h6 class="widget-title">@lang($this->property('title'))</h6>
<div
class="chart-container"
data-control="chart"
data-alias="<?= $this->alias; ?>"
data-range-selector="#<?= $this->alias; ?>-daterange"
data-range-parent-selector="#<?= $this->alias; ?>-daterange-parent"
data-range-format="<?= $this->property('rangeFormat'); ?>"
data-alias="{{ $this->alias }}"
data-range-selector="#{{ $this->alias }}-daterange"
data-range-parent-selector="#{{ $this->alias }}-daterange-parent"
data-range-format="{{ $this->property('rangeFormat') }}"
>
<div
id="<?= $this->alias; ?>-daterange-parent"
id="{{ $this->alias }}-daterange-parent"
class="chart-toolbar d-flex justify-content-end pb-3"
>
<button
id="<?= $this->alias; ?>-daterange"
id="{{ $this->alias }}-daterange"
class="btn btn-light btn-sm"
data-control="daterange"
>
<i class="fa fa-calendar"></i>&nbsp;&nbsp;
<span><?php echo lang('admin::lang.dashboard.text_select_range'); ?></span>&nbsp;&nbsp;
<span>@lang('admin::lang.dashboard.text_select_range')</span>&nbsp;&nbsp;
<i class="fa fa-caret-down"></i>
</button>
</div>
<div class="chart-canvas">
<canvas
id="<?= $this->alias; ?>"
id="{{ $this->alias }}"
></canvas>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<div class="dashboard-widget widget-onboarding">
<h6 class="widget-title"><?= e(trans($this->property('title'))) ?></h6>
<h6 class="widget-title">@lang($this->property('title'))</h6>
<div class="row">
<div class="list-group list-group-flush w-100">
<?php foreach ($onboarding->listSteps() as $step) { ?>
<?php if ($completed = $step->completed AND $completed()) { ?>
@foreach($onboarding->listSteps() as $step)
@if($completed = $step->completed AND $completed())
<div class="list-group-item bg-transparent">
<i class="fa fa-check-circle-o fa-2x text-success float-left mr-3 my-2"></i>
<s class="d-block text-truncate"><?= e(trans($step->label)); ?></s>
<s class="text-muted d-block text-truncate"><?= e(trans($step->description)); ?></s>
<s class="d-block text-truncate">@lang($step->label)</s>
<s class="text-muted d-block text-truncate">@lang($step->description)</s>
</div>
<?php } else { ?>
<a class="list-group-item bg-transparent" href="<?= $step->url; ?>">
@else
<a class="list-group-item bg-transparent" href="{{ $step->url }}">
<span class="fa-stack float-left mr-3 my-2">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa <?= e(trans($step->icon)); ?> fa-stack-1x fa-inverse"></i>
<i class="fa @lang($step->icon) fa-stack-1x fa-inverse"></i>
</span>
<b class="d-block text-truncate"><?= e(trans($step->label)); ?></b>
<span class="text-muted d-block text-truncate"><?= e(trans($step->description)); ?></span>
<b class="d-block text-truncate">@lang($step->label)</b>
<span class="text-muted d-block text-truncate">@lang($step->description)</span>
</a>
<?php } ?>
<?php } ?>
@endif
@endforeach
</div>
</div>
</div>
5 changes: 5 additions & 0 deletions app/admin/dashboardwidgets/statistics/statistics.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div class="card-counter {{ $statsContext }}">
<i class="stat-icon {{ $statsIcon }}"></i>
<span class="stat-number">{{ $statsCount }}</span>
<span class="stat-text">@lang($statsLabel)</span>
</div>
5 changes: 0 additions & 5 deletions app/admin/dashboardwidgets/statistics/statistics.php

This file was deleted.

17 changes: 16 additions & 1 deletion app/admin/formwidgets/Relation.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Admin\Classes\BaseFormWidget;
use Admin\Classes\FormField;
use Admin\Facades\AdminLocation;
use DB;
use Exception;
use Illuminate\Database\Eloquent\Collection;
Expand Down Expand Up @@ -101,7 +102,7 @@ public function prepareVars()
* a nested HTML array attribute.
* Eg: list($model, $attribute) = $this->resolveModelAttribute($this->valueFrom);
*
* @param string $attribute .
* @param string $attribute .
*
* @return array
*/
Expand All @@ -123,6 +124,8 @@ protected function makeFormField()
$relationObject = $this->getRelationObject();
$query = $relationObject->newQuery();

$this->locationApplyScope($query);

[$model, $attribute] = $this->resolveModelAttribute($this->valueFrom);
$relationType = $model->getRelationType($attribute);
$this->relatedModel = $model->makeRelation($attribute);
Expand Down Expand Up @@ -194,4 +197,16 @@ protected function getRelationObject()

return $model->{$attribute}();
}

/**
* Apply location scope where required
*/
protected function locationApplyScope($query)
{
if (
!AdminLocation::check() OR !in_array(\Admin\Traits\Locationable::class, class_uses($query->getModel()))
) return;

$query->whereHasOrDoesntHaveLocation(AdminLocation::getId());
}
}
20 changes: 20 additions & 0 deletions app/admin/formwidgets/codeeditor/codeeditor.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@if ($this->previewMode)
<div class="form-control-static">{!! $value !!}</div>
@else
<div
class="field-codeeditor size-{{ $size }}"
data-control="code-editor"
data-mode="{{ $mode }}"
data-theme="{{ $theme }}"
data-line-separator="{{ $lineSeparator }}"
data-read-only="{{ $readOnly }}"
data-height="{{ $size == 'small' ? 250 : 520 }}"
>
<textarea
name="{{ $name }}"
id="{{ $this->getId('textarea') }}"
rows="20"
class="form-control"
>{!! trim($value) !!}</textarea>
</div>
@endif
20 changes: 0 additions & 20 deletions app/admin/formwidgets/codeeditor/codeeditor.php

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<div
class="input-group control-colorpicker"
data-control="colorpicker"
data-swatches-colors="<?= e(json_encode($availableColors)) ?>"
data-swatches-colors='@json($availableColors)'
>
<div class="component input-group-prepend input-group-icon"><i class="fa fa-square"></i></div>
<input
type="text"
id="<?= $this->getId('input') ?>"
name="<?= $name ?>"
id="{{ $this->getId('input') }}"
name="{{ $name }}"
class="form-control"
value="<?= $value ?>"
<?= $this->previewMode ? 'disabled="disabled"' : '' ?>>
</div>
value="{{ $value }}"
{!! ($this->previewMode) ? 'disabled="disabled"' : '' !!}>
</div>
15 changes: 15 additions & 0 deletions app/admin/formwidgets/connector/connector.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<div
id="{{ $this->getId('items-container') }}"
class="field-connector"
data-control="connector"
data-alias="{{ $this->alias }}"
data-sortable-container="#{{ $this->getId('items') }}"
data-sortable-handle=".{{ $this->getId('items') }}-handle"
>
<div
id="{{ $this->getId('items') }}"
role="tablist"
aria-multiselectable="true">
{!! $this->makePartial('connector/connector_items') !!}
</div>
</div>
15 changes: 0 additions & 15 deletions app/admin/formwidgets/connector/connector.php

This file was deleted.

45 changes: 45 additions & 0 deletions app/admin/formwidgets/connector/connector_item.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<div
id="{{ $this->getId('item-'.$index) }}"
class="card bg-light shadow-sm mb-2"
data-item-index="{{ $index }}"
>
<div class="card-body">
<div class="d-flex w-100 justify-content-between">
@if (!$this->previewMode AND $sortable)
<input type="hidden" name="{{ $sortableInputName }}[]" value="{{ $item->getKey() }}">
<div class="align-self-center">
<a
class="btn handle {{ $this->getId('items') }}-handle"
role="button">
<i class="fa fa-arrows-alt-v text-black-50"></i>
</a>
</div>
@endif
<div
class="flex-fill"
data-control="load-item"
data-item-id="{{ $item->getKey() }}"
role="button"
>
@if ($this->partial)
{!! $this->makePartial($this->partial, ['item' => $item]) !!}
@else
<p class="card-title font-weight-bold">{{ $item->{$nameFrom} }}</p>
<p class="card-subtitle mb-0">{{ $item->{$descriptionFrom} }}</p>
@endif
</div>
@unless ($this->previewMode)
<div class="align-self-center ml-auto">
<a
class="close text-danger"
aria-label="Remove"
data-control="delete-item"
data-item-id="{{ $item->getKey() }}"
data-item-selector="#{{ $this->getId('item-'.$index) }}"
data-confirm-message="@lang('admin::lang.alert_warning_confirm')"
><i class="fa fa-trash-alt"></i></a>
</div>
@endunless
</div>
</div>
</div>
Loading

0 comments on commit 7de4026

Please sign in to comment.