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): async def getAudioFilePath(self,story):
if self.audioFile is not None:
return self.audioFile
client = AsyncHTTPClient() client = AsyncHTTPClient()
queryString = urllib.parse.urlencode({ queryString = urllib.parse.urlencode({
'text': self.text, 'text': self.text,

View File

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

View File

@ -292,7 +292,8 @@ class Graph {
startAttributes['checked'] = 'checked'; 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( let audioSpan = crel(
'span', 'span',
{ {
@ -302,11 +303,26 @@ class Graph {
crel( crel(
'audio', {'controls': 'controls'}, 'audio', {'controls': 'controls'},
audioSrcEl 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' }, let msgInfoEl = crel( 'div', { 'class': 'msg__info' },
crel('div', { crel('div', {
'class':'btn btn--delete', 'class':'btn btn--delete btn--delete-msg',
'on': { 'on': {
'click': function(e) { 'click': function(e) {
if(confirm(`Are you sure you want to remove message ${msg['@id']}`)) { if(confirm(`Are you sure you want to remove message ${msg['@id']}`)) {

View File

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