Add frontend for single responsive image with cropping
This commit is contained in:
parent
017305cd5b
commit
d1c7a25b29
|
@ -1 +1,6 @@
|
|||
/vendor
|
||||
/formwidgets/responsiveimage/assets/css/responsiveimage.build.css
|
||||
/formwidgets/responsiveimage/assets/js/responsiveimage.build.js
|
||||
/formwidgets/responsiveimage/assets/images/
|
||||
/formwidgets/responsiveimage/assets/mix-manifest.json
|
||||
/formwidgets/responsiveimage/assets/node_modules/
|
||||
|
|
|
@ -29,27 +29,10 @@ use Aweos\Resizer\Traits\ResponsiveWidget;
|
|||
*/
|
||||
class Responsiveimage extends FormWidgetBase
|
||||
{
|
||||
use ResponsiveSaver;
|
||||
use ResponsiveWidget;
|
||||
|
||||
//
|
||||
// Configurable properties
|
||||
//
|
||||
public $minWidth;
|
||||
|
||||
/**
|
||||
* @var string Prompt text to display for the upload button.
|
||||
*/
|
||||
public $prompt;
|
||||
|
||||
/**
|
||||
* @var int Preview image width
|
||||
*/
|
||||
public $imageWidth;
|
||||
|
||||
/**
|
||||
* @var int Preview image height
|
||||
*/
|
||||
public $imageHeight;
|
||||
public $aspectRatio;
|
||||
|
||||
/**
|
||||
* @var mixed Collection of acceptable file types.
|
||||
|
@ -91,7 +74,7 @@ class Responsiveimage extends FormWidgetBase
|
|||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected $defaultAlias = 'fileupload';
|
||||
protected $defaultAlias = 'responsiveimage';
|
||||
|
||||
/**
|
||||
* @var Backend\Widgets\Form The embedded form for modifying the properties of the selected file
|
||||
|
@ -106,22 +89,18 @@ class Responsiveimage extends FormWidgetBase
|
|||
$this->maxFilesize = $this->getUploadMaxFilesize();
|
||||
|
||||
$this->fillFromConfig([
|
||||
'prompt',
|
||||
'imageWidth',
|
||||
'imageHeight',
|
||||
'fileTypes',
|
||||
'maxFilesize',
|
||||
'mimeTypes',
|
||||
'thumbOptions',
|
||||
'useCaption',
|
||||
'attachOnUpload',
|
||||
'minWidth',
|
||||
'aspectRatio'
|
||||
]);
|
||||
|
||||
/*
|
||||
|
||||
if ($this->formField->disabled) {
|
||||
$this->previewMode = true;
|
||||
}
|
||||
|
||||
$this->getConfigFormWidget();
|
||||
//$this->getConfigFormWidget();
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -138,30 +117,8 @@ class Responsiveimage extends FormWidgetBase
|
|||
*/
|
||||
protected function prepareVars()
|
||||
{
|
||||
if ($this->formField->disabled) {
|
||||
$this->previewMode = true;
|
||||
}
|
||||
|
||||
if ($this->previewMode) {
|
||||
$this->useCaption = false;
|
||||
}
|
||||
|
||||
if ($this->maxFilesize > $this->getUploadMaxFilesize()) {
|
||||
throw new ApplicationException('Maximum allowed size for uploaded files: ' . $this->getUploadMaxFilesize());
|
||||
}
|
||||
|
||||
$this->vars['fileList'] = $fileList = $this->getFileList();
|
||||
$this->vars['singleFile'] = $fileList->first();
|
||||
$this->vars['displayMode'] = $this->getDisplayMode();
|
||||
$this->vars['emptyIcon'] = $this->getConfig('emptyIcon', 'icon-upload');
|
||||
$this->vars['imageHeight'] = $this->imageHeight;
|
||||
$this->vars['imageWidth'] = $this->imageWidth;
|
||||
$this->vars['acceptedFileTypes'] = $this->getAcceptedFileTypes(true);
|
||||
$this->vars['maxFilesize'] = $this->maxFilesize;
|
||||
$this->vars['cssDimensions'] = $this->getCssDimensions();
|
||||
$this->vars['cssBlockDimensions'] = $this->getCssDimensions('block');
|
||||
$this->vars['useCaption'] = $this->useCaption;
|
||||
$this->vars['prompt'] = $this->getPromptText();
|
||||
$this->vars['aspectRatio'] = $this->aspectRatio;
|
||||
$this->vars['minWidth'] = $this->minWidth;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -173,72 +130,9 @@ class Responsiveimage extends FormWidgetBase
|
|||
{
|
||||
$record = false;
|
||||
|
||||
if (!empty(post('file_id'))) {
|
||||
$record = $this->getRelationModel()::find(post('file_id')) ?: false;
|
||||
}
|
||||
|
||||
return $record;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the instantiated config Form widget
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function getConfigFormWidget()
|
||||
{
|
||||
if ($this->configFormWidget) {
|
||||
return $this->configFormWidget;
|
||||
}
|
||||
|
||||
$config = $this->makeConfig('~/modules/system/models/file/fields.yaml');
|
||||
$config->model = $this->getFileRecord() ?: $this->getRelationModel();
|
||||
$config->alias = $this->alias . $this->defaultAlias;
|
||||
$config->arrayName = $this->getFieldName();
|
||||
|
||||
$widget = $this->makeWidget(Form::class, $config);
|
||||
$widget->bindToController();
|
||||
|
||||
return $this->configFormWidget = $widget;
|
||||
}
|
||||
|
||||
protected function getFileList()
|
||||
{
|
||||
$list = $this
|
||||
->getRelationObject()
|
||||
->withDeferred($this->sessionKey)
|
||||
->orderBy('sort_order')
|
||||
->get()
|
||||
;
|
||||
|
||||
/*
|
||||
* Decorate each file with thumb and custom download path
|
||||
*/
|
||||
$list->each(function ($file) {
|
||||
$this->decorateFileAttributes($file);
|
||||
});
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the display mode for the file upload. Eg: file-multi, image-single, etc.
|
||||
* @return string
|
||||
*/
|
||||
protected function getDisplayMode()
|
||||
{
|
||||
$mode = $this->getConfig('mode', 'image');
|
||||
|
||||
if (str_contains($mode, '-')) {
|
||||
return $mode;
|
||||
}
|
||||
|
||||
$relationType = $this->getRelationType();
|
||||
$mode .= ($relationType == 'attachMany' || $relationType == 'morphMany') ? '-multi' : '-single';
|
||||
|
||||
return $mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the escaped and translated prompt text to display according to the type.
|
||||
* @return string
|
||||
|
@ -407,8 +301,8 @@ class Responsiveimage extends FormWidgetBase
|
|||
*/
|
||||
protected function loadAssets()
|
||||
{
|
||||
$this->addCss('css/fileupload.css', 'core');
|
||||
$this->addJs('js/fileupload.js', 'core');
|
||||
$this->addCss('css/responsiveimage.build.css', 'core');
|
||||
$this->addJs('js/responsiveimage.build.js', 'core');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,157 +0,0 @@
|
|||
.field-fileupload .upload-object {-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;position:relative;outline:none;overflow:hidden;display:inline-block;vertical-align:top}
|
||||
.field-fileupload .upload-object img {width:100%;height:100%}
|
||||
.field-fileupload .upload-object .icon-container {display:table;opacity:.6}
|
||||
.field-fileupload .upload-object .icon-container i {color:#95a5a6;display:inline-block}
|
||||
.field-fileupload .upload-object .icon-container div {display:table-cell;text-align:center;vertical-align:middle}
|
||||
.field-fileupload .upload-object .icon-container.image >div.icon-wrapper {display:none}
|
||||
.field-fileupload .upload-object h4 {font-size:13px;color:#2A3E51;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:150%;margin:15px 0 5px 0;padding-right:0;-webkit-transition:padding 0.1s;transition:padding 0.1s;position:relative}
|
||||
.field-fileupload .upload-object h4 a {position:absolute;right:0;top:0;display:none;font-weight:400}
|
||||
.field-fileupload .upload-object p.size {font-size:12px;color:#95a5a6}
|
||||
.field-fileupload .upload-object p.size strong {font-weight:400}
|
||||
.field-fileupload .upload-object .meta .drag-handle {position:absolute;bottom:0;right:0;cursor:move;display:block}
|
||||
.field-fileupload .upload-object .info h4 a,
|
||||
.field-fileupload .upload-object .meta a.upload-remove-button,
|
||||
.field-fileupload .upload-object .meta a.drag-handle {color:#2b3e50;display:none;font-size:13px;text-decoration:none}
|
||||
.field-fileupload .upload-object .icon-container {position:relative}
|
||||
.field-fileupload .upload-object .icon-container:after {background-image:url('../../../../../system/assets/ui/images/loader-transparent.svg');position:absolute;content:' ';width:40px;height:40px;left:50%;top:50%;margin-top:-20px;margin-left:-20px;display:block;background-size:40px 40px;background-position:50% 50%;-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite}
|
||||
.field-fileupload .upload-object.is-success .icon-container {opacity:1}
|
||||
.field-fileupload .upload-object.is-success .icon-container:after {opacity:0;-webkit-transition:opacity 0.3s ease;transition:opacity 0.3s ease}
|
||||
.field-fileupload .upload-object.is-error .icon-container:after {content:"";background:none;font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;content:"\f071";-webkit-animation:none;animation:none;font-size:40px;color:#ab2a1c;margin-top:-20px;margin-left:-20px;text-shadow:2px 2px 0 #fff}
|
||||
.field-fileupload .upload-object.is-loading .icon-container {opacity:.6}
|
||||
.field-fileupload .upload-object.is-loading .icon-container:after {opacity:1;-webkit-transition:opacity 0.3s ease;transition:opacity 0.3s ease}
|
||||
.field-fileupload .upload-object.is-success {cursor:pointer}
|
||||
.field-fileupload .upload-object.is-success .progress-bar {opacity:0;-webkit-transition:opacity 0.3s ease;transition:opacity 0.3s ease}
|
||||
.field-fileupload .upload-object.is-success:hover h4 a,
|
||||
.field-fileupload .upload-object.is-success:hover .meta .upload-remove-button,
|
||||
.field-fileupload .upload-object.is-success:hover .meta .drag-handle {display:block}
|
||||
.field-fileupload .upload-object.is-error {cursor:pointer}
|
||||
.field-fileupload .upload-object.is-error .icon-container {opacity:1}
|
||||
.field-fileupload .upload-object.is-error .icon-container >img,
|
||||
.field-fileupload .upload-object.is-error .icon-container >i {opacity:.5}
|
||||
.field-fileupload .upload-object.is-error .info h4 {color:#ab2a1c}
|
||||
.field-fileupload .upload-object.is-error .info h4 a {display:none}
|
||||
.field-fileupload .upload-object.is-error .meta {display:none}
|
||||
.field-fileupload.is-sortable {position:relative}
|
||||
.field-fileupload.is-sortable .upload-placeholder {position:relative;border:1px dotted #e0e0e0 !important}
|
||||
.field-fileupload.is-sortable .upload-object.dragged {position:absolute;opacity:0.5;filter:alpha(opacity=50);z-index:2000}
|
||||
.field-fileupload.is-sortable .upload-object.dragged .uploader-toolbar {display:none}
|
||||
.field-fileupload.is-preview .upload-button,
|
||||
.field-fileupload.is-preview .upload-remove-button,
|
||||
.field-fileupload.is-preview .meta a.drag-handle {display:none !important}
|
||||
@media (max-width:1024px) {.field-fileupload .upload-object.is-success h4 a,.field-fileupload .upload-object.is-success .meta .upload-remove-button,.field-fileupload .upload-object.is-success .meta .drag-handle {display:block !important }}
|
||||
.fileupload-config-form .fileupload-url-button {padding-left:0}
|
||||
.fileupload-config-form .fileupload-url-button >i {color:#666}
|
||||
.fileupload-config-form .file-upload-modal-image-header {background-color:#FEFEFE;background-image:-webkit-linear-gradient(45deg,#cbcbcb 25%,transparent 25%,transparent 75%,#cbcbcb 75%,#cbcbcb),-webkit-linear-gradient(45deg,#cbcbcb 25%,transparent 25%,transparent 75%,#cbcbcb 75%,#cbcbcb);background-image:-moz-linear-gradient(45deg,#cbcbcb 25%,transparent 25%,transparent 75%,#cbcbcb 75%,#cbcbcb),-moz-linear-gradient(45deg,#cbcbcb 25%,transparent 25%,transparent 75%,#cbcbcb 75%,#cbcbcb);background-image:-o-linear-gradient(45deg,#cbcbcb 25%,transparent 25%,transparent 75%,#cbcbcb 75%,#cbcbcb),-o-linear-gradient(45deg,#cbcbcb 25%,transparent 25%,transparent 75%,#cbcbcb 75%,#cbcbcb);background-image:-ms-linear-gradient(45deg,#cbcbcb 25%,transparent 25%,transparent 75%,#cbcbcb 75%,#cbcbcb),-ms-linear-gradient(45deg,#cbcbcb 25%,transparent 25%,transparent 75%,#cbcbcb 75%,#cbcbcb);background-image:linear-gradient(45deg,#cbcbcb 25%,transparent 25%,transparent 75%,#cbcbcb 75%,#cbcbcb),linear-gradient(45deg,#cbcbcb 25%,transparent 25%,transparent 75%,#cbcbcb 75%,#cbcbcb);-webkit-background-size:20px 20px;-moz-background-size:20px 20px;background-size:20px 20px;background-position:0 0,10px 10px}
|
||||
.fileupload-config-form .file-upload-modal-image-header,
|
||||
.fileupload-config-form .file-upload-modal-image-header img {border-top-right-radius:2px;border-top-left-radius:2px}
|
||||
.fileupload-config-form .file-upload-modal-image-header .close {position:absolute;top:20px;right:20px;background:#BDC3C7;opacity:.7;height:24px;width:22px}
|
||||
.fileupload-config-form .file-upload-modal-image-header .close:hover,
|
||||
.fileupload-config-form .file-upload-modal-image-header .close:focus {opacity:.9}
|
||||
.fileupload-config-form .file-upload-modal-image-header + .modal-body {padding-top:20px}
|
||||
.field-fileupload.style-image-multi .upload-button,
|
||||
.field-fileupload.style-image-multi .upload-object {margin:0 10px 10px 0}
|
||||
.field-fileupload.style-image-multi .upload-button {display:block;border:2px dashed #BDC3C7;background-clip:content-box;background-color:#F9F9F9;position:relative;outline:none;float:left;width:76px;height:76px}
|
||||
.field-fileupload.style-image-multi .upload-button .upload-button-icon {position:absolute;width:22px;height:22px;top:50%;left:50%;margin-top:-11px;margin-left:-11px}
|
||||
.field-fileupload.style-image-multi .upload-button .upload-button-icon:before {text-align:center;display:block;font-size:22px;height:22px;width:22px;line-height:22px;color:#BDC3C7}
|
||||
.field-fileupload.style-image-multi .upload-button .upload-button-icon.large-icon {width:34px;height:34px;top:50%;left:50%;margin-top:-17px;margin-left:-17px}
|
||||
.field-fileupload.style-image-multi .upload-button .upload-button-icon.large-icon:before {font-size:34px;height:24px;width:24px;line-height:24px}
|
||||
.field-fileupload.style-image-multi .upload-button:hover {border:2px dashed #1F99DC}
|
||||
.field-fileupload.style-image-multi .upload-button:hover .upload-button-icon:before {color:#1F99DC}
|
||||
.field-fileupload.style-image-multi .upload-button:focus {border:2px dashed #1F99DC}
|
||||
.field-fileupload.style-image-multi .upload-button:focus .upload-button-icon:before {color:#1F99DC}
|
||||
.field-fileupload.style-image-multi .upload-files-container {margin-left:90px}
|
||||
.field-fileupload.style-image-multi .upload-object {background:#fff;border:1px solid #ecf0f1;width:260px}
|
||||
.field-fileupload.style-image-multi .upload-object .progress-bar {display:block;width:100%;overflow:hidden;height:5px;background-color:#f5f5f5;border-radius:3px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);position:absolute;bottom:10px;left:0}
|
||||
.field-fileupload.style-image-multi .upload-object .progress-bar .upload-progress {float:left;width:0%;height:100%;line-height:5px;color:#fff;background-color:#5fb6f5;-webkit-box-shadow:none;box-shadow:none;-webkit-transition:width 0.6s ease;transition:width 0.6s ease}
|
||||
.field-fileupload.style-image-multi .upload-object .icon-container {border-right:1px solid #f6f8f9;float:left;display:inline-block;overflow:hidden;width:75px;height:75px}
|
||||
.field-fileupload.style-image-multi .upload-object .icon-container i {font-size:35px}
|
||||
.field-fileupload.style-image-multi .upload-object .icon-container.image img {border-bottom-left-radius:3px;border-top-left-radius:3px;width:auto}
|
||||
.field-fileupload.style-image-multi .upload-object .info {margin-left:90px}
|
||||
.field-fileupload.style-image-multi .upload-object .info h4 {padding-right:15px}
|
||||
.field-fileupload.style-image-multi .upload-object .info h4 a {right:15px}
|
||||
.field-fileupload.style-image-multi .upload-object .meta {position:absolute;bottom:0;left:0;right:0;margin:0 15px 0 90px}
|
||||
.field-fileupload.style-image-multi .upload-object .meta a.drag-handle {bottom:15px}
|
||||
.field-fileupload.style-image-multi .upload-object.upload-placeholder {height:75px;background-color:transparent}
|
||||
.field-fileupload.style-image-multi .upload-object.upload-placeholder:after {opacity:0}
|
||||
.field-fileupload.style-image-multi .upload-object:hover {background:#4da7e8 !important}
|
||||
.field-fileupload.style-image-multi .upload-object:hover i,
|
||||
.field-fileupload.style-image-multi .upload-object:hover p.size {color:#ecf0f1}
|
||||
.field-fileupload.style-image-multi .upload-object:hover h4 {color:white}
|
||||
.field-fileupload.style-image-multi .upload-object:hover .icon-container {border-right-color:#4da7e8 !important}
|
||||
.field-fileupload.style-image-multi .upload-object:hover h4 {padding-right:35px}
|
||||
.field-fileupload.style-image-multi.is-preview .upload-files-container {margin-left:0}
|
||||
.form-sidebar .field-fileupload.style-image-multi .upload-files-container {margin-left:0}
|
||||
.form-sidebar .field-fileupload.style-image-multi .upload-button {width:100%}
|
||||
@media (max-width:1280px) {.field-fileupload.style-image-multi .upload-object {width:230px }}
|
||||
@media (max-width:1024px) {.field-fileupload.style-image-multi .upload-button {width:100% }.field-fileupload.style-image-multi .upload-files-container {margin-left:0 }.field-fileupload.style-image-multi .upload-object {margin-right:0;display:block;width:auto }}
|
||||
.field-fileupload.style-image-single.is-populated .upload-button {display:none}
|
||||
.field-fileupload.style-image-single .upload-button {display:block;border:2px dashed #BDC3C7;background-clip:content-box;background-color:#F9F9F9;position:relative;outline:none;min-height:100px;min-width:100px}
|
||||
.field-fileupload.style-image-single .upload-button .upload-button-icon {position:absolute;width:22px;height:22px;top:50%;left:50%;margin-top:-11px;margin-left:-11px}
|
||||
.field-fileupload.style-image-single .upload-button .upload-button-icon:before {text-align:center;display:block;font-size:22px;height:22px;width:22px;line-height:22px;color:#BDC3C7}
|
||||
.field-fileupload.style-image-single .upload-button .upload-button-icon.large-icon {width:34px;height:34px;top:50%;left:50%;margin-top:-17px;margin-left:-17px}
|
||||
.field-fileupload.style-image-single .upload-button .upload-button-icon.large-icon:before {font-size:34px;height:24px;width:24px;line-height:24px}
|
||||
.field-fileupload.style-image-single .upload-button:hover {border:2px dashed #1F99DC}
|
||||
.field-fileupload.style-image-single .upload-button:hover .upload-button-icon:before {color:#1F99DC}
|
||||
.field-fileupload.style-image-single .upload-button:focus {border:2px dashed #1F99DC}
|
||||
.field-fileupload.style-image-single .upload-button:focus .upload-button-icon:before {color:#1F99DC}
|
||||
.field-fileupload.style-image-single .upload-object {padding-bottom:66px}
|
||||
.field-fileupload.style-image-single .upload-object .icon-container {border:1px solid #f6f8f9;background:rgba(255,255,255,0.5)}
|
||||
.field-fileupload.style-image-single .upload-object .icon-container.image img {-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;display:block;max-width:100%;height:auto;min-height:100px;min-width:100px}
|
||||
.field-fileupload.style-image-single .upload-object .progress-bar {display:block;width:100%;overflow:hidden;height:5px;background-color:#f5f5f5;border-radius:3px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);position:absolute;bottom:10px;left:0}
|
||||
.field-fileupload.style-image-single .upload-object .progress-bar .upload-progress {float:left;width:0%;height:100%;line-height:5px;color:#fff;background-color:#5fb6f5;-webkit-box-shadow:none;box-shadow:none;-webkit-transition:width 0.6s ease;transition:width 0.6s ease}
|
||||
.field-fileupload.style-image-single .upload-object .info {position:absolute;left:0;right:0;bottom:0;height:66px}
|
||||
.field-fileupload.style-image-single .upload-object .meta {position:absolute;bottom:65px;left:0;right:0;margin:0 15px}
|
||||
.field-fileupload.style-image-single .upload-object:hover h4 {padding-right:20px}
|
||||
@media (max-width:1024px) {.field-fileupload.style-image-single .upload-object h4 {padding-right:20px !important }}
|
||||
.field-fileupload.style-file-multi .upload-button {margin-bottom:10px}
|
||||
.field-fileupload.style-file-multi .upload-files-container {border:1px solid #eee;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;border-bottom:none;display:none}
|
||||
.field-fileupload.style-file-multi.is-populated .upload-files-container {display:block}
|
||||
.field-fileupload.style-file-multi .upload-object {display:block;width:100%;border-bottom:1px solid #eee;padding-left:10px}
|
||||
.field-fileupload.style-file-multi .upload-object:nth-child(even) {background-color:#f5f5f5}
|
||||
.field-fileupload.style-file-multi .upload-object .icon-container {position:absolute;top:0;left:10px;width:15px;padding:11px 7px}
|
||||
.field-fileupload.style-file-multi .upload-object .icon-container i {line-height:150%;font-size:15px}
|
||||
.field-fileupload.style-file-multi .upload-object .icon-container img {display:none}
|
||||
.field-fileupload.style-file-multi .upload-object .info {margin-left:35px;margin-right:15%}
|
||||
.field-fileupload.style-file-multi .upload-object .info h4,
|
||||
.field-fileupload.style-file-multi .upload-object .info p {margin:0;padding:11px 0;font-size:12px;font-weight:normal;line-height:150%;color:#666}
|
||||
.field-fileupload.style-file-multi .upload-object .info h4 {padding-right:15px}
|
||||
.field-fileupload.style-file-multi .upload-object .info h4 a {padding:10px 0;right:15px}
|
||||
.field-fileupload.style-file-multi .upload-object .info p.size {position:absolute;top:0;right:0;width:15%;display:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
||||
.field-fileupload.style-file-multi .upload-object .progress-bar {display:block;width:100%;overflow:hidden;height:5px;background-color:#f5f5f5;border-radius:3px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);position:absolute;top:18px;left:0}
|
||||
.field-fileupload.style-file-multi .upload-object .progress-bar .upload-progress {float:left;width:0%;height:100%;line-height:5px;color:#fff;background-color:#5fb6f5;-webkit-box-shadow:none;box-shadow:none;-webkit-transition:width 0.6s ease;transition:width 0.6s ease}
|
||||
.field-fileupload.style-file-multi .upload-object .meta {position:absolute;top:0;right:0;margin-right:15px;width:15%}
|
||||
.field-fileupload.style-file-multi .upload-object .meta a.drag-handle {top:-2px;bottom:auto;line-height:150%;padding:10px 0}
|
||||
.field-fileupload.style-file-multi .upload-object .icon-container:after {width:20px;height:20px;margin-top:-10px;margin-left:-10px;background-size:20px 20px}
|
||||
.field-fileupload.style-file-multi .upload-object.is-error .icon-container:after {font-size:20px}
|
||||
.field-fileupload.style-file-multi .upload-object.is-success .info p.size {display:block}
|
||||
.field-fileupload.style-file-multi .upload-object.upload-placeholder {height:35px;background-color:transparent}
|
||||
.field-fileupload.style-file-multi .upload-object.upload-placeholder:after {opacity:0}
|
||||
.field-fileupload.style-file-multi .upload-object:hover {background:#4da7e8 !important}
|
||||
.field-fileupload.style-file-multi .upload-object:hover i,
|
||||
.field-fileupload.style-file-multi .upload-object:hover p.size {color:#ecf0f1}
|
||||
.field-fileupload.style-file-multi .upload-object:hover h4 {color:white}
|
||||
.field-fileupload.style-file-multi .upload-object:hover .icon-container {border-right-color:#4da7e8 !important}
|
||||
.field-fileupload.style-file-multi .upload-object:hover h4 {padding-right:35px}
|
||||
@media (max-width:1199px) {.field-fileupload.style-file-multi .info {margin-right:20% !important }.field-fileupload.style-file-multi .info p.size {width:20% !important }.field-fileupload.style-file-multi .meta {width:20% !important }}
|
||||
@media (max-width:991px) {.field-fileupload.style-file-multi .upload-object h4 {padding-right:35px !important }.field-fileupload.style-file-multi .info {margin-right:25% !important }.field-fileupload.style-file-multi .info p.size {width:25% !important;padding-right:35px !important }.field-fileupload.style-file-multi .meta {width:25% !important }}
|
||||
.field-fileupload.style-file-single {background-color:#fff;border:1px solid #d1d6d9;overflow:hidden;position:relative;padding-right:30px;border-radius:3px;-webkit-box-shadow:inset 0 1px 0 rgba(209,214,217,0.25),0 1px 0 rgba(255,255,255,.5);box-shadow:inset 0 1px 0 rgba(209,214,217,0.25),0 1px 0 rgba(255,255,255,.5)}
|
||||
.field-fileupload.style-file-single .upload-button {position:absolute;top:50%;margin-top:-44px;height:88px;background:transparent;right:-2px;color:#595959}
|
||||
.field-fileupload.style-file-single .upload-button i {font-size:14px}
|
||||
.field-fileupload.style-file-single .upload-button:hover {color:#333}
|
||||
.field-fileupload.style-file-single .upload-empty-message {padding:8px 0 8px 11px;font-size:14px}
|
||||
.field-fileupload.style-file-single.is-populated .upload-empty-message {display:none}
|
||||
.field-fileupload.style-file-single .upload-object {display:block;width:100%;padding:7px 0 9px 0}
|
||||
.field-fileupload.style-file-single .upload-object .icon-container {position:absolute;top:0;left:0;width:15px;padding:0 5px;margin:8px 0 0 7px;text-align:center}
|
||||
.field-fileupload.style-file-single .upload-object .icon-container i {line-height:150%;font-size:15px}
|
||||
.field-fileupload.style-file-single .upload-object .icon-container img {display:none}
|
||||
.field-fileupload.style-file-single .upload-object .info {margin-left:34px;margin-right:15%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
||||
.field-fileupload.style-file-single .upload-object .info h4,
|
||||
.field-fileupload.style-file-single .upload-object .info p {display:inline;margin:0;padding:0;font-size:13px;line-height:150%;color:#666}
|
||||
.field-fileupload.style-file-single .upload-object .info p.size {font-weight:normal}
|
||||
.field-fileupload.style-file-single .upload-object .info p.size:before {content:" - "}
|
||||
.field-fileupload.style-file-single .upload-object .progress-bar {display:block;width:100%;overflow:hidden;height:5px;background-color:#f5f5f5;border-radius:3px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);position:absolute;top:50%;margin-top:-2px;right:5px}
|
||||
.field-fileupload.style-file-single .upload-object .progress-bar .upload-progress {float:left;width:0%;height:100%;line-height:5px;color:#fff;background-color:#5fb6f5;-webkit-box-shadow:none;box-shadow:none;-webkit-transition:width 0.6s ease;transition:width 0.6s ease}
|
||||
.field-fileupload.style-file-single .upload-object .meta {position:absolute;top:50%;margin-top:-44px;height:88px;right:0;width:15%}
|
||||
.field-fileupload.style-file-single .upload-object .meta .upload-remove-button {position:absolute;top:50%;right:0;height:20px;margin-top:-10px;margin-right:10px;z-index:100}
|
||||
.field-fileupload.style-file-single .upload-object .icon-container:after {width:20px;height:20px;margin-top:-10px;margin-left:-10px;background-size:20px 20px}
|
||||
.field-fileupload.style-file-single .upload-object.is-error .icon-container:after {font-size:20px}
|
|
@ -0,0 +1,204 @@
|
|||
.field-responsiveimage .upload-object {-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;position:relative;outline:none;overflow:hidden;display:inline-block;vertical-align:top}
|
||||
.field-responsiveimage .upload-object img {width:100%;height:100%}
|
||||
.field-responsiveimage .upload-object .icon-container {display:table;opacity:.6}
|
||||
.field-responsiveimage .upload-object .icon-container i {color:#95a5a6;display:inline-block}
|
||||
.field-responsiveimage .upload-object .icon-container div {display:table-cell;text-align:center;vertical-align:middle}
|
||||
.field-responsiveimage .upload-object .icon-container.image >div.icon-wrapper {display:none}
|
||||
.field-responsiveimage .upload-object h4 {font-size:13px;color:#2A3E51;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:150%;margin:15px 0 5px 0;padding-right:0;-webkit-transition:padding 0.1s;transition:padding 0.1s;position:relative}
|
||||
.field-responsiveimage .upload-object h4 a {position:absolute;right:0;top:0;display:none;font-weight:400}
|
||||
.field-responsiveimage .upload-object p.size {font-size:12px;color:#95a5a6}
|
||||
.field-responsiveimage .upload-object p.size strong {font-weight:400}
|
||||
.field-responsiveimage .upload-object .meta .drag-handle {position:absolute;bottom:0;right:0;cursor:move;display:block}
|
||||
.field-responsiveimage .upload-object .info h4 a,
|
||||
.field-responsiveimage .upload-object .meta a.upload-remove-button,
|
||||
.field-responsiveimage .upload-object .meta a.drag-handle {color:#2b3e50;display:none;font-size:13px;text-decoration:none}
|
||||
.field-responsiveimage .upload-object .icon-container {position:relative}
|
||||
.field-responsiveimage .upload-object .icon-container:after {background-image:url('../../../../../../../modules/system/assets/ui/images/loader-transparent.svg');position:absolute;content:' ';width:40px;height:40px;left:50%;top:50%;margin-top:-20px;margin-left:-20px;display:block;background-size:40px 40px;background-position:50% 50%;-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite}
|
||||
.field-responsiveimage .upload-object.is-success .icon-container {opacity:1}
|
||||
.field-responsiveimage .upload-object.is-success .icon-container:after {opacity:0;-webkit-transition:opacity 0.3s ease;transition:opacity 0.3s ease}
|
||||
.field-responsiveimage .upload-object.is-error .icon-container:after {content:"";background:none;font-family:FontAwesome;font-weight:normal;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;content:"\f071";-webkit-animation:none;animation:none;font-size:40px;color:#ab2a1c;margin-top:-20px;margin-left:-20px;text-shadow:2px 2px 0 #fff}
|
||||
.field-responsiveimage .upload-object.is-loading .icon-container {opacity:.6}
|
||||
.field-responsiveimage .upload-object.is-loading .icon-container:after {opacity:1;-webkit-transition:opacity 0.3s ease;transition:opacity 0.3s ease}
|
||||
.field-responsiveimage .upload-object.is-success {cursor:pointer}
|
||||
.field-responsiveimage .upload-object.is-success .progress-bar {opacity:0;-webkit-transition:opacity 0.3s ease;transition:opacity 0.3s ease}
|
||||
.field-responsiveimage .upload-object.is-success:hover h4 a,
|
||||
.field-responsiveimage .upload-object.is-success:hover .meta .upload-remove-button,
|
||||
.field-responsiveimage .upload-object.is-success:hover .meta .drag-handle {display:block}
|
||||
.field-responsiveimage .upload-object.is-error {cursor:pointer}
|
||||
.field-responsiveimage .upload-object.is-error .icon-container {opacity:1}
|
||||
.field-responsiveimage .upload-object.is-error .icon-container >img,
|
||||
.field-responsiveimage .upload-object.is-error .icon-container >i {opacity:.5}
|
||||
.field-responsiveimage .upload-object.is-error .info h4 {color:#ab2a1c}
|
||||
.field-responsiveimage .upload-object.is-error .info h4 a {display:none}
|
||||
.field-responsiveimage .upload-object.is-error .meta {display:none}
|
||||
.field-responsiveimage.is-sortable {position:relative}
|
||||
.field-responsiveimage.is-sortable .upload-placeholder {position:relative;border:1px dotted #e0e0e0 !important}
|
||||
.field-responsiveimage.is-sortable .upload-object.dragged {position:absolute;opacity:0.5;filter:alpha(opacity=50);z-index:2000}
|
||||
.field-responsiveimage.is-sortable .upload-object.dragged .uploader-toolbar {display:none}
|
||||
.field-responsiveimage.is-preview .upload-button,
|
||||
.field-responsiveimage.is-preview .upload-remove-button,
|
||||
.field-responsiveimage.is-preview .meta a.drag-handle {display:none !important}
|
||||
@media (max-width:1024px) {.field-responsiveimage .upload-object.is-success h4 a,.field-responsiveimage .upload-object.is-success .meta .upload-remove-button,.field-responsiveimage .upload-object.is-success .meta .drag-handle {display:block !important }}
|
||||
.fileupload-config-form .fileupload-url-button {padding-left:0}
|
||||
.fileupload-config-form .fileupload-url-button >i {color:#666}
|
||||
.fileupload-config-form .file-upload-modal-image-header {background-color:#FEFEFE;background-image:-webkit-linear-gradient(45deg,#cbcbcb 25%,transparent 25%,transparent 75%,#cbcbcb 75%,#cbcbcb),-webkit-linear-gradient(45deg,#cbcbcb 25%,transparent 25%,transparent 75%,#cbcbcb 75%,#cbcbcb);background-image:-moz-linear-gradient(45deg,#cbcbcb 25%,transparent 25%,transparent 75%,#cbcbcb 75%,#cbcbcb),-moz-linear-gradient(45deg,#cbcbcb 25%,transparent 25%,transparent 75%,#cbcbcb 75%,#cbcbcb);background-image:-o-linear-gradient(45deg,#cbcbcb 25%,transparent 25%,transparent 75%,#cbcbcb 75%,#cbcbcb),-o-linear-gradient(45deg,#cbcbcb 25%,transparent 25%,transparent 75%,#cbcbcb 75%,#cbcbcb);background-image:-ms-linear-gradient(45deg,#cbcbcb 25%,transparent 25%,transparent 75%,#cbcbcb 75%,#cbcbcb),-ms-linear-gradient(45deg,#cbcbcb 25%,transparent 25%,transparent 75%,#cbcbcb 75%,#cbcbcb);background-image:linear-gradient(45deg,#cbcbcb 25%,transparent 25%,transparent 75%,#cbcbcb 75%,#cbcbcb),linear-gradient(45deg,#cbcbcb 25%,transparent 25%,transparent 75%,#cbcbcb 75%,#cbcbcb);-webkit-background-size:20px 20px;-moz-background-size:20px 20px;background-size:20px 20px;background-position:0 0,10px 10px}
|
||||
.fileupload-config-form .file-upload-modal-image-header,
|
||||
.fileupload-config-form .file-upload-modal-image-header img {border-top-right-radius:2px;border-top-left-radius:2px}
|
||||
.fileupload-config-form .file-upload-modal-image-header .close {position:absolute;top:20px;right:20px;background:#BDC3C7;opacity:.7;height:24px;width:22px}
|
||||
.fileupload-config-form .file-upload-modal-image-header .close:hover,
|
||||
.fileupload-config-form .file-upload-modal-image-header .close:focus {opacity:.9}
|
||||
.fileupload-config-form .file-upload-modal-image-header + .modal-body {padding-top:20px}
|
||||
.field-responsiveimage.style-image-multi .upload-button,
|
||||
.field-responsiveimage.style-image-multi .upload-object {margin:0 10px 10px 0}
|
||||
.field-responsiveimage.style-image-multi .upload-button {display:block;border:2px dashed #BDC3C7;background-clip:content-box;background-color:#F9F9F9;position:relative;outline:none;float:left;width:76px;height:76px}
|
||||
.field-responsiveimage.style-image-multi .upload-button .upload-button-icon {position:absolute;width:22px;height:22px;top:50%;left:50%;margin-top:-11px;margin-left:-11px}
|
||||
.field-responsiveimage.style-image-multi .upload-button .upload-button-icon:before {text-align:center;display:block;font-size:22px;height:22px;width:22px;line-height:22px;color:#BDC3C7}
|
||||
.field-responsiveimage.style-image-multi .upload-button .upload-button-icon.large-icon {width:34px;height:34px;top:50%;left:50%;margin-top:-17px;margin-left:-17px}
|
||||
.field-responsiveimage.style-image-multi .upload-button .upload-button-icon.large-icon:before {font-size:34px;height:24px;width:24px;line-height:24px}
|
||||
.field-responsiveimage.style-image-multi .upload-button:hover {border:2px dashed #1F99DC}
|
||||
.field-responsiveimage.style-image-multi .upload-button:hover .upload-button-icon:before {color:#1F99DC}
|
||||
.field-responsiveimage.style-image-multi .upload-button:focus {border:2px dashed #1F99DC}
|
||||
.field-responsiveimage.style-image-multi .upload-button:focus .upload-button-icon:before {color:#1F99DC}
|
||||
.field-responsiveimage.style-image-multi .upload-files-container {margin-left:90px}
|
||||
.field-responsiveimage.style-image-multi .upload-object {background:#fff;border:1px solid #ecf0f1;width:260px}
|
||||
.field-responsiveimage.style-image-multi .upload-object .progress-bar {display:block;width:100%;overflow:hidden;height:5px;background-color:#f5f5f5;border-radius:3px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);position:absolute;bottom:10px;left:0}
|
||||
.field-responsiveimage.style-image-multi .upload-object .progress-bar .upload-progress {float:left;width:0%;height:100%;line-height:5px;color:#fff;background-color:#5fb6f5;-webkit-box-shadow:none;box-shadow:none;-webkit-transition:width 0.6s ease;transition:width 0.6s ease}
|
||||
.field-responsiveimage.style-image-multi .upload-object .icon-container {border-right:1px solid #f6f8f9;float:left;display:inline-block;overflow:hidden;width:75px;height:75px}
|
||||
.field-responsiveimage.style-image-multi .upload-object .icon-container i {font-size:35px}
|
||||
.field-responsiveimage.style-image-multi .upload-object .icon-container.image img {border-bottom-left-radius:3px;border-top-left-radius:3px;width:auto}
|
||||
.field-responsiveimage.style-image-multi .upload-object .info {margin-left:90px}
|
||||
.field-responsiveimage.style-image-multi .upload-object .info h4 {padding-right:15px}
|
||||
.field-responsiveimage.style-image-multi .upload-object .info h4 a {right:15px}
|
||||
.field-responsiveimage.style-image-multi .upload-object .meta {position:absolute;bottom:0;left:0;right:0;margin:0 15px 0 90px}
|
||||
.field-responsiveimage.style-image-multi .upload-object .meta a.drag-handle {bottom:15px}
|
||||
.field-responsiveimage.style-image-multi .upload-object.upload-placeholder {height:75px;background-color:transparent}
|
||||
.field-responsiveimage.style-image-multi .upload-object.upload-placeholder:after {opacity:0}
|
||||
.field-responsiveimage.style-image-multi .upload-object:hover {background:#4da7e8 !important}
|
||||
.field-responsiveimage.style-image-multi .upload-object:hover i,
|
||||
.field-responsiveimage.style-image-multi .upload-object:hover p.size {color:#ecf0f1}
|
||||
.field-responsiveimage.style-image-multi .upload-object:hover h4 {color:white}
|
||||
.field-responsiveimage.style-image-multi .upload-object:hover .icon-container {border-right-color:#4da7e8 !important}
|
||||
.field-responsiveimage.style-image-multi .upload-object:hover h4 {padding-right:35px}
|
||||
.field-responsiveimage.style-image-multi.is-preview .upload-files-container {margin-left:0}
|
||||
.form-sidebar .field-responsiveimage.style-image-multi .upload-files-container {margin-left:0}
|
||||
.form-sidebar .field-responsiveimage.style-image-multi .upload-button {width:100%}
|
||||
@media (max-width:1280px) {.field-responsiveimage.style-image-multi .upload-object {width:230px }}
|
||||
@media (max-width:1024px) {.field-responsiveimage.style-image-multi .upload-button {width:100% }.field-responsiveimage.style-image-multi .upload-files-container {margin-left:0 }.field-responsiveimage.style-image-multi .upload-object {margin-right:0;display:block;width:auto }}
|
||||
.field-responsiveimage.style-image-single.is-populated .upload-button {display:none}
|
||||
.field-responsiveimage.style-image-single .upload-button {display:block;border:2px dashed #BDC3C7;background-clip:content-box;background-color:#F9F9F9;position:relative;outline:none;min-height:100px;min-width:100px}
|
||||
.field-responsiveimage.style-image-single .upload-button .upload-button-icon {position:absolute;width:22px;height:22px;top:50%;left:50%;margin-top:-11px;margin-left:-11px}
|
||||
.field-responsiveimage.style-image-single .upload-button .upload-button-icon:before {text-align:center;display:block;font-size:22px;height:22px;width:22px;line-height:22px;color:#BDC3C7}
|
||||
.field-responsiveimage.style-image-single .upload-button .upload-button-icon.large-icon {width:34px;height:34px;top:50%;left:50%;margin-top:-17px;margin-left:-17px}
|
||||
.field-responsiveimage.style-image-single .upload-button .upload-button-icon.large-icon:before {font-size:34px;height:24px;width:24px;line-height:24px}
|
||||
.field-responsiveimage.style-image-single .upload-button:hover {border:2px dashed #1F99DC}
|
||||
.field-responsiveimage.style-image-single .upload-button:hover .upload-button-icon:before {color:#1F99DC}
|
||||
.field-responsiveimage.style-image-single .upload-button:focus {border:2px dashed #1F99DC}
|
||||
.field-responsiveimage.style-image-single .upload-button:focus .upload-button-icon:before {color:#1F99DC}
|
||||
.field-responsiveimage.style-image-single .upload-object {padding-bottom:66px}
|
||||
.field-responsiveimage.style-image-single .upload-object .icon-container {border:1px solid #f6f8f9;background:rgba(255,255,255,0.5)}
|
||||
.field-responsiveimage.style-image-single .upload-object .icon-container.image img {-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;display:block;max-width:100%;height:auto;min-height:100px;min-width:100px}
|
||||
.field-responsiveimage.style-image-single .upload-object .progress-bar {display:block;width:100%;overflow:hidden;height:5px;background-color:#f5f5f5;border-radius:3px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);position:absolute;bottom:10px;left:0}
|
||||
.field-responsiveimage.style-image-single .upload-object .progress-bar .upload-progress {float:left;width:0%;height:100%;line-height:5px;color:#fff;background-color:#5fb6f5;-webkit-box-shadow:none;box-shadow:none;-webkit-transition:width 0.6s ease;transition:width 0.6s ease}
|
||||
.field-responsiveimage.style-image-single .upload-object .info {position:absolute;left:0;right:0;bottom:0;height:66px}
|
||||
.field-responsiveimage.style-image-single .upload-object .meta {position:absolute;bottom:65px;left:0;right:0;margin:0 15px}
|
||||
.field-responsiveimage.style-image-single .upload-object:hover h4 {padding-right:20px}
|
||||
@media (max-width:1024px) {.field-responsiveimage.style-image-single .upload-object h4 {padding-right:20px !important }}
|
||||
.field-responsiveimage.style-file-multi .upload-button {margin-bottom:10px}
|
||||
.field-responsiveimage.style-file-multi .upload-files-container {border:1px solid #eee;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;border-bottom:none;display:none}
|
||||
.field-responsiveimage.style-file-multi.is-populated .upload-files-container {display:block}
|
||||
.field-responsiveimage.style-file-multi .upload-object {display:block;width:100%;border-bottom:1px solid #eee;padding-left:10px}
|
||||
.field-responsiveimage.style-file-multi .upload-object:nth-child(even) {background-color:#f5f5f5}
|
||||
.field-responsiveimage.style-file-multi .upload-object .icon-container {position:absolute;top:0;left:10px;width:15px;padding:11px 7px}
|
||||
.field-responsiveimage.style-file-multi .upload-object .icon-container i {line-height:150%;font-size:15px}
|
||||
.field-responsiveimage.style-file-multi .upload-object .icon-container img {display:none}
|
||||
.field-responsiveimage.style-file-multi .upload-object .info {margin-left:35px;margin-right:15%}
|
||||
.field-responsiveimage.style-file-multi .upload-object .info h4,
|
||||
.field-responsiveimage.style-file-multi .upload-object .info p {margin:0;padding:11px 0;font-size:12px;font-weight:normal;line-height:150%;color:#666}
|
||||
.field-responsiveimage.style-file-multi .upload-object .info h4 {padding-right:15px}
|
||||
.field-responsiveimage.style-file-multi .upload-object .info h4 a {padding:10px 0;right:15px}
|
||||
.field-responsiveimage.style-file-multi .upload-object .info p.size {position:absolute;top:0;right:0;width:15%;display:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
||||
.field-responsiveimage.style-file-multi .upload-object .progress-bar {display:block;width:100%;overflow:hidden;height:5px;background-color:#f5f5f5;border-radius:3px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);position:absolute;top:18px;left:0}
|
||||
.field-responsiveimage.style-file-multi .upload-object .progress-bar .upload-progress {float:left;width:0%;height:100%;line-height:5px;color:#fff;background-color:#5fb6f5;-webkit-box-shadow:none;box-shadow:none;-webkit-transition:width 0.6s ease;transition:width 0.6s ease}
|
||||
.field-responsiveimage.style-file-multi .upload-object .meta {position:absolute;top:0;right:0;margin-right:15px;width:15%}
|
||||
.field-responsiveimage.style-file-multi .upload-object .meta a.drag-handle {top:-2px;bottom:auto;line-height:150%;padding:10px 0}
|
||||
.field-responsiveimage.style-file-multi .upload-object .icon-container:after {width:20px;height:20px;margin-top:-10px;margin-left:-10px;background-size:20px 20px}
|
||||
.field-responsiveimage.style-file-multi .upload-object.is-error .icon-container:after {font-size:20px}
|
||||
.field-responsiveimage.style-file-multi .upload-object.is-success .info p.size {display:block}
|
||||
.field-responsiveimage.style-file-multi .upload-object.upload-placeholder {height:35px;background-color:transparent}
|
||||
.field-responsiveimage.style-file-multi .upload-object.upload-placeholder:after {opacity:0}
|
||||
.field-responsiveimage.style-file-multi .upload-object:hover {background:#4da7e8 !important}
|
||||
.field-responsiveimage.style-file-multi .upload-object:hover i,
|
||||
.field-responsiveimage.style-file-multi .upload-object:hover p.size {color:#ecf0f1}
|
||||
.field-responsiveimage.style-file-multi .upload-object:hover h4 {color:white}
|
||||
.field-responsiveimage.style-file-multi .upload-object:hover .icon-container {border-right-color:#4da7e8 !important}
|
||||
.field-responsiveimage.style-file-multi .upload-object:hover h4 {padding-right:35px}
|
||||
@media (max-width:1199px) {.field-responsiveimage.style-file-multi .info {margin-right:20% !important }.field-responsiveimage.style-file-multi .info p.size {width:20% !important }.field-responsiveimage.style-file-multi .meta {width:20% !important }}
|
||||
@media (max-width:991px) {.field-responsiveimage.style-file-multi .upload-object h4 {padding-right:35px !important }.field-responsiveimage.style-file-multi .info {margin-right:25% !important }.field-responsiveimage.style-file-multi .info p.size {width:25% !important;padding-right:35px !important }.field-responsiveimage.style-file-multi .meta {width:25% !important }}
|
||||
.field-responsiveimage.style-file-single {background-color:#fff;border:1px solid #d1d6d9;overflow:hidden;position:relative;padding-right:30px;border-radius:3px;-webkit-box-shadow:inset 0 1px 0 rgba(209,214,217,0.25),0 1px 0 rgba(255,255,255,.5);box-shadow:inset 0 1px 0 rgba(209,214,217,0.25),0 1px 0 rgba(255,255,255,.5)}
|
||||
.field-responsiveimage.style-file-single .upload-button {position:absolute;top:50%;margin-top:-44px;height:88px;background:transparent;right:-2px;color:#595959}
|
||||
.field-responsiveimage.style-file-single .upload-button i {font-size:14px}
|
||||
.field-responsiveimage.style-file-single .upload-button:hover {color:#333}
|
||||
.field-responsiveimage.style-file-single .upload-empty-message {padding:8px 0 8px 11px;font-size:14px}
|
||||
.field-responsiveimage.style-file-single.is-populated .upload-empty-message {display:none}
|
||||
.field-responsiveimage.style-file-single .upload-object {display:block;width:100%;padding:7px 0 9px 0}
|
||||
.field-responsiveimage.style-file-single .upload-object .icon-container {position:absolute;top:0;left:0;width:15px;padding:0 5px;margin:8px 0 0 7px;text-align:center}
|
||||
.field-responsiveimage.style-file-single .upload-object .icon-container i {line-height:150%;font-size:15px}
|
||||
.field-responsiveimage.style-file-single .upload-object .icon-container img {display:none}
|
||||
.field-responsiveimage.style-file-single .upload-object .info {margin-left:34px;margin-right:15%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
||||
.field-responsiveimage.style-file-single .upload-object .info h4,
|
||||
.field-responsiveimage.style-file-single .upload-object .info p {display:inline;margin:0;padding:0;font-size:13px;line-height:150%;color:#666}
|
||||
.field-responsiveimage.style-file-single .upload-object .info p.size {font-weight:normal}
|
||||
.field-responsiveimage.style-file-single .upload-object .info p.size:before {content:" - "}
|
||||
.field-responsiveimage.style-file-single .upload-object .progress-bar {display:block;width:100%;overflow:hidden;height:5px;background-color:#f5f5f5;border-radius:3px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);position:absolute;top:50%;margin-top:-2px;right:5px}
|
||||
.field-responsiveimage.style-file-single .upload-object .progress-bar .upload-progress {float:left;width:0%;height:100%;line-height:5px;color:#fff;background-color:#5fb6f5;-webkit-box-shadow:none;box-shadow:none;-webkit-transition:width 0.6s ease;transition:width 0.6s ease}
|
||||
.field-responsiveimage.style-file-single .upload-object .meta {position:absolute;top:50%;margin-top:-44px;height:88px;right:0;width:15%}
|
||||
.field-responsiveimage.style-file-single .upload-object .meta .upload-remove-button {position:absolute;top:50%;right:0;height:20px;margin-top:-10px;margin-right:10px;z-index:100}
|
||||
.field-responsiveimage.style-file-single .upload-object .icon-container:after {width:20px;height:20px;margin-top:-10px;margin-left:-10px;background-size:20px 20px}
|
||||
.field-responsiveimage.style-file-single .upload-object.is-error .icon-container:after {font-size:20px}
|
||||
|
||||
.field-responsiveimage {
|
||||
.vue-dropzone {
|
||||
display: none;
|
||||
}
|
||||
.preview-container {
|
||||
display: grid;
|
||||
grid-gap: 0.5rem;
|
||||
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
|
||||
.cdz-preview {
|
||||
display: flex;
|
||||
position: relative;
|
||||
background: white;
|
||||
border: 1px solid rgba(0,0,0,0.2);
|
||||
div.details {
|
||||
padding: 1rem;
|
||||
flex: 1 0 0;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
justify-content: space-evenly;
|
||||
flex-direction: column;
|
||||
& > div {
|
||||
font-size: 1.2rem;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
img {
|
||||
width: 15rem;
|
||||
height: 10rem;
|
||||
object-fit: cover;
|
||||
}
|
||||
div.cdz-progress {
|
||||
position: absolute;
|
||||
height: 5px;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
.dz-upload {
|
||||
transition: width 0.2s;
|
||||
background: hsl(200.9, 78.6%, 45.9%);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,478 +0,0 @@
|
|||
/*
|
||||
* File upload form field control
|
||||
*
|
||||
* Data attributes:
|
||||
* - data-control="fileupload" - enables the file upload plugin
|
||||
* - data-unique-id="XXX" - an optional identifier for multiple uploaders on the same page, this value will
|
||||
* appear in the postback variable called X_OCTOBER_FILEUPLOAD
|
||||
* - data-template - a Dropzone.js template to use for each item
|
||||
* - data-error-template - a popover template used to show an error
|
||||
* - data-sort-handler - AJAX handler for sorting postbacks
|
||||
* - data-config-handler - AJAX handler for configuration popup
|
||||
*
|
||||
* JavaScript API:
|
||||
* $('div').fileUploader()
|
||||
*
|
||||
* Dependancies:
|
||||
* - Dropzone.js
|
||||
*/
|
||||
+function ($) { "use strict";
|
||||
|
||||
var Base = $.oc.foundation.base,
|
||||
BaseProto = Base.prototype
|
||||
|
||||
// FILEUPLOAD CLASS DEFINITION
|
||||
// ============================
|
||||
|
||||
var FileUpload = function (element, options) {
|
||||
this.$el = $(element)
|
||||
this.options = options || {}
|
||||
|
||||
$.oc.foundation.controlUtils.markDisposable(element)
|
||||
Base.call(this)
|
||||
this.init()
|
||||
}
|
||||
|
||||
FileUpload.prototype = Object.create(BaseProto)
|
||||
FileUpload.prototype.constructor = FileUpload
|
||||
|
||||
FileUpload.prototype.init = function() {
|
||||
if (this.options.isMulti === null) {
|
||||
this.options.isMulti = this.$el.hasClass('is-multi')
|
||||
}
|
||||
|
||||
if (this.options.isPreview === null) {
|
||||
this.options.isPreview = this.$el.hasClass('is-preview')
|
||||
}
|
||||
|
||||
if (this.options.isSortable === null) {
|
||||
this.options.isSortable = this.$el.hasClass('is-sortable')
|
||||
}
|
||||
|
||||
this.$el.one('dispose-control', this.proxy(this.dispose))
|
||||
this.$uploadButton = $('.upload-button', this.$el)
|
||||
this.$filesContainer = $('.upload-files-container', this.$el)
|
||||
this.uploaderOptions = {}
|
||||
|
||||
this.$el.on('click', '.upload-object.is-success', this.proxy(this.onClickSuccessObject))
|
||||
this.$el.on('click', '.upload-object.is-error', this.proxy(this.onClickErrorObject))
|
||||
|
||||
// Stop here for preview mode
|
||||
if (this.options.isPreview)
|
||||
return
|
||||
|
||||
this.$el.on('click', '.upload-remove-button', this.proxy(this.onRemoveObject))
|
||||
|
||||
this.bindUploader()
|
||||
|
||||
if (this.options.isSortable) {
|
||||
this.bindSortable()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
FileUpload.prototype.dispose = function() {
|
||||
|
||||
this.$el.off('click', '.upload-object.is-success', this.proxy(this.onClickSuccessObject))
|
||||
this.$el.off('click', '.upload-object.is-error', this.proxy(this.onClickErrorObject))
|
||||
this.$el.off('click', '.upload-remove-button', this.proxy(this.onRemoveObject))
|
||||
|
||||
this.$el.off('dispose-control', this.proxy(this.dispose))
|
||||
this.$el.removeData('oc.fileUpload')
|
||||
|
||||
this.$el = null
|
||||
this.$uploadButton = null
|
||||
this.$filesContainer = null
|
||||
this.uploaderOptions = null
|
||||
|
||||
// In some cases options could contain callbacks,
|
||||
// so it's better to clean them up too.
|
||||
this.options = null
|
||||
|
||||
BaseProto.dispose.call(this)
|
||||
}
|
||||
|
||||
//
|
||||
// Uploading
|
||||
//
|
||||
|
||||
FileUpload.prototype.bindUploader = function() {
|
||||
this.uploaderOptions = {
|
||||
url: this.options.url,
|
||||
paramName: this.options.paramName,
|
||||
clickable: this.$uploadButton.get(0),
|
||||
previewsContainer: this.$filesContainer.get(0),
|
||||
maxFiles: !this.options.isMulti ? 1 : null,
|
||||
maxFilesize: this.options.maxFilesize,
|
||||
timeout: 0,
|
||||
headers: {}
|
||||
}
|
||||
|
||||
if (this.options.fileTypes) {
|
||||
this.uploaderOptions.acceptedFiles = this.options.fileTypes
|
||||
}
|
||||
|
||||
if (this.options.template) {
|
||||
this.uploaderOptions.previewTemplate = $(this.options.template).html()
|
||||
}
|
||||
|
||||
this.uploaderOptions.thumbnailWidth = this.options.thumbnailWidth
|
||||
? this.options.thumbnailWidth : null
|
||||
|
||||
this.uploaderOptions.thumbnailHeight = this.options.thumbnailHeight
|
||||
? this.options.thumbnailHeight : null
|
||||
|
||||
this.uploaderOptions.resize = this.onResizeFileInfo
|
||||
|
||||
/*
|
||||
* Add CSRF token to headers
|
||||
*/
|
||||
var token = $('meta[name="csrf-token"]').attr('content')
|
||||
if (token) {
|
||||
this.uploaderOptions.headers['X-CSRF-TOKEN'] = token
|
||||
}
|
||||
|
||||
this.dropzone = new Dropzone(this.$el.get(0), this.uploaderOptions)
|
||||
this.dropzone.on('addedfile', this.proxy(this.onUploadAddedFile))
|
||||
this.dropzone.on('sending', this.proxy(this.onUploadSending))
|
||||
this.dropzone.on('success', this.proxy(this.onUploadSuccess))
|
||||
this.dropzone.on('error', this.proxy(this.onUploadError))
|
||||
}
|
||||
|
||||
FileUpload.prototype.onResizeFileInfo = function(file) {
|
||||
var info,
|
||||
targetWidth,
|
||||
targetHeight
|
||||
|
||||
if (!this.options.thumbnailWidth && !this.options.thumbnailWidth) {
|
||||
targetWidth = targetHeight = 100
|
||||
}
|
||||
else if (this.options.thumbnailWidth) {
|
||||
targetWidth = this.options.thumbnailWidth
|
||||
targetHeight = this.options.thumbnailWidth * file.height / file.width
|
||||
}
|
||||
else if (this.options.thumbnailHeight) {
|
||||
targetWidth = this.options.thumbnailHeight * file.height / file.width
|
||||
targetHeight = this.options.thumbnailHeight
|
||||
}
|
||||
|
||||
// drawImage(image, srcX, srcY, srcWidth, srcHeight, trgX, trgY, trgWidth, trgHeight) takes an image, clips it to
|
||||
// the rectangle (srcX, srcY, srcWidth, srcHeight), scales it to dimensions (trgWidth, trgHeight), and draws it
|
||||
// on the canvas at coordinates (trgX, trgY).
|
||||
info = {
|
||||
srcX: 0,
|
||||
srcY: 0,
|
||||
srcWidth: file.width,
|
||||
srcHeight: file.height,
|
||||
trgX: 0,
|
||||
trgY: 0,
|
||||
trgWidth: targetWidth,
|
||||
trgHeight: targetHeight
|
||||
}
|
||||
|
||||
return info
|
||||
}
|
||||
|
||||
FileUpload.prototype.onUploadAddedFile = function(file) {
|
||||
var $object = $(file.previewElement).data('dzFileObject', file),
|
||||
filesize = this.getFilesize(file)
|
||||
|
||||
// Change filesize format to match October\Rain\Filesystem\Filesystem::sizeToString() format
|
||||
$(file.previewElement).find('[data-dz-size]').html('<strong>' + filesize.size + '</strong> ' + filesize.units)
|
||||
|
||||
// Remove any exisiting objects for single variety
|
||||
if (!this.options.isMulti) {
|
||||
this.removeFileFromElement($object.siblings())
|
||||
}
|
||||
|
||||
this.evalIsPopulated()
|
||||
}
|
||||
|
||||
FileUpload.prototype.onUploadSending = function(file, xhr, formData) {
|
||||
this.addExtraFormData(formData)
|
||||
xhr.setRequestHeader('X-OCTOBER-REQUEST-HANDLER', this.options.uploadHandler)
|
||||
}
|
||||
|
||||
FileUpload.prototype.onUploadSuccess = function(file, response) {
|
||||
var $preview = $(file.previewElement),
|
||||
$img = $('.image img', $preview)
|
||||
|
||||
$preview.addClass('is-success')
|
||||
|
||||
if (response.id) {
|
||||
$preview.data('id', response.id)
|
||||
$preview.data('path', response.path)
|
||||
$('.upload-remove-button', $preview).data('request-data', { file_id: response.id })
|
||||
$img.attr('src', response.thumb)
|
||||
}
|
||||
|
||||
this.triggerChange();
|
||||
}
|
||||
|
||||
FileUpload.prototype.onUploadError = function(file, error) {
|
||||
var $preview = $(file.previewElement)
|
||||
$preview.addClass('is-error')
|
||||
}
|
||||
|
||||
/*
|
||||
* Trigger change event (Compatibility with october.form.js)
|
||||
*/
|
||||
FileUpload.prototype.triggerChange = function() {
|
||||
this.$el.closest('[data-field-name]').trigger('change.oc.formwidget')
|
||||
}
|
||||
|
||||
FileUpload.prototype.addExtraFormData = function(formData) {
|
||||
if (this.options.extraData) {
|
||||
$.each(this.options.extraData, function (name, value) {
|
||||
formData.append(name, value)
|
||||
})
|
||||
}
|
||||
|
||||
var $form = this.$el.closest('form')
|
||||
if ($form.length > 0) {
|
||||
$.each($form.serializeArray(), function (index, field) {
|
||||
formData.append(field.name, field.value)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
FileUpload.prototype.removeFileFromElement = function($element) {
|
||||
var self = this
|
||||
|
||||
$element.each(function() {
|
||||
var $el = $(this),
|
||||
obj = $el.data('dzFileObject')
|
||||
|
||||
if (obj) {
|
||||
self.dropzone.removeFile(obj)
|
||||
}
|
||||
else {
|
||||
$el.remove()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//
|
||||
// Sorting
|
||||
//
|
||||
|
||||
FileUpload.prototype.bindSortable = function() {
|
||||
var
|
||||
self = this,
|
||||
placeholderEl = $('<div class="upload-object upload-placeholder"/>').css({
|
||||
width: this.options.imageWidth,
|
||||
height: this.options.imageHeight
|
||||
})
|
||||
|
||||
this.$filesContainer.sortable({
|
||||
itemSelector: 'div.upload-object.is-success',
|
||||
nested: false,
|
||||
tolerance: -100,
|
||||
placeholder: placeholderEl,
|
||||
handle: '.drag-handle',
|
||||
onDrop: function ($item, container, _super) {
|
||||
_super($item, container)
|
||||
self.onSortAttachments()
|
||||
},
|
||||
distance: 10
|
||||
})
|
||||
}
|
||||
|
||||
FileUpload.prototype.onSortAttachments = function() {
|
||||
if (this.options.sortHandler) {
|
||||
|
||||
/*
|
||||
* Build an object of ID:ORDER
|
||||
*/
|
||||
var orderData = {}
|
||||
|
||||
this.$el.find('.upload-object.is-success')
|
||||
.each(function(index){
|
||||
var id = $(this).data('id')
|
||||
orderData[id] = index + 1
|
||||
})
|
||||
|
||||
this.$el.request(this.options.sortHandler, {
|
||||
data: { sortOrder: orderData }
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// User interaction
|
||||
//
|
||||
|
||||
FileUpload.prototype.onRemoveObject = function(ev) {
|
||||
var self = this,
|
||||
$object = $(ev.target).closest('.upload-object')
|
||||
|
||||
$(ev.target)
|
||||
.closest('.upload-remove-button')
|
||||
.one('ajaxPromise', function(){
|
||||
$object.addClass('is-loading')
|
||||
})
|
||||
.one('ajaxDone', function(){
|
||||
self.removeFileFromElement($object)
|
||||
self.evalIsPopulated()
|
||||
self.triggerChange()
|
||||
})
|
||||
.request()
|
||||
|
||||
ev.stopPropagation()
|
||||
}
|
||||
|
||||
FileUpload.prototype.onClickSuccessObject = function(ev) {
|
||||
if ($(ev.target).closest('.meta').length) return
|
||||
|
||||
var $target = $(ev.target).closest('.upload-object')
|
||||
|
||||
if (!this.options.configHandler) {
|
||||
window.open($target.data('path'))
|
||||
return
|
||||
}
|
||||
|
||||
$target.popup({
|
||||
handler: this.options.configHandler,
|
||||
extraData: { file_id: $target.data('id') }
|
||||
})
|
||||
|
||||
$target.one('popupComplete', function(event, element, modal){
|
||||
|
||||
modal.one('ajaxDone', 'button[type=submit]', function(e, context, data) {
|
||||
if (data.displayName) {
|
||||
$('[data-dz-name]', $target).text(data.displayName)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
FileUpload.prototype.onClickErrorObject = function(ev) {
|
||||
var
|
||||
self = this,
|
||||
$target = $(ev.target).closest('.upload-object'),
|
||||
errorMsg = $('[data-dz-errormessage]', $target).text(),
|
||||
$template = $(this.options.errorTemplate)
|
||||
|
||||
// Remove any exisiting objects for single variety
|
||||
if (!this.options.isMulti) {
|
||||
this.removeFileFromElement($target.siblings())
|
||||
}
|
||||
|
||||
$target.ocPopover({
|
||||
content: Mustache.render($template.html(), { errorMsg: errorMsg }),
|
||||
modal: true,
|
||||
highlightModalTarget: true,
|
||||
placement: 'top',
|
||||
fallbackPlacement: 'left',
|
||||
containerClass: 'popover-danger'
|
||||
})
|
||||
|
||||
var $container = $target.data('oc.popover').$container
|
||||
$container.one('click', '[data-remove-file]', function() {
|
||||
$target.data('oc.popover').hide()
|
||||
self.removeFileFromElement($target)
|
||||
self.evalIsPopulated()
|
||||
})
|
||||
}
|
||||
|
||||
//
|
||||
// Helpers
|
||||
//
|
||||
|
||||
FileUpload.prototype.evalIsPopulated = function() {
|
||||
var isPopulated = !!$('.upload-object', this.$filesContainer).length
|
||||
this.$el.toggleClass('is-populated', isPopulated)
|
||||
|
||||
// Reset maxFiles counter
|
||||
if (!isPopulated) {
|
||||
this.dropzone.removeAllFiles()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Replicates the formatting of October\Rain\Filesystem\Filesystem::sizeToString(). This method will return
|
||||
* an object with the file size amount and the unit used as `size` and `units` respectively.
|
||||
*/
|
||||
FileUpload.prototype.getFilesize = function (file) {
|
||||
var formatter = new Intl.NumberFormat('en', {
|
||||
style: 'decimal',
|
||||
minimumFractionDigits: 2,
|
||||
maximumFractionDigits: 2
|
||||
}),
|
||||
size = 0,
|
||||
units = 'bytes'
|
||||
|
||||
if (file.size >= 1073741824) {
|
||||
size = formatter.format(file.size / 1073741824)
|
||||
units = 'GB'
|
||||
} else if (file.size >= 1048576) {
|
||||
size = formatter.format(file.size / 1048576)
|
||||
units = 'MB'
|
||||
} else if (file.size >= 1024) {
|
||||
size = formatter.format(file.size / 1024)
|
||||
units = 'KB'
|
||||
} else if (file.size > 1) {
|
||||
size = file.size
|
||||
units = 'bytes'
|
||||
} else if (file.size == 1) {
|
||||
size = 1
|
||||
units = 'byte'
|
||||
}
|
||||
|
||||
return {
|
||||
size: size,
|
||||
units: units
|
||||
}
|
||||
}
|
||||
|
||||
FileUpload.DEFAULTS = {
|
||||
url: window.location,
|
||||
uploadHandler: null,
|
||||
configHandler: null,
|
||||
sortHandler: null,
|
||||
uniqueId: null,
|
||||
extraData: {},
|
||||
paramName: 'file_data',
|
||||
fileTypes: null,
|
||||
maxFilesize: 256,
|
||||
template: null,
|
||||
errorTemplate: null,
|
||||
isMulti: null,
|
||||
isPreview: null,
|
||||
isSortable: null,
|
||||
thumbnailWidth: 120,
|
||||
thumbnailHeight: 120
|
||||
}
|
||||
|
||||
// FILEUPLOAD PLUGIN DEFINITION
|
||||
// ============================
|
||||
|
||||
var old = $.fn.fileUploader
|
||||
|
||||
$.fn.fileUploader = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('oc.fileUpload')
|
||||
var options = $.extend({}, FileUpload.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
||||
if (!data) $this.data('oc.fileUpload', (data = new FileUpload(this, options)))
|
||||
if (typeof option == 'string') data[option].call($this)
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.fileUploader.Constructor = FileUpload
|
||||
|
||||
// FILEUPLOAD NO CONFLICT
|
||||
// =================
|
||||
|
||||
$.fn.fileUploader.noConflict = function () {
|
||||
$.fn.fileUpload = old
|
||||
return this
|
||||
}
|
||||
|
||||
// FILEUPLOAD DATA-API
|
||||
// ===============
|
||||
$(document).render(function () {
|
||||
$('[data-control="fileupload"]').fileUploader()
|
||||
})
|
||||
|
||||
}(window.jQuery);
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"name": "assets",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "webpack.mix.js",
|
||||
"scripts": {
|
||||
"dev": "npm run development",
|
||||
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
|
||||
"watch": "npm run development -- --watch",
|
||||
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
|
||||
"prod": "npm run production",
|
||||
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"cross-env": "^7.0.2",
|
||||
"laravel-mix": "^5.0.7",
|
||||
"postcss-nested": "^4.0.0",
|
||||
"vue": "^2.6.12",
|
||||
"vue2-dropzone": "^3.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"vue-template-compiler": "^2.6.12"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,168 @@
|
|||
<template>
|
||||
<div
|
||||
class="field-responsiveimage style-image-single"
|
||||
data-control="responsiveimage"
|
||||
>
|
||||
|
||||
<!-- Add New Image -->
|
||||
<a href="javascript:;" class="upload-button" ref="addQueueTrigger" v-show="addVisible">
|
||||
<span class="upload-button-icon oc-icon-upload"></span>
|
||||
</a>
|
||||
|
||||
<vue-dropzone @vdropzone-thumbnail="onAdd" v-if="loaded" ref="dropzone" :id="id" :options="dropzoneOptions"></vue-dropzone>
|
||||
|
||||
<div class="preview-container" ref="previewsContainer"></div>
|
||||
|
||||
<!-- Existing file -->
|
||||
<!--
|
||||
<div class="upload-files-container">
|
||||
<div class="upload-object is-success">
|
||||
<div class="icon-container image">
|
||||
<img src="<?= $singleFile->thumbUrl ?>" alt="" />
|
||||
</div>
|
||||
<div class="info">
|
||||
<h4 class="filename">
|
||||
<span data-dz-name><?= e($singleFile->title ?: $singleFile->file_name) ?></span>
|
||||
<a
|
||||
href="javascript:;"
|
||||
class="upload-remove-button"
|
||||
data-request="<?= $this->getEventHandler('onRemoveAttachment') ?>"
|
||||
data-request-confirm="<?= e(trans('backend::lang.fileupload.remove_confirm')) ?>"
|
||||
data-request-data="file_id: <?= $singleFile->id ?>"
|
||||
><i class="icon-times"></i></a>
|
||||
</h4>
|
||||
<p class="size"><?= e($singleFile->sizeToString()) ?></p>
|
||||
</div>
|
||||
<div class="meta"></div>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Template for new file -->
|
||||
<!--
|
||||
<script type="text/template" id="<?= $this->getId('template') ?>">
|
||||
<div class="upload-object dz-preview dz-file-preview">
|
||||
<div class="icon-container image">
|
||||
<img data-dz-thumbnail style="<?= $cssDimensions ?>" alt="" />
|
||||
</div>
|
||||
<div class="info">
|
||||
<h4 class="filename">
|
||||
<span data-dz-name></span>
|
||||
<a
|
||||
href="javascript:;"
|
||||
class="upload-remove-button"
|
||||
data-request="<?= $this->getEventHandler('onRemoveAttachment') ?>"
|
||||
data-request-confirm="<?= e(trans('backend::lang.fileupload.remove_confirm')) ?>"
|
||||
><i class="icon-times"></i></a>
|
||||
</h4>
|
||||
<p class="size" data-dz-size></p>
|
||||
</div>
|
||||
<div class="meta">
|
||||
<div class="progress-bar"><span class="upload-progress" data-dz-uploadprogress></span></div>
|
||||
<div class="error-message"><span data-dz-errormessage></span></div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
-->
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import vueDropzone from 'vue2-dropzone';
|
||||
import popup from './popup.mixin.js';
|
||||
|
||||
export default {
|
||||
mixins: [ popup ],
|
||||
|
||||
data: function() {
|
||||
return {
|
||||
addVisible: true,
|
||||
content: {
|
||||
sections: [],
|
||||
placeholders: {
|
||||
header: {}
|
||||
}
|
||||
},
|
||||
generalSettings: {
|
||||
sidebarVisible: true
|
||||
},
|
||||
loaded: false
|
||||
};
|
||||
},
|
||||
|
||||
components: { vueDropzone },
|
||||
props: {
|
||||
cropOptions: {},
|
||||
mode: {
|
||||
required: true
|
||||
},
|
||||
formid: {},
|
||||
handlers: {}
|
||||
},
|
||||
computed: {
|
||||
id() {
|
||||
return Math.random().toString(36).substring(7);
|
||||
},
|
||||
asString() {
|
||||
return JSON.stringify(this.content);
|
||||
},
|
||||
dropzoneOptions() {
|
||||
return {
|
||||
paramName: 'file_data',
|
||||
autoQueue: false,
|
||||
url: window.location,
|
||||
clickable: this.$refs.addQueueTrigger,
|
||||
previewsContainer: this.$refs.previewsContainer,
|
||||
headers: {
|
||||
'X-OCTOBER-REQUEST-HANDLER': this.handlers.onUpload,
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
},
|
||||
previewTemplate: `
|
||||
<div class="cdz-preview">
|
||||
<img data-dz-thumbnail />
|
||||
<div class="details">
|
||||
<div><span data-dz-name></span></div>
|
||||
<div data-dz-size></div>
|
||||
</div>
|
||||
<div class="cdz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div>
|
||||
</div>`
|
||||
};
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onAdd(file) {
|
||||
if (file.width < this.cropOptions.minWidth) {
|
||||
console.log('zu klein');
|
||||
$.oc.flashMsg({
|
||||
text: `Dieses Bild ist zu klein. Bitte wähle ein Bild mit mindestens ${this.cropOptions.minWidth} Pixel Breite.`,
|
||||
class: 'error'
|
||||
});
|
||||
|
||||
this.$refs.dropzone.removeFile(file);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.addVisible = false;
|
||||
|
||||
this.showPopup(file).then((ret) => {
|
||||
console.log(ret);
|
||||
}).catch((err) => {
|
||||
this.$refs.dropzone.removeFile(file);
|
||||
this.addVisible = true;
|
||||
});
|
||||
},
|
||||
upload() {
|
||||
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.loaded = true;
|
||||
var self = this;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
import Vue from 'vue';
|
||||
import App from './App';
|
||||
|
||||
+function ($) { "use strict";
|
||||
var Base = $.oc.foundation.base,
|
||||
BaseProto = Base.prototype
|
||||
|
||||
var Responsiveimage = function (element, options) {
|
||||
this.$el = $(element)
|
||||
this.$form = $(element).closest('form');
|
||||
this.options = options || {}
|
||||
|
||||
$.oc.foundation.controlUtils.markDisposable(element)
|
||||
Base.call(this)
|
||||
this.init()
|
||||
}
|
||||
|
||||
Responsiveimage.prototype = Object.create(BaseProto)
|
||||
Responsiveimage.prototype.constructor = Responsiveimage
|
||||
|
||||
Responsiveimage.prototype.init = function() {
|
||||
this.$app = new Vue({
|
||||
el: this.$el.children('div').get(0),
|
||||
components: { App }
|
||||
});
|
||||
}
|
||||
|
||||
Responsiveimage.DEFAULTS = {
|
||||
|
||||
}
|
||||
|
||||
// PLUGIN DEFINITION
|
||||
// ============================
|
||||
|
||||
var old = $.fn.responsiveimage
|
||||
|
||||
$.fn.responsiveimage = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('oc.responsiveimage')
|
||||
var options = $.extend({}, Responsiveimage.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
||||
if (!data) $this.data('oc.responsiveimage', (data = new Responsiveimage(this, options)))
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.responsiveimage.Constructor = Responsiveimage
|
||||
|
||||
$.fn.responsiveimage.noConflict = function () {
|
||||
$.fn.responsiveimage = old
|
||||
return this
|
||||
}
|
||||
|
||||
$(document).render(function (){
|
||||
$('[data-responsiveimage]').responsiveimage()
|
||||
})
|
||||
|
||||
}(window.jQuery);
|
|
@ -0,0 +1,107 @@
|
|||
export default {
|
||||
|
||||
data: function() {
|
||||
return {
|
||||
popup: null,
|
||||
jcrop: null
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
onChangeCrop() {
|
||||
this.popup.values.crop = this.jcrop.tellSelect();
|
||||
},
|
||||
showPopup(file) {
|
||||
var _cls = this;
|
||||
this.popup = {
|
||||
file: file,
|
||||
values: { crop: null }
|
||||
};
|
||||
|
||||
if ($(`#${this.popupId}`).length == 0) {
|
||||
$('body').append(this.popupContent);
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
var $popup = $(`#${this.popupId}`);
|
||||
$popup.modal({ backdrop: false });
|
||||
|
||||
$popup.on('shown.bs.modal', function() {
|
||||
var $cropContainer = $popup.find('[data-jcrop]');
|
||||
|
||||
var imageElement = new Image();
|
||||
imageElement.src = file.dataURL;
|
||||
$cropContainer.append(imageElement);
|
||||
|
||||
var jcropOptions = {
|
||||
shade: true,
|
||||
boxWidth: $cropContainer.width(),
|
||||
onChange: _cls.onChangeCrop,
|
||||
aspectRatio: _cls.cropOptions.aspectRatio,
|
||||
minSize: [_cls.cropOptions.minWidth, 0]
|
||||
};
|
||||
|
||||
_cls.jcrop = $.Jcrop($popup.find('[data-jcrop] img').get(0), jcropOptions);
|
||||
|
||||
$popup.on('change', '[name=title]', (e) => { _cls.popup.values.title = e.target.value });
|
||||
$popup.on('change', '[name=description]', (e) => { _cls.popup.values.description = e.target.value });
|
||||
});
|
||||
|
||||
$popup.off('click', '[data-resolve]').on('click', '[data-resolve]', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
if (!_cls.popup.values.title) {
|
||||
$.oc.flashMsg({ text: 'Bitte einen Titel angeben.', class: 'error' });
|
||||
return;
|
||||
}
|
||||
$popup.modal('hide');
|
||||
|
||||
resolve(_cls.popup.values);
|
||||
});
|
||||
|
||||
$popup.off('hidden.bs.modal').one('hidden.bs.modal', () => {
|
||||
$popup.modal('hide');
|
||||
|
||||
reject(null);
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
popupId() {
|
||||
return `subform-popup-${this.formid}`;
|
||||
},
|
||||
popupContent() {
|
||||
return `<div class="control-popup modal fade" id="${this.popupId}">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<form>
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title">Bild konfigurieren</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div data-jcrop></div>
|
||||
<p style="margin-top: 2rem;">Füge dem Anhang einen Titel und eine Beschreibung hinzu.</p>
|
||||
<div class="form-group text-field span-full">
|
||||
<input type="text" name="title" value="" placeholder="Titel" class="form-control" autocomplete="off" maxlength="255">
|
||||
</div>
|
||||
<div class="form-group textarea-field span-full">
|
||||
<textarea name="description" class="form-control field-textarea size-tiny" placeholder="Beschreibung"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal" data-reject>Abbrechen</button>
|
||||
<button type="submit" class="btn btn-primary" data-resolve>Änderungen übernehmen</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
}
|
||||
};
|
|
@ -0,0 +1,27 @@
|
|||
let mix = require('laravel-mix');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Mix Asset Management
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Mix provides a clean, fluent API for defining some Webpack build steps
|
||||
| for your Laravel application. By default, we are compiling the Sass
|
||||
| file for your application, as well as bundling up your JS files.
|
||||
|
|
||||
*/
|
||||
|
||||
mix.config.resourceRoot = '..';
|
||||
|
||||
mix.options({
|
||||
hmrOptions: {
|
||||
host: 'dpsgkoeln.test',
|
||||
port: 8080
|
||||
}
|
||||
})
|
||||
|
||||
mix.js('src/main.js', 'js/responsiveimage.build.js')
|
||||
.postCss('css/main.css', 'css/responsiveimage.build.css', [
|
||||
require('postcss-nested')
|
||||
])
|
||||
.sourceMaps();
|
|
@ -1,39 +1,20 @@
|
|||
<?php if ($this->previewMode && !$fileList->count()): ?>
|
||||
|
||||
<span class="form-control"><?= e(trans('backend::lang.form.preview_no_files_message')) ?></span>
|
||||
|
||||
<div class="form-control">
|
||||
<?= $value ?>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
|
||||
<?php switch ($displayMode):
|
||||
|
||||
case 'image-single': ?>
|
||||
<?= $this->makePartial('image_single') ?>
|
||||
<?php break ?>
|
||||
|
||||
<?php case 'image-multi': ?>
|
||||
<?= $this->makePartial('image_multi') ?>
|
||||
<?php break ?>
|
||||
|
||||
<?php case 'file-single': ?>
|
||||
<?= $this->makePartial('file_single') ?>
|
||||
<?php break ?>
|
||||
|
||||
<?php case 'file-multi': ?>
|
||||
<?= $this->makePartial('file_multi') ?>
|
||||
<?php break ?>
|
||||
|
||||
<?php endswitch ?>
|
||||
|
||||
<!-- Error template -->
|
||||
<script type="text/template" id="<?= $this->getId('errorTemplate') ?>">
|
||||
<div class="popover-head">
|
||||
<h3><?= e(trans('backend::lang.fileupload.upload_error')) ?></h3>
|
||||
<p>{{errorMsg}}</p>
|
||||
<button type="button" class="close" data-dismiss="popover" aria-hidden="true">×</button>
|
||||
<div data-responsiveimage>
|
||||
<div>
|
||||
<app formid="<?php echo $this->getId(); ?>" name="<?= $this->getFieldName() ?>" :handlers="{
|
||||
onUpload: '<?= $this->getEventHandler('onUpload') ?>'
|
||||
}"
|
||||
:crop-options="{
|
||||
aspectRatio: <?= $this->aspectRatio ?: 'null' ?>,
|
||||
minWidth: <?= $this->minWidth ?: '0' ?>,
|
||||
}"
|
||||
mode="<?= $this->displayMode ?>"
|
||||
></app>
|
||||
</div>
|
||||
<div class="popover-body">
|
||||
<button class="btn btn-secondary" data-remove-file><?= e(trans('backend::lang.fileupload.remove_file')) ?></button>
|
||||
</div>
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<?php endif ?>
|
||||
|
|
Loading…
Reference in New Issue