Messgaes from Lyrebird can be overriden with uploaded file

This commit is contained in:
Ruben van de Ven 2019-02-24 21:38:08 +01:00
parent 58b977f5df
commit b4167574df
4 changed files with 24 additions and 5 deletions

View file

@ -89,6 +89,9 @@ class Message(object):
}
async def getAudioFilePath(self,story):
if self.audioFile is not None:
return self.audioFile
client = AsyncHTTPClient()
queryString = urllib.parse.urlencode({
'text': self.text,

View file

@ -173,7 +173,7 @@ img.icon {
background: lightgray; }
#story #msg h1 {
margin: 0; }
#story #msg .msg__info .btn--delete {
#story #msg .msg__info .btn--delete-mss {
position: absolute;
top: 15px;
right: 10px; }

View file

@ -292,7 +292,8 @@ class Graph {
startAttributes['checked'] = 'checked';
}
let audioSrcEl = crel('source', {'src': this.getAudioUrlForMsg(msg)});
let audioSrcEl = crel('source', {'src': msg['audio'] ? msg['audio']['file'] : this.getAudioUrlForMsg(msg)});
// console.log(msg['audio']);
let audioSpan = crel(
'span',
{
@ -302,11 +303,26 @@ class Graph {
crel(
'audio', {'controls': 'controls'},
audioSrcEl
)
),
crel('div', msg['audio'] ? crel(
'div',
crel('div', {
'class':'btn btn--delete',
'on': {
'click': function(e) {
e.stopPropagation();
e.preventDefault();
panopticon.graph.getNodeById(msg['@id'])['audio'] = null;
panopticon.graph.showMsg(msg);
}
}
}, 'del'),
"uploaded"
) : 'Auto-generated')
);
let msgInfoEl = crel( 'div', { 'class': 'msg__info' },
crel('div', {
'class':'btn btn--delete',
'class':'btn btn--delete btn--delete-msg',
'on': {
'click': function(e) {
if(confirm(`Are you sure you want to remove message ${msg['@id']}`)) {

View file

@ -285,7 +285,7 @@ img.icon{
}
.msg__info {
.btn--delete {
.btn--delete-mss{
position:absolute;
top: 15px;
right: 10px;