Enable image upload field when no name provided. Use image name as default value. (#1083)

This commit is contained in:
Brooklin Myers 2022-04-01 16:19:17 -07:00 committed by GitHub
parent 32aeec2cc5
commit 00c913adcc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -56,7 +56,7 @@ defmodule LivebookWeb.SessionLive.CellUploadComponent do
<%= live_patch "Cancel", to: @return_to, class: "button-base button-outlined-gray" %>
<button class="button-base button-blue"
type="submit"
disabled={@uploads.cell_image.entries == [] or @name == ""}>
disabled={@uploads.cell_image.entries == []}>
Upload
</button>
</div>
@ -79,7 +79,7 @@ defmodule LivebookWeb.SessionLive.CellUploadComponent do
path = Path.expand(path)
upload_file = FileSystem.File.local(path)
ext = Path.extname(entry.client_name)
filename = name <> ext
filename = if name == "", do: entry.client_name, else: name <> ext
destination_file = FileSystem.File.resolve(images_dir, filename)
result =