From f6204429e935cc0ab03226c29a8e4814dad36f66 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 11 Jun 2025 16:41:39 +0200 Subject: [PATCH] wip #7592 @1.5 --- src/app/Magic/Fields/FilesOrURL.php | 3 +- .../views/fields/filesorurl.blade.php | 85 ++++++++++++++++++- 2 files changed, 84 insertions(+), 4 deletions(-) diff --git a/src/app/Magic/Fields/FilesOrURL.php b/src/app/Magic/Fields/FilesOrURL.php index 1899d82..4db1772 100644 --- a/src/app/Magic/Fields/FilesOrURL.php +++ b/src/app/Magic/Fields/FilesOrURL.php @@ -9,10 +9,11 @@ class FilesOrURL extends Field protected $_adminType = 'filesorurl'; protected $_viewNamespace = CubistBackpackServiceProvider::NAMESPACE . '::fields'; protected $_destination = ''; + protected $_downloadbase = false; public function getDefaultAttributes() { - return array_merge(parent::getDefaultAttributes(), ['destination' => $this->_destination]); + return array_merge(parent::getDefaultAttributes(), ['destination' => $this->_destination, 'downloadbase' => $this->_downloadbase]); } protected function _postSetAttributes() diff --git a/src/resources/views/fields/filesorurl.blade.php b/src/resources/views/fields/filesorurl.blade.php index 2b6f524..54cf32c 100644 --- a/src/resources/views/fields/filesorurl.blade.php +++ b/src/resources/views/fields/filesorurl.blade.php @@ -21,7 +21,9 @@ @endpush {{-- Show the file picker on CREATE form. --}} -
+
- + @endif 'form-control freefile-text-input']) > + @if($field['downloadbase']) + + @endif
{{-- HINT --}} @@ -96,7 +103,7 @@ margin: 0; left: 0; width: 85%; - top:2px; + top: 2px; border-color: transparent; background-color: transparent; } @@ -114,6 +121,14 @@ width: calc(100% - 87px); } + .freefile-file.hasdownload .freefile-text-input:lang(en) { + width: calc(100% - 74px - 38px); + } + + .freefile-file.hasdownload .freefile-text-input:lang(fr) { + width: calc(100% - 87px - 38px); + } + .freefile-file-input:lang(en) { width: 74px; } @@ -122,6 +137,40 @@ width: 87px; } + .freefile-file-download { + position: absolute; + display: none; + top: 0; + height: 100%; + width: 38px; + cursor: pointer; + background-color: #f0f3f9; + border: 1px solid #e4e7ea; + border-right-width: 0; + color: #5c6873; + z-index: 3; + line-height: 38px; + text-align: center; + font-size: 19px; + + } + + .freefile-file.hasdownload .freefile-file-download { + display: block; + } + + .freefile-text-input:focus ~ .freefile-file-download { + border-color: #2f66b3; + } + + .freefile-file-download:lang(en) { + right: 74px; + } + + .freefile-file-download:lang(fr) { + right: 87px; + } + .freefile-text-input:focus ~ .freefile-file-label { border-color: #2f66b3; box-shadow: 0 0 0 0rem rgba(70, 127, 208, 0.25); @@ -190,6 +239,20 @@ crossorigin="anonymous" referrerpolicy="no-referrer"> @endpush -- 2.39.5