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
b5a64b84
Commit
b5a64b84
authored
Feb 15, 2018
by
Andrea Ida Malkah Klaura
Browse files
added save function to show modals - still debugging
parent
a2983a53
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/components/ShowManager.vue
View file @
b5a64b84
...
...
@@ -13,20 +13,22 @@
<template
slot=
"header"
>
<span
v-if=
"loaded.shows"
>
{{
shows
[
currentShow
].
name
}}
<img
src=
"../assets/16x16/emblem-system.png"
alt=
"edit name of show"
v-on:click=
"$refs.appModalShow.
$refs.modalS
howName
.show
()"
/>
<img
src=
"../assets/16x16/emblem-system.png"
alt=
"edit name of show"
v-on:click=
"$refs.appModalShow.
s
howName()"
/>
</span>
<span
v-else
>
Shows are being loaded
</span>
</
template
>
<
template
slot=
"lead"
>
<span
v-if=
"loaded.shows"
>
{{
shows
[
currentShow
].
short_description
}}
</span>
<img
src=
"../assets/16x16/emblem-system.png"
alt=
"edit short description"
v-on:click=
"$refs.appModalShow.
$refs.modalS
howShortDescription
.show
()"
/>
<img
src=
"../assets/16x16/emblem-system.png"
alt=
"edit short description"
v-on:click=
"$refs.appModalShow.
s
howShortDescription()"
/>
</
template
>
<p
v-if=
"loaded.shows"
>
<b>
Description:
</b>
<img
src=
"../assets/16x16/emblem-system.png"
alt=
"edit description"
v-on:click=
"$refs.appModalShow.
$refs.modalS
howDescription
.show
()"
/>
<b>
Description:
</b>
<img
src=
"../assets/16x16/emblem-system.png"
alt=
"edit description"
v-on:click=
"$refs.appModalShow.
s
howDescription()"
/>
<div
v-if=
"loaded.shows"
>
<!-- TODO: see if we can make a nice but secure html rendering of the description -->
<!--{{ shows[currentShow].description.replace(/<[^>]*>/g, '') }}-->
{{ shows[currentShow].description }}
<!-- TODO: see if we can make a nice but secure html rendering of the description
This should be already secure, as long as you do not write directly to the DOM.
Only if you do this and render HTML, take care to have it save (no script tags etc.).
This current regex replace is only to have it looking nicely, in case there are html tags. -->
{{ shows[currentShow].description.replace(/
<
[^
>
]*>/g, '') }}
<!-- TODO: add image and logo here? -->
</div>
</p>
...
...
src/components/ShowManagerModalShow.vue
View file @
b5a64b84
<
template
>
<div>
<b-modal
ref=
"modalShowName"
title=
"Name of the show"
size=
"lg"
>
<b-form-input
v-model=
"s
how.name
"
type=
"text"
placeholder=
"Enter name of the show"
></b-form-input>
<b-modal
ref=
"modalShowName"
title=
"Name of the show"
size=
"lg"
@
ok=
"saveName"
>
<b-form-input
v-model=
"s
tring
"
type=
"text"
placeholder=
"Enter name of the show"
></b-form-input>
</b-modal>
<b-modal
ref=
"modalShowShortDescription"
title=
"Short description"
size=
"lg"
>
<b-form-textarea
v-model=
"s
how.short_description
"
:rows=
"2"
placeholder=
"Enter a short description"
></b-form-textarea>
<b-form-textarea
v-model=
"s
tring
"
:rows=
"2"
placeholder=
"Enter a short description"
></b-form-textarea>
</b-modal>
<b-modal
ref=
"modalShowDescription"
title=
"Full description"
size=
"lg"
>
<b-form-textarea
v-model=
"s
how.description
"
:rows=
"2"
placeholder=
"Enter the full description of this show"
></b-form-textarea>
<b-form-textarea
v-model=
"s
tring
"
:rows=
"2"
placeholder=
"Enter the full description of this show"
></b-form-textarea>
</b-modal>
</div>
</
template
>
<
script
>
// import axios from 'axios'
import
axios
from
'
axios
'
function
debugErrorResponse
(
data
)
{
console
.
log
(
'
Response date provided to transformResponse:
'
)
console
.
log
(
data
)
return
data
}
export
default
{
props
:
{
...
...
@@ -24,11 +30,58 @@ export default {
},
data
()
{
return
{
string
:
''
,
backupstring
:
''
,
id
:
0
,
backupid
:
0
,
array
:
[],
backuparray
:
[]
}
},
methods
:
{
save
:
function
()
{
save
()
{
var
retval
=
false
console
.
log
(
'
trying to save show
'
)
console
.
log
(
process
.
env
.
API_STEERING_SHOWS
+
this
.
show
.
id
+
'
/
'
)
console
.
log
(
this
.
show
)
axios
.
put
(
process
.
env
.
API_STEERING_SHOWS
+
this
.
show
.
id
+
'
/
'
,
this
.
show
,
{
withCredentials
:
true
,
transformResponse
:
[
debugErrorResponse
]
}).
then
(
response
=>
{
console
.
log
(
'
Response:
'
)
console
.
log
(
response
)
retval
=
true
}).
catch
(
error
=>
{
console
.
log
(
'
Error:
'
)
console
.
log
(
error
)
// alert('There was an error fetching shows from the server: ' + error)
retval
=
false
})
return
retval
},
saveName
(
event
)
{
event
.
preventDefault
()
this
.
backupstring
=
this
.
show
.
name
this
.
show
.
name
=
this
.
string
var
retval
=
this
.
save
()
if
(
retval
===
false
)
{
this
.
show
.
name
=
this
.
backupstring
alert
(
'
Error: could not save the new show information
'
)
}
else
{
this
.
$refs
.
modalShowName
.
hide
()
}
},
showName
()
{
this
.
string
=
this
.
show
.
name
this
.
$refs
.
modalShowName
.
show
()
},
showShortDescription
()
{
this
.
string
=
this
.
show
.
short_description
this
.
$refs
.
modalShowShortDescription
.
show
()
},
showDescription
()
{
this
.
string
=
this
.
show
.
description
this
.
$refs
.
modalShowDescription
.
show
()
}
}
}
...
...
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