Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
image-board-svelte
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Trirst
image-board-svelte
Commits
484f8cdb
Commit
484f8cdb
authored
Oct 22, 2021
by
Trirst
Browse files
Options
Downloads
Patches
Plain Diff
Better hot updating after editing image metadata
parent
cba5e7ba
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/routes/ImagePost.svelte
+11
-17
11 additions, 17 deletions
src/routes/ImagePost.svelte
with
11 additions
and
17 deletions
src/routes/ImagePost.svelte
+
11
−
17
View file @
484f8cdb
...
@@ -2,18 +2,19 @@
...
@@ -2,18 +2,19 @@
import
{
fetchAPI
}
from
"
@/static/js/helper
"
;
import
{
fetchAPI
}
from
"
@/static/js/helper
"
;
import
{
paths
}
from
"
@/static/js/paths
"
;
import
{
paths
}
from
"
@/static/js/paths
"
;
import
{
user
}
from
"
@/stores
"
;
import
{
user
}
from
"
@/stores
"
;
import
{
onMount
}
from
"
svelte
"
;
export
let
params
=
{};
export
let
params
=
{};
let
imageMetadata
=
{};
let
imageMetadata
=
{};
let
addTag
=
false
;
let
addTag
=
false
;
let
tag
=
""
;
let
tag
=
""
;
let
originalComment
;
let
form
;
let
form
;
let
edit
=
false
;
let
edit
=
false
;
async
function
getImageMetadata
()
{
$
:
getImageMetadata
(
params
.
snowflake
);
return
await
fetchAPI
(
paths
.
ImageField
(
params
.
snowflake
));
$
:
originalComment
=
imageMetadata
.
commentary
?
true
:
false
;
async
function
getImageMetadata
(
snowflake
)
{
imageMetadata
=
await
fetchAPI
(
paths
.
ImageField
(
snowflake
));
}
}
function
imageTagAdd
()
{
function
imageTagAdd
()
{
const
options
=
{
const
options
=
{
...
@@ -39,11 +40,6 @@
...
@@ -39,11 +40,6 @@
};
};
return
fetchAPI
(
paths
.
ImageField
(
snowflake
),
options
);
return
fetchAPI
(
paths
.
ImageField
(
snowflake
),
options
);
}
}
onMount
(
async
()
=>
{
imageMetadata
=
await
getImageMetadata
();
originalComment
=
imageMetadata
.
commentary
?
true
:
false
;
});
</script>
</script>
<svelte:head>
<svelte:head>
...
@@ -108,14 +104,14 @@
...
@@ -108,14 +104,14 @@
placeholder=
"Source"
placeholder=
"Source"
name=
"source"
name=
"source"
autocomplete=
"off"
autocomplete=
"off"
bind:
value=
{
imageMetadata
.
source
}
value=
{
imageMetadata
.
source
}
/>
/>
<input
<input
type=
"text"
type=
"text"
placeholder=
"Parent"
placeholder=
"Parent"
name=
"parent"
name=
"parent"
autocomplete=
"off"
autocomplete=
"off"
bind:
value=
{
imageMetadata
.
parent
}
value=
{
imageMetadata
.
parent
}
/>
/>
<textarea
<textarea
type=
"text"
type=
"text"
...
@@ -123,7 +119,7 @@
...
@@ -123,7 +119,7 @@
name=
"commentary"
name=
"commentary"
autocomplete=
"off"
autocomplete=
"off"
class=
"max-h-full resize-none flex-1"
class=
"max-h-full resize-none flex-1"
bind:
value=
{
imageMetadata
.
commentary
}
value=
{
imageMetadata
.
commentary
}
/>
/>
<textarea
<textarea
type=
"text"
type=
"text"
...
@@ -131,14 +127,12 @@
...
@@ -131,14 +127,12 @@
name=
"commentary_translation"
name=
"commentary_translation"
autocomplete=
"off"
autocomplete=
"off"
class=
"max-h-full resize-none flex-1"
class=
"max-h-full resize-none flex-1"
bind:
value=
{
imageMetadata
.
commentary_translation
}
value=
{
imageMetadata
.
commentary_translation
}
/>
/>
<button
<button
on:click
|
preventDefault=
{
()
=>
{
on:click
|
preventDefault=
{
()
=>
{
updateImageMetadata
(
updateImageMetadata
(
params
.
snowflake
,
serializeForm
(
form
));
imageMetadata
.
snowflake
,
getImageMetadata
(
params
.
snowflake
);
serializeForm
(
form
)
);
edit
=
false
;
edit
=
false
;
}
}
>
Submit
</button
}
}
>
Submit
</button
>
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment