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
8a106bc1
Commit
8a106bc1
authored
Oct 28, 2021
by
Trirst
Browse files
Options
Downloads
Patches
Plain Diff
Delete action
parent
7f32d45d
No related branches found
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
+25
-0
25 additions, 0 deletions
src/routes/ImagePost.svelte
with
25 additions
and
0 deletions
src/routes/ImagePost.svelte
+
25
−
0
View file @
8a106bc1
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
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
{
push
}
from
"
svelte-spa-router
"
;
export
let
params
=
{};
export
let
params
=
{};
let
imageMetadata
=
{};
let
imageMetadata
=
{};
...
@@ -51,6 +52,18 @@
...
@@ -51,6 +52,18 @@
};
};
fetchAPI
(
paths
.
ImageField
(
snowflake
),
options
);
fetchAPI
(
paths
.
ImageField
(
snowflake
),
options
);
}
}
// Delete the image then reroute back to /browse?p=1
// I don't know why the fuck this works but just leave it here
async
function
deleteImage
(
snowflake
)
{
if
(
confirm
(
"
Delete image?
"
))
{
const
options
=
{
method
:
"
DELETE
"
,
headers
:
{
secret
:
$user
.
secret
},
};
fetchAPI
(
paths
.
ImageField
(
snowflake
),
options
);
push
(
"
#/browse?p=1
"
);
}
}
</script>
</script>
<svelte:head>
<svelte:head>
...
@@ -58,6 +71,7 @@
...
@@ -58,6 +71,7 @@
</svelte:head>
</svelte:head>
<div
class=
"flex flex-row space-x-12"
>
<div
class=
"flex flex-row space-x-12"
>
<!-- Image metatadata side -->
<div
class=
"pl-2"
>
<div
class=
"pl-2"
>
<ul>
<ul>
<li><strong>
Snowflake:
</strong>
{
imageMetadata
.
snowflake
}
</li>
<li><strong>
Snowflake:
</strong>
{
imageMetadata
.
snowflake
}
</li>
...
@@ -68,6 +82,7 @@
...
@@ -68,6 +82,7 @@
<li><strong>
Image type:
</strong>
{
imageMetadata
.
type
}
</li>
<li><strong>
Image type:
</strong>
{
imageMetadata
.
type
}
</li>
<li><strong>
Uploaded by:
</strong>
{
imageMetadata
.
user
}
</li>
<li><strong>
Uploaded by:
</strong>
{
imageMetadata
.
user
}
</li>
</ul>
</ul>
<!-- Actions -->
<div><button
on:click=
{
()
=>
(
edit
=
!
edit
)
}
>
Edit
</button></div>
<div><button
on:click=
{
()
=>
(
edit
=
!
edit
)
}
>
Edit
</button></div>
<div><button
on:click=
{
()
=>
(
addTag
=
!
addTag
)
}
>
Add tag
</button></div>
<div><button
on:click=
{
()
=>
(
addTag
=
!
addTag
)
}
>
Add tag
</button></div>
{
#if
addTag
}
{
#if
addTag
}
...
@@ -76,7 +91,16 @@
...
@@ -76,7 +91,16 @@
<button
on:click=
{
imageTagAdd
}
>
Add
</button>
<button
on:click=
{
imageTagAdd
}
>
Add
</button>
</div>
</div>
{
/if
}
{
/if
}
<div>
<button
on:click=
{
()
=>
{
deleteImage
(
params
.
snowflake
);
}
}
>
Delete
</button
>
</div>
</div>
</div>
<!-- Image side -->
<!-- Image family -->
<div
class=
"w-full"
>
<div
class=
"w-full"
>
<div
class=
"flex flex-row flex-wrap m-4"
>
<div
class=
"flex flex-row flex-wrap m-4"
>
{
#each
imageFamily
as
snowflake
}
{
#each
imageFamily
as
snowflake
}
...
@@ -90,6 +114,7 @@
...
@@ -90,6 +114,7 @@
{
/each
}
{
/each
}
</div>
</div>
<img
src=
{
paths
.
ImageFile
(
params
.
snowflake
)
}
alt=
""
class=
"max-w-2xl"
/>
<img
src=
{
paths
.
ImageFile
(
params
.
snowflake
)
}
alt=
""
class=
"max-w-2xl"
/>
<!-- Commentary -->
{
#if
imageMetadata
.
commentary
||
imageMetadata
.
commentary_translation
}
{
#if
imageMetadata
.
commentary
||
imageMetadata
.
commentary_translation
}
<div
class=
"bg-gray-200 p-4 m-4"
>
<div
class=
"bg-gray-200 p-4 m-4"
>
<div><strong>
Artist's commentary
</strong></div>
<div><strong>
Artist's commentary
</strong></div>
...
...
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