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
78226917
Commit
78226917
authored
Aug 06, 2019
by
jackie / Andrea Ida Malkah Klaura
Browse files
FIX: check for valid type & category in add show modal
parent
46dfc62d
Changes
1
Show whitespace changes
Inline
Side-by-side
src/components/ShowManagerModalSuperuser.vue
View file @
78226917
...
...
@@ -165,16 +165,37 @@ export default {
},
methods
:
{
// create a new show and POST it to the steering API
// new shows have to at least contain a name, a slug and a short-description.
// also a valide show type and funding category have to be choosen.
// for all other categories we can use an empty array and let the user fill
// it out through the existing show manager modals, after the show is created
addShow
(
event
)
{
// prevent the modal from closing automatically on click
event
.
preventDefault
()
// only try to add a new show if name and short description are filled out
if
(
this
.
newShow
.
name
.
trim
()
===
''
||
this
.
newShow
.
short_description
.
trim
()
===
''
)
{
// TODO: make this nicer UI-wise (red text annotations next to input fields instead of simple alert)
alert
(
'
Please provide at least a title and a short description for this show.
'
)
}
else
{
// as the slug is a computed property we to assign it to the new show's slug variable
return
}
// also the type and funding category have to be set
if
(
this
.
types
.
findIndex
(
type
=>
type
.
id
===
this
.
newShow
.
type
)
===
-
1
)
{
// TODO: make this nicer UI-wise (red text annotations next to input fields instead of simple alert)
alert
(
'
Please choose a type for this show.
'
)
return
}
if
(
this
.
fundingcategories
.
findIndex
(
cat
=>
cat
.
id
===
this
.
newShow
.
fundingcategory
)
===
-
1
)
{
// TODO: make this nicer UI-wise (red text annotations next to input fields instead of simple alert)
alert
(
'
Please choose a funding category for this show.
'
)
return
}
// as the slug is a computed property we have to assign it to the new show's slug property
this
.
newShow
.
slug
=
this
.
temporarySlug
// ready to go, let's POST this new show
let
uri
=
process
.
env
.
VUE_APP_API_STEERING_SHOWS
axios
.
post
(
uri
,
this
.
newShow
,
{
withCredentials
:
true
,
...
...
@@ -189,9 +210,9 @@ export default {
alert
(
'
Error: could not add new show. See console for details.
'
)
// and we leave the modal open, so no call to its .hide function here
})
}
},
// delete a show by sending a DELETE to the steering API
deleteShow
(
event
)
{
// prevent the modal from closing automatically on click
event
.
preventDefault
()
...
...
Write
Preview
Supports
Markdown
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