diff --git a/hugvey/story.py b/hugvey/story.py index 77b0876..683b9bb 100644 --- a/hugvey/story.py +++ b/hugvey/story.py @@ -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, diff --git a/www/css/styles.css b/www/css/styles.css index 53e62c6..480a301 100644 --- a/www/css/styles.css +++ b/www/css/styles.css @@ -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; } diff --git a/www/js/hugvey_console.js b/www/js/hugvey_console.js index ed45246..266dd21 100644 --- a/www/js/hugvey_console.js +++ b/www/js/hugvey_console.js @@ -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']}`)) { diff --git a/www/scss/styles.scss b/www/scss/styles.scss index 1cbb47b..6ea3e5c 100644 --- a/www/scss/styles.scss +++ b/www/scss/styles.scss @@ -285,7 +285,7 @@ img.icon{ } .msg__info { - .btn--delete { + .btn--delete-mss{ position:absolute; top: 15px; right: 10px;