Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🛠️ [v2.0] : Fixed Issue #1742 #1900

Merged
merged 4 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Storage;
use Illuminate\View\View;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Webkul\Admin\DataGrids\Settings\AttributeDataGrid;
use Webkul\Admin\Http\Controllers\Controller;
use Webkul\Admin\Http\Requests\MassDestroyRequest;
Expand Down Expand Up @@ -189,8 +188,12 @@ public function massDestroy(MassDestroyRequest $massDestroyRequest): JsonRespons
/**
* Download image or file
*/
public function download(): StreamedResponse
public function download()
{
if (! request('path')) {
return false;
}

return Storage::download(request('path'));
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<x-admin::form.control-group.controls.inline.file
::name="'{{ $attribute->code }}'"
::value="'{{ route('admin.settings.attributes.download', ['path' => $value]) }}'"
::value="'{{ $value ? route('admin.settings.attributes.download', ['path' => $value]) : '' }}'"
rules="required|mimes:jpeg,jpg,png,gif"
position="left"
:label="$attribute->name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<!-- Non-editing view -->
<div
v-if="! isEditing"
class="flex h-[34px] items-center rounded border border-transparent transition-all"
class="flex h-[34px] items-center justify-between rounded border border-transparent transition-all"
:class="allowEdit ? 'hover:bg-gray-100 dark:hover:bg-gray-800' : ''"
>
<x-admin::form.control-group.control
Expand All @@ -34,11 +34,18 @@ class="flex h-[34px] items-center rounded border border-transparent transition-a

<a
:href="inputValue"
v-if="inputValue"
target="_blank"
>
<span class="icon-down-arrow pl-[2px] text-2xl font-normal"></span>
<span class="icon-download pl-[2px] text-2xl font-normal"></span>
</a>

<span
v-else
class="icon-download cursor-pointer pl-[2px] text-2xl font-normal"
>
</span>

<template v-if="allowEdit">
<i
@click="toggle"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

<x-admin::form
:action="route('admin.products.update', $product->id)"
encType="multipart/form-data"
method="PUT"
>
<div class="flex flex-col gap-4">
Expand Down
Loading