Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dashboard
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
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AURA
dashboard
Commits
b335d801
Commit
b335d801
authored
2 years ago
by
Konrad Mohrfeldt
Browse files
Options
Downloads
Patches
Plain Diff
feat: use new image picker for show image and logo
refs
#89
parent
e0fd0a76
No related branches found
No related tags found
No related merge requests found
Pipeline
#3099
failed
2 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/shows/MetaImages.vue
+35
-179
35 additions, 179 deletions
src/components/shows/MetaImages.vue
with
35 additions
and
179 deletions
src/components/shows/MetaImages.vue
+
35
−
179
View file @
b335d801
<
template
>
<
template
>
<div>
<div
class=
"tw-flex tw-gap-6"
>
<b-row>
<div>
<b-col
lg=
"2"
>
<label
id=
"show-logo"
class=
"tw-block tw-font-bold"
>
{{
t
(
'
showMeta.logo
'
)
}}
</label>
<b-badge
class=
"tw-w-10/12 tw-mr-1"
>
{{
$t
(
'
showMeta.logo
'
)
}}
:
</b-badge>
<ImagePicker
v-model=
"logoId"
aria-labelledby=
"show-logo"
/>
<img
</div>
src=
"/assets/edit.svg"
class=
"tw-w-4 tw-cursor-pointer"
<div>
:alt=
"$t('showMeta.editLogo')"
<label
id=
"show-image"
class=
"tw-block tw-font-bold"
>
{{
t
(
'
showMeta.image
'
)
}}
</label>
@
click=
"openModalLogo()"
<ImagePicker
v-model=
"imageId"
aria-labelledby=
"show-image"
/>
/>
</div>
</b-col>
<b-col
lg=
"4"
>
<div
v-if=
"!selectedShow.image || selectedShow.logo.length === 0"
>
<small
><i>
{{
$t
(
'
noneSetNeuter
'
)
}}
</i></small
>
</div>
<div
v-else
>
<br
/>
<b-img
thumbnail
:src=
"selectedShow.logo"
fluid
@
click=
"openModalLogo()"
/>
</div>
</b-col>
<b-col
lg=
"2"
>
<b-badge
class=
"tw-w-10/12 tw-mr-1"
>
{{
$t
(
'
showMeta.image
'
)
}}
:
</b-badge>
<img
src=
"/assets/edit.svg"
class=
"tw-w-4 tw-cursor-pointer"
:alt=
"$t('showMeta.editImage')"
@
click=
"openModalImage()"
/>
</b-col>
<b-col
lg=
"4"
>
<div
v-if=
"!selectedShow.image || selectedShow.image.length === 0"
>
<small
><i>
{{
$t
(
'
noneSetNeuter
'
)
}}
</i></small
>
</div>
<div
v-else
>
<br
/>
<b-img
thumbnail
:src=
"selectedShow.image"
fluid
@
click=
"openModalImage()"
/>
</div>
</b-col>
</b-row>
<b-modal
ref=
"modalLogo"
:title=
"$t('showMeta.editLogo')"
:cancel-title=
"$t('cancel')"
size=
"lg"
@
ok=
"saveLogo"
>
<b-row>
<b-col
lg=
"4"
>
<p>
{{
$t
(
'
showMeta.currentLogo
'
)
}}
:
</p>
</b-col>
<b-col
lg=
"8"
>
<p
v-if=
"string.length === 0"
>
<small
><i>
{{
$t
(
'
noneSetNeuter
'
)
}}
</i></small
>
</p>
<p
v-else
>
<b-img
thumbnail
fluid
:src=
"string"
/>
</p>
</b-col>
</b-row>
<b-row>
<b-col>
<b-form-file
ref=
"fileinputLogo"
v-model=
"file"
accept=
"image/jpeg, image/png"
:state=
"Boolean(file)"
:placeholder=
"$t('showMeta.chooseLogo')"
:browse-text=
"$t('browse')"
/>
</b-col>
</b-row>
</b-modal>
<b-modal
ref=
"modalImage"
:title=
"$t('showMeta.editImage')"
:cancel-title=
"$t('cancel')"
size=
"lg"
@
ok=
"saveImage"
>
<b-row>
<b-col
lg=
"4"
>
<p>
{{
$t
(
'
showMeta.currentImage
'
)
}}
:
</p>
</b-col>
<b-col
lg=
"8"
>
<p
v-if=
"string.length === 0"
>
<small
><i>
{{
$t
(
'
noneSetNeuter
'
)
}}
</i></small
>
</p>
<p
v-else
>
<b-img
thumbnail
fluid
:src=
"string"
/>
</p>
</b-col>
</b-row>
<b-row>
<b-col>
<b-form-file
ref=
"fileinputImage"
v-model=
"file"
accept=
"image/jpeg, image/png"
:state=
"Boolean(file)"
:browse-text=
"$t('browse')"
:placeholder=
"$t('showMeta.chooseImage')"
/>
</b-col>
</b-row>
</b-modal>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
lang=
"ts"
setup
>
import
{
mapGetters
}
from
'
vuex
'
import
{
computed
}
from
'
vue
'
import
{
useStore
}
from
'
vuex
'
export
default
{
import
{
useI18n
}
from
'
@/i18n
'
data
()
{
import
{
useSelectedShow
}
from
'
@/utilities
'
return
{
import
{
useUpdatableState
}
from
'
@/util
'
string
:
''
,
import
ImagePicker
from
'
@/components/images/ImagePicker.vue
'
file
:
null
,
}
const
store
=
useStore
()
},
const
{
t
}
=
useI18n
()
computed
:
{
const
selectedShow
=
useSelectedShow
()
...
mapGetters
({
const
logoId
=
useUpdatableState
(
selectedShow
:
'
shows/selectedShow
'
,
computed
(()
=>
null
),
}),
(
imageId
)
=>
updateImage
(
'
logo
'
,
imageId
),
},
)
methods
:
{
const
imageId
=
useUpdatableState
(
openModalLogo
()
{
computed
(()
=>
selectedShow
.
value
.
image
),
if
(
this
.
selectedShow
.
logo
===
null
)
{
(
imageId
)
=>
updateImage
(
'
image
'
,
imageId
),
this
.
string
=
''
)
}
else
{
async
function
updateImage
(
property
:
'
logo
'
|
'
image
'
,
imageId
:
number
|
null
)
{
this
.
string
=
this
.
selectedShow
.
logo
await
store
.
dispatch
(
'
shows/updateProperty
'
,
{
}
id
:
selectedShow
.
value
.
id
,
this
.
file
=
null
property
,
this
.
$refs
.
modalLogo
.
show
()
value
:
imageId
,
},
})
openModalImage
()
{
if
(
this
.
selectedShow
.
image
===
null
)
{
this
.
string
=
''
}
else
{
this
.
string
=
this
.
selectedShow
.
image
}
this
.
file
=
null
this
.
$refs
.
modalImage
.
show
()
},
updateImage
(
type
,
modal
,
event
)
{
event
.
preventDefault
()
if
(
this
.
file
===
null
)
{
alert
(
'
Please provide a file to upload
'
)
}
else
if
(
this
.
file
.
type
!==
'
image/jpeg
'
&&
this
.
file
.
type
!==
'
image/png
'
)
{
alert
(
'
Please provide a valid image file (JPEG or PNG)
'
)
}
else
{
this
.
$store
.
dispatch
(
'
shows/updateImage
'
,
{
id
:
this
.
selectedShow
.
id
,
type
:
type
,
file
:
this
.
file
,
callback
:
(
response
)
=>
{
this
.
$log
.
debug
(
'
updateImage callback
'
)
this
.
$log
.
debug
(
response
)
modal
.
hide
()
},
})
}
},
saveImage
(
event
)
{
this
.
updateImage
(
'
image
'
,
this
.
$refs
.
modalImage
,
event
)
},
saveLogo
(
event
)
{
this
.
updateImage
(
'
logo
'
,
this
.
$refs
.
modalLogo
,
event
)
},
},
}
}
</
script
>
</
script
>
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