From 7f7b95e184e41da8177920261ff0580777f6bea2 Mon Sep 17 00:00:00 2001 From: amercader Date: Fri, 3 Mar 2023 11:03:19 +0100 Subject: [PATCH] Align UI with CKAN core Copy the form elements from upstream CKAN. We use the form fields in CKAN 2.10, which were refactored to simplify them and drop the infamous image-upload.js module in ckan/ckan#6227. The markup is clearly separated in three blocks: 1. Upload/Link buttons 2. File input + Remove button 3. URL input + Remove button The style classes have been prefixed to avoid clashes with the other `image-upload` field we have in the form (the schema one, which will eventually be replaced): `.resource-upload-field` -> `.ckan-resource-upload-field` `.btn-remove-url` -> `.btn-remove-url-upload` TODO: * Remove inline JS * Autopopulate name * Hook into upload logic --- src/lib/CkanUploader.svelte | 191 ++++++++++++++++++------------------ 1 file changed, 94 insertions(+), 97 deletions(-) diff --git a/src/lib/CkanUploader.svelte b/src/lib/CkanUploader.svelte index de74411..cb58b07 100644 --- a/src/lib/CkanUploader.svelte +++ b/src/lib/CkanUploader.svelte @@ -109,122 +109,119 @@ } } -
- { changeResourceType('upload') }}> - File - - { changeResourceType('') }}> - Link - - {#if resource_type == 'upload'} -
-
- {#if !is_uploading && !is_waiting && !is_completed} - {#if update} - Select a file to replace the current one - {:else} - Select a file to upload - {/if} - {:else } -
-
- {#if !is_waiting } - {#if !is_completed} - {percentage}% - {/if} - {:else} - Waiting for data schema detection... - {/if} - {#if is_completed } - File uploaded - {/if} -
-
-
-
- {/if} + +
+ + + +
+ +
+ +
-
- {/if} - - {#if resource_type == 'upload'} - {#if current_file_url != ''} -
- -
- + + + + +
+
+ + +
+ +
+ +
+
+
- {/if} - {:else} - {#if resource_type != 'None'} -
- -
- - + + + + +
+ + + +
+ +
+ +
- {/if} - {/if} +
+