From bca85337cc05922665a9d252d53e4da2423a4060 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Thu, 29 Sep 2016 09:33:13 +0800 Subject: [PATCH] add template strings + outdent to chatview --- frontend/src/Metamaps/Views/ChatView.js | 54 ++++++++++++++++++------- 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/frontend/src/Metamaps/Views/ChatView.js b/frontend/src/Metamaps/Views/ChatView.js index 54236bb4..6b63cd70 100644 --- a/frontend/src/Metamaps/Views/ChatView.js +++ b/frontend/src/Metamaps/Views/ChatView.js @@ -9,26 +9,41 @@ import Backbone from 'backbone' import Autolinker from 'autolinker' import _ from 'lodash' import underscore from 'underscore' +import outdent from 'outdent' // TODO is this line good or bad // Backbone.$ = window.$ const linker = new Autolinker({ newWindow: true, truncate: 50, email: false, phone: false, twitter: false }) var Private = { - messageHTML: "
" + - "
" + - "
{{ message }}
" + - "
{{ timestamp }}
" + - "
" + - '
', - participantHTML: "
" + - "
" + - "
{{ username }} {{ selfName }}
" + - "" + - "" + - "
" + - "
" + - '
', + messageHTML: outdent` +
+
+
{{ message }}
+
{{ timestamp }}
+
+
`, + participantHTML: outdent` +
+
+ +
+
+ {{ username }} {{ selfName }} +
+ + + +
+
+
+
`, templates: function () { underscore.templateSettings = { interpolate: /\{\{(.+?)\}\}/g @@ -45,7 +60,16 @@ var Private = { this.$videoToggle = $('
') this.$cursorToggle = $('
') this.$participants = $('
') - this.$conversationInProgress = $('
LIVE LEAVEJOIN
') + this.$conversationInProgress = $(outdent` +
+ LIVE + + LEAVE + + + JOIN + +
`) this.$chatHeader = $('
CHAT
') this.$soundToggle = $('
') this.$messages = $('
')