better file password implementation

This commit is contained in:
2024-04-25 18:40:40 +10:00
parent c702253837
commit 39609edc9e
6 changed files with 19 additions and 5 deletions

View File

@@ -25,7 +25,7 @@
<x-slot:body>
@foreach ($media as $medium)
<tr>
<td><img src="{{ $medium->thumbnail }}" class="max-h-12 max-w-12 -ml-2 -my-3 mr-3 inline rounded" alt="{{ $medium->title }}" />{{ $medium->title }}</td>
<td><img src="{{ $medium->thumbnail }}" class="max-h-12 max-w-12 -ml-2 -my-3 mr-3 inline rounded" alt="{{ $medium->title }}" />{{ $medium->title }}{!! $medium->password !== null ? '<i class="fa-solid fa-lock text-xs text-gray-400 ml-0.5 -translate-y-1.5 scale-75"></i>': '' !!}</td>
<td>{{ \App\Helpers::bytesToString($medium->size) }}</td>
<td>{{ $medium->mime_type }}</td>
<td>{{ \Carbon\Carbon::parse($medium->created_at)->format('M j Y, g:i a') }}</td>

View File

@@ -12,9 +12,12 @@
<h3 class="text-xl font-semibold">{{ $label }}</h3>
<ul x-show="$store.files.length > 0" class="flex flex-col bg-white p-4 border border-gray-300 rounded-lg gap-4 mt-2">
<template x-for="file in $store.files" :key="file.name">
<li class="flex items-center">
<li class="flex items-center">
<img class="w-10 mr-2" :src="file.thumbnail" />
<a class="flex-grow link" :href="file.url" x-text="file.title" target="_blank"></a>
<div class="flex-grow">
<a class="link" :href="file.url" x-text="file.title" target="_blank"></a>
<i x-show="file.password" x-cloak class="fa-solid fa-lock text-xs text-gray-400 -translate-x-0.5 -translate-y-1.5 scale-75"></i>
</div>
<a class="cursor-pointer text-gray-400 w-7 text-center hover:text-primary-color" :href="file.url + '?download=1'"><i class="fa-solid fa-download"></i></a>
@if($editor)
<i class="text-gray-400 w-7 text-center fa-solid fa-trash hover:text-red-500 cursor-pointer" x-on:click.prevent="removeFile(file.name)"></i>