Merge branch 'develop' into l55upgrade
Conflicts: modules/system/assets/ui/storm.css
This commit is contained in:
commit
f0df1f458b
|
|
@ -43,6 +43,11 @@ class Relation extends FormWidgetBase
|
|||
*/
|
||||
public $emptyOption;
|
||||
|
||||
/**
|
||||
* @var string Use a custom scope method for the list query.
|
||||
*/
|
||||
public $scope;
|
||||
|
||||
//
|
||||
// Object properties
|
||||
//
|
||||
|
|
@ -66,6 +71,7 @@ class Relation extends FormWidgetBase
|
|||
'nameFrom',
|
||||
'descriptionFrom',
|
||||
'emptyOption',
|
||||
'scope',
|
||||
]);
|
||||
|
||||
if (isset($this->config->select)) {
|
||||
|
|
@ -118,6 +124,10 @@ class Relation extends FormWidgetBase
|
|||
$query->where($relationModel->getKeyName(), '<>', $model->getKey());
|
||||
}
|
||||
|
||||
if ($scopeMethod = $this->scope) {
|
||||
$query->$scopeMethod($model);
|
||||
}
|
||||
|
||||
// Even though "no constraints" is applied, belongsToMany constrains the query
|
||||
// by joining its pivot table. Remove all joins from the query.
|
||||
$query->getQuery()->getQuery()->joins = [];
|
||||
|
|
@ -139,6 +149,7 @@ class Relation extends FormWidgetBase
|
|||
$result = $query->getQuery()->get();
|
||||
}
|
||||
|
||||
|
||||
// Some simpler relations can specify a custom local or foreign "other" key,
|
||||
// which can be detected and implemented here automagically.
|
||||
$primaryKeyName = in_array($relationType, ['hasMany', 'belongsTo', 'hasOne'])
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
$checkedValues = (array) $field->value;
|
||||
$isScrollable = count($fieldOptions) > 10;
|
||||
$readOnly = $this->previewMode || $field->readOnly || $field->disabled;
|
||||
$quickselectEnabled = $field->getConfig('quickselect');
|
||||
?>
|
||||
<!-- Checkbox List -->
|
||||
<?php if ($readOnly && $field->value): ?>
|
||||
|
|
@ -37,14 +38,15 @@
|
|||
<?php elseif (!$readOnly && count($fieldOptions)): ?>
|
||||
|
||||
<div class="field-checkboxlist <?= $isScrollable ? 'is-scrollable' : '' ?>">
|
||||
<?php if ($isScrollable): ?>
|
||||
<?php if ($quickselectEnabled || $isScrollable): ?>
|
||||
<!-- Quick selection -->
|
||||
<small>
|
||||
<?= e(trans('backend::lang.form.select')) ?>:
|
||||
<a href="javascript:;" data-field-checkboxlist-all><?= e(trans('backend::lang.form.select_all')) ?></a>,
|
||||
<a href="javascript:;" data-field-checkboxlist-none><?= e(trans('backend::lang.form.select_none')) ?></a>
|
||||
</small>
|
||||
|
||||
<?php endif ?>
|
||||
<?php if ($isScrollable): ?>
|
||||
<!-- Scrollable Checkbox list -->
|
||||
<div class="field-checkboxlist-scrollable">
|
||||
<div class="control-scrollbar" data-control="scrollbar">
|
||||
|
|
|
|||
|
|
@ -34,6 +34,16 @@ class MediaFinder extends FormWidgetBase
|
|||
*/
|
||||
public $mode = 'file';
|
||||
|
||||
/**
|
||||
* @var int Preview image width
|
||||
*/
|
||||
public $imageWidth = null;
|
||||
|
||||
/**
|
||||
* @var int Preview image height
|
||||
*/
|
||||
public $imageHeight = null;
|
||||
|
||||
//
|
||||
// Object properties
|
||||
//
|
||||
|
|
@ -50,7 +60,9 @@ class MediaFinder extends FormWidgetBase
|
|||
{
|
||||
$this->fillFromConfig([
|
||||
'mode',
|
||||
'prompt'
|
||||
'prompt',
|
||||
'imageWidth',
|
||||
'imageHeight'
|
||||
]);
|
||||
|
||||
if ($this->formField->disabled) {
|
||||
|
|
@ -64,6 +76,7 @@ class MediaFinder extends FormWidgetBase
|
|||
public function render()
|
||||
{
|
||||
$this->prepareVars();
|
||||
|
||||
return $this->makePartial('mediafinder');
|
||||
}
|
||||
|
||||
|
|
@ -78,6 +91,8 @@ class MediaFinder extends FormWidgetBase
|
|||
$this->vars['field'] = $this->formField;
|
||||
$this->vars['prompt'] = str_replace('%s', '<i class="icon-folder"></i>', trans($this->prompt));
|
||||
$this->vars['mode'] = $this->mode;
|
||||
$this->vars['imageWidth'] = $this->imageWidth;
|
||||
$this->vars['imageHeight'] = $this->imageHeight;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -43,9 +43,18 @@
|
|||
|
||||
this.$el.one('dispose-control', this.proxy(this.dispose))
|
||||
|
||||
if (this.options.thumbnailWidth > 0) {
|
||||
this.$el.css('maxWidth', this.options.thumbnailWidth + 'px')
|
||||
}
|
||||
|
||||
else if (this.options.thumbnailHeight > 0) {
|
||||
this.$el.css('maxHeight', this.options.thumbnailHeight + 'px')
|
||||
}
|
||||
|
||||
// Stop here for preview mode
|
||||
if (this.options.isPreview)
|
||||
if (this.options.isPreview) {
|
||||
return
|
||||
}
|
||||
|
||||
this.$el.on('click', '.find-button', this.proxy(this.onClickFindButton))
|
||||
this.$el.on('click', '.find-remove-button', this.proxy(this.onClickRemoveButton))
|
||||
|
|
@ -108,7 +117,6 @@
|
|||
this.hide()
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
MediaFinder.prototype.evalIsPopulated = function() {
|
||||
|
|
@ -128,10 +136,10 @@
|
|||
|
||||
var old = $.fn.mediaFinder
|
||||
|
||||
$.fn.mediaFinder = function (option) {
|
||||
$.fn.mediaFinder = function(option) {
|
||||
var args = arguments;
|
||||
|
||||
return this.each(function () {
|
||||
return this.each(function() {
|
||||
var $this = $(this)
|
||||
var data = $this.data('oc.mediaFinder')
|
||||
var options = $.extend({}, MediaFinder.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
||||
|
|
@ -142,12 +150,12 @@
|
|||
|
||||
$.fn.mediaFinder.Constructor = MediaFinder
|
||||
|
||||
$.fn.mediaFinder.noConflict = function () {
|
||||
$.fn.mediaFinder.noConflict = function() {
|
||||
$.fn.mediaFinder = old
|
||||
return this
|
||||
}
|
||||
|
||||
$(document).render(function (){
|
||||
$(document).render(function() {
|
||||
$('[data-control="mediafinder"]').mediaFinder()
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
id="<?= $this->getId() ?>"
|
||||
class="field-mediafinder style-image-single is-image <?= $value ? 'is-populated' : '' ?> <?= $this->previewMode ? 'is-preview' : '' ?>"
|
||||
data-control="mediafinder"
|
||||
data-thumbnail-width="<?= $imageWidth ?: '0' ?>"
|
||||
data-thumbnail-height="<?= $imageHeight ?: '0' ?>"
|
||||
>
|
||||
|
||||
<!-- Find Button -->
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ class AssetList extends WidgetBase
|
|||
if (!@File::move($originalFullPath, $newFullPath)) {
|
||||
throw new ApplicationException(Lang::get(
|
||||
'cms::lang.asset.error_moving_file',
|
||||
['file'=>$basename]
|
||||
['file' => $basename]
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
@ -362,28 +362,28 @@ class AssetList extends WidgetBase
|
|||
if (!@File::copyDirectory($originalFullPath, $newFullPath)) {
|
||||
throw new ApplicationException(Lang::get(
|
||||
'cms::lang.asset.error_moving_directory',
|
||||
['dir'=>$basename]
|
||||
['dir' => $basename]
|
||||
));
|
||||
}
|
||||
|
||||
if (strpos($originalFullPath, '../') !== false) {
|
||||
throw new ApplicationException(Lang::get(
|
||||
'cms::lang.asset.error_deleting_directory',
|
||||
['dir'=>$basename]
|
||||
['dir' => $basename]
|
||||
));
|
||||
}
|
||||
|
||||
if (strpos($originalFullPath, $safeDir) !== 0) {
|
||||
throw new ApplicationException(Lang::get(
|
||||
'cms::lang.asset.error_deleting_directory',
|
||||
['dir'=>$basename]
|
||||
['dir' => $basename]
|
||||
));
|
||||
}
|
||||
|
||||
if (!@File::deleteDirectory($originalFullPath)) {
|
||||
throw new ApplicationException(Lang::get(
|
||||
'cms::lang.asset.error_deleting_directory',
|
||||
['dir'=>$basename]
|
||||
['dir' => $basename]
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
@ -414,7 +414,7 @@ class AssetList extends WidgetBase
|
|||
if (!File::makeDirectory($assetsPath)) {
|
||||
throw new ApplicationException(Lang::get(
|
||||
'cms::lang.cms_object.error_creating_directory',
|
||||
['name'=>$assetsPath]
|
||||
['name' => $assetsPath]
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
@ -655,7 +655,7 @@ class AssetList extends WidgetBase
|
|||
if ($uploadedFile->getSize() > $maxSize) {
|
||||
throw new ApplicationException(Lang::get(
|
||||
'cms::lang.asset.too_large',
|
||||
['max_size '=> File::sizeToString($maxSize)]
|
||||
['max_size' => File::sizeToString($maxSize)]
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -323,14 +323,14 @@ if (window.jQuery.request !== undefined) {
|
|||
.fail(function(jqXHR, textStatus, errorThrown) {
|
||||
if (!isRedirect) {
|
||||
$el.trigger('ajaxFail', [context, textStatus, jqXHR])
|
||||
if (loading) loading.hide()
|
||||
}
|
||||
if (loading) loading.hide()
|
||||
})
|
||||
.done(function(data, textStatus, jqXHR) {
|
||||
if (!isRedirect) {
|
||||
$el.trigger('ajaxDone', [context, data, textStatus, jqXHR])
|
||||
if (loading) loading.hide()
|
||||
}
|
||||
if (loading) loading.hide()
|
||||
})
|
||||
.always(function(dataOrXhr, textStatus, xhrOrError) {
|
||||
$el.trigger('ajaxAlways', [context, dataOrXhr, textStatus, xhrOrError])
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
position: fixed;
|
||||
width: 500px;
|
||||
left: 50%;
|
||||
top: 13px;
|
||||
top: 50px;
|
||||
margin-left: -250px;
|
||||
color: @color-flash-text;
|
||||
font-size: 14px;
|
||||
|
|
|
|||
|
|
@ -3009,4 +3009,4 @@ ul.autocomplete.dropdown-menu.inspector-autocomplete li a{padding:5px 12px;white
|
|||
.clockpicker-plate{border:none}
|
||||
.clockpicker-hours .clockpicker-tick{font-size:12px}
|
||||
.clockpicker-hours .clockpicker-tick.tick-inner{font-size:16px}
|
||||
.clockpicker-minutes .clockpicker-tick{font-size:16px}
|
||||
.clockpicker-minutes .clockpicker-tick{font-size:16px}
|
||||
|
|
|
|||
Loading…
Reference in New Issue