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
a290e85d
Commit
a290e85d
authored
Jun 11, 2020
by
jackie / Andrea Ida Malkah Klaura
Browse files
add button to add shows to show selector component and sort show array after adding new show
parent
6feb5948
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/components/ShowSelector.vue
View file @
a290e85d
...
...
@@ -54,6 +54,19 @@
{{
show
.
name
}}
</b-dropdown-item>
</b-dropdown>
<b-button
v-if=
"isSuperuser"
v-b-popover.hover.top=
"'Add a new show'"
variant=
"info"
@
click=
"$refs.addShowModal.openModal()"
>
+
</b-button>
<addShowModal
ref=
"addShowModal"
:callback=
"newShowAdded"
/>
</b-col>
</b-row>
</
template
>
...
...
@@ -61,11 +74,13 @@
<
script
>
import
{
mapGetters
}
from
'
vuex
'
import
{
BIconCheck
,
BIconX
}
from
'
bootstrap-vue
'
import
modalAddShow
from
'
./shows/AddShowModal.vue
'
export
default
{
components
:
{
BIconCheck
,
BIconX
,
'
addShowModal
'
:
modalAddShow
,
},
props
:
{
...
...
@@ -80,19 +95,17 @@ export default {
},
computed
:
{
isSuperuser
()
{
return
this
.
$store
.
state
.
auth
.
user
.
steeringUser
.
is_superuser
},
loaded
()
{
return
{
shows
:
this
.
$store
.
state
.
shows
.
loaded
.
shows
,
types
:
this
.
$store
.
state
.
shows
.
loaded
.
types
,
fundingcategories
:
this
.
$store
.
state
.
shows
.
loaded
.
fundingcategories
,
}
},
disabledOk
()
{
return
!
this
.
isValidSelector
()
},
disabledReset
()
{
return
this
.
inputSelector
.
length
>
0
?
false
:
true
},
disabledOk
()
{
return
!
this
.
isValidSelector
()
},
disabledReset
()
{
return
this
.
inputSelector
.
length
>
0
?
false
:
true
},
...
mapGetters
({
shows
:
'
shows/shows
'
,
...
...
@@ -100,6 +113,15 @@ export default {
})
},
created
()
{
if
(
!
this
.
loaded
.
types
)
{
this
.
$store
.
dispatch
(
'
shows/fetchMetaArray
'
,
{
property
:
'
types
'
,
onlyActive
:
true
})
}
if
(
!
this
.
loaded
.
fundingcategories
)
{
this
.
$store
.
dispatch
(
'
shows/fetchMetaArray
'
,
{
property
:
'
fundingcategories
'
,
onlyActive
:
true
})
}
},
methods
:
{
switchShow
:
function
(
index
)
{
this
.
$store
.
commit
(
'
shows/switchShow
'
,
index
)
...
...
@@ -107,6 +129,11 @@ export default {
if
(
this
.
callback
)
{
this
.
callback
()
}
},
newShowAdded
()
{
this
.
updateInputSelector
()
if
(
this
.
callback
)
{
this
.
callback
()
}
},
updateInputSelector
()
{
this
.
inputSelector
=
this
.
selectedShow
.
name
+
'
(ID:
'
+
this
.
selectedShow
.
id
+
'
)
'
},
...
...
src/components/shows/AddShowModal.vue
View file @
a290e85d
...
...
@@ -90,6 +90,9 @@ import { mapGetters } from 'vuex'
export
default
{
mixins
:
[
slugify
],
props
:
{
callback
:
{
type
:
Function
,
default
:
null
}
},
data
()
{
return
{
newShow
:
{
...
...
@@ -178,8 +181,10 @@ export default {
let
modal
=
this
.
$refs
.
modalAddShow
this
.
$store
.
dispatch
(
'
shows/submitShow
'
,
{
show
:
this
.
newShow
,
callback
:
()
=>
{
callback
:
(
response
)
=>
{
modal
.
hide
()
this
.
$store
.
commit
(
'
shows/switchShowById
'
,
response
.
data
.
id
)
if
(
this
.
callback
)
{
this
.
callback
()
}
}
})
},
...
...
src/store/modules/shows.js
View file @
a290e85d
...
...
@@ -94,7 +94,10 @@ const mutations = {
finishLoading
(
state
,
item
)
{
state
.
loaded
[
item
]
=
true
},
setShows
(
state
,
shows
)
{
state
.
shows
=
shows
},
addShow
(
state
,
show
)
{
state
.
shows
.
push
(
show
)
},
addShow
(
state
,
show
)
{
state
.
shows
.
push
(
show
)
state
.
shows
.
sort
((
a
,
b
)
=>
a
.
name
.
toLowerCase
()
>
b
.
name
.
toLowerCase
())
},
setSchedule
(
state
,
schedule
)
{
state
.
schedule
=
schedule
},
setScheduleTimeslots
(
state
,
slots
)
{
state
.
scheduleTimeslots
=
slots
},
...
...
@@ -140,7 +143,13 @@ const mutations = {
state
.
selected
.
index
=
index
state
.
selected
.
id
=
state
.
shows
[
index
].
id
}
}
},
switchShowById
(
state
,
id
)
{
if
(
state
.
loaded
.
shows
)
{
state
.
selected
.
index
=
state
.
shows
.
findIndex
(
s
=>
s
.
id
===
id
)
state
.
selected
.
id
=
id
}
},
}
const
actions
=
{
...
...
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