Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
AURA
dashboard
Commits
843f15b2
Commit
843f15b2
authored
Aug 05, 2019
by
jackie / Andrea Ida Malkah Klaura
Browse files
FEAT: add show delete function
parent
9ceb6b4c
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/components/ShowManager.vue
View file @
843f15b2
...
...
@@ -63,7 +63,7 @@
alt=
"edit description"
@
click=
"$refs.appModalShow.showDescription()"
>
<div
v-if=
"loaded.shows"
>
<div>
<!--
we are disabling the linter warning for the next line, because, while it
generally is not advisible to use v-html, in this case we took thorough
...
...
@@ -74,6 +74,16 @@
<!-- TODO: add image and logo here? -->
</div>
</div>
<div
align=
"center"
>
<b-button
v-if=
"$parent.user.steeringUser.is_superuser"
variant=
"danger"
@
click=
"$refs.appModalSuperuser.showModalDeleteShow(shows[currentShow].id, shows[currentShow].name)"
>
Delete show
</b-button>
</div>
</b-jumbotron>
<!-- If the shows are not fully loaded yet, we just put the loading sign -->
...
...
src/components/ShowManagerModalSuperuser.vue
View file @
843f15b2
<
template
>
<div>
<!-- Modal for adding new shows -->
<b-modal
ref=
"modalAddShow"
title=
"Create a new show"
...
...
@@ -38,6 +39,24 @@
</b-row>
</b-container>
</b-modal>
<!-- Modal to confirm and delete a show -->
<b-modal
ref=
"modalDeleteShow"
title=
"Delete a show"
size=
"lg"
@
ok=
"deleteShow"
>
<b-alert
variant=
"danger"
show
>
You are about to delete the show
<b>
{{
deletedShow
.
name
}}
</b>
!
</b-alert>
<div
align=
"center"
>
Are you sure you want to continue?
</div>
</b-modal>
</div>
</
template
>
...
...
@@ -60,7 +79,11 @@ export default {
owners
:
[],
language
:
[],
topic
:
[],
musicfocus
:
[]
musicfocus
:
[],
},
deletedShow
:
{
id
:
null
,
name
:
''
,
}
}
},
...
...
@@ -80,7 +103,7 @@ export default {
}
else
{
// as the slug is a computed property we to assign it to the new show's slug variable
this
.
newShow
.
slug
=
this
.
temporarySlug
var
uri
=
process
.
env
.
VUE_APP_API_STEERING_SHOWS
let
uri
=
process
.
env
.
VUE_APP_API_STEERING_SHOWS
axios
.
post
(
uri
,
this
.
newShow
,
{
withCredentials
:
true
,
headers
:
{
'
Authorization
'
:
'
Bearer
'
+
this
.
$parent
.
$parent
.
user
.
access_token
}
...
...
@@ -96,6 +119,25 @@ export default {
})
}
},
deleteShow
(
event
)
{
// prevent the modal from closing automatically on click
event
.
preventDefault
()
let
uri
=
process
.
env
.
VUE_APP_API_STEERING_SHOWS
+
this
.
deletedShow
.
id
axios
.
delete
(
uri
,
{
withCredentials
:
true
,
headers
:
{
'
Authorization
'
:
'
Bearer
'
+
this
.
$parent
.
$parent
.
user
.
access_token
}
}).
then
(()
=>
{
this
.
$refs
.
modalDeleteShow
.
hide
()
this
.
$parent
.
loadAndSwitch
(
null
)
}).
catch
(
error
=>
{
this
.
$log
.
error
(
error
.
response
.
status
+
'
'
+
error
.
response
.
statusText
)
this
.
$log
.
error
(
error
.
response
)
alert
(
'
Error: could not delete show. See console for details.
'
)
// and we leave the modal open, so no call to its .hide function here
})
},
showModalAddShow
()
{
this
.
newShow
.
name
=
''
this
.
newShow
.
slug
=
''
...
...
@@ -103,6 +145,12 @@ export default {
// TODO:
// - load types & funding categories
this
.
$refs
.
modalAddShow
.
show
()
},
showModalDeleteShow
(
id
,
name
)
{
this
.
deletedShow
.
id
=
id
this
.
deletedShow
.
name
=
name
this
.
$refs
.
modalDeleteShow
.
show
()
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment