diff --git a/client/less/chat.less b/client/less/chat.less index 207ab294b1b..a6f83171cad 100644 --- a/client/less/chat.less +++ b/client/less/chat.less @@ -1,3 +1,10 @@ +.chat-embed-main-title { + display: flex; + flex-grow: 1; + padding-left: 31px; + padding-top: 7px; +} + .gitter-chat-embed { z-index: 100; position: fixed; diff --git a/client/main.js b/client/main.js index 2d6a526c773..f4e74c5967b 100644 --- a/client/main.js +++ b/client/main.js @@ -6,6 +6,7 @@ main.ga = window.ga || function() {}; main = (function(main) { + // should be set before gitter script loads ((window.gitter = {}).chat = {}).options = { disableDefaultChat: true }; @@ -20,7 +21,8 @@ main = (function(main) { document.addEventListener('gitter-sidecar-ready', function(e) { main.chat.GitterChat = e.detail.Chat; - main.chat.createHelpChat = function(room, helpChatBtnClass) { + main.chat.createHelpChat = function(room, helpChatBtnClass, roomTitle) { + roomTitle = roomTitle || 'Waypoint Help'; $('body').append( '' @@ -43,8 +45,21 @@ main = (function(main) { } }); + var helpTitleAdd = false; $('#chat-embed-help').on('gitter-chat-toggle', function(e) { var shouldButtonBePressed = !!e.originalEvent.detail.state; + + if (!helpTitleAdd) { + helpTitleAdd = true; + $('#chat-embed-help > .gitter-chat-embed-action-bar').prepend( + '
' + ); + } + if (shouldButtonBePressed) { return $(helpChatBtnClass).addClass('active'); } @@ -62,6 +77,21 @@ main = (function(main) { targetElement: $('#chat-embed-main') }); + var mainChatTitleAdded = false; + $('#chat-embed-main').on('gitter-chat-toggle', function() { + if (mainChatTitleAdded) { + return null; + } + mainChatTitleAdded = true; + + $('#chat-embed-main > .gitter-chat-embed-action-bar').prepend( + ' ' + ); + }); + + $('#nav-chat-btn').on('click', function() { if (!main.chat.isOpen) { diff --git a/server/views/coursewares/showBonfire.jade b/server/views/coursewares/showBonfire.jade index bc407a5f1da..84bfdb0e291 100644 --- a/server/views/coursewares/showBonfire.jade +++ b/server/views/coursewares/showBonfire.jade @@ -125,7 +125,7 @@ block content document.addEventListener('gitter-sidecar-ready', function(e) { if (window.main) { - window.main.chat.createHelpChat('freecodecamp/helpbonfires', '#challenge-help-btn'); + window.main.chat.createHelpChat('freecodecamp/helpbonfires', '#challenge-help-btn', 'Bonfires Help'); } }); diff --git a/server/views/coursewares/showZiplineOrBasejump.jade b/server/views/coursewares/showZiplineOrBasejump.jade index 2fff6c4b965..626bde86aa4 100644 --- a/server/views/coursewares/showZiplineOrBasejump.jade +++ b/server/views/coursewares/showZiplineOrBasejump.jade @@ -102,8 +102,11 @@ block content window.main.chat.createHelpChat( !{JSON.stringify(challengeType)} === 3 ? 'freecodecamp/helpZiplines' : - 'freecodecamp/helpBonfires', - '#challenge-help-btn' + 'freecodecamp/helpBasejumps', + '#challenge-help-btn', + !{JSON.stringify(challengeType)} === 3 ? + 'Zipline Help' : + 'Basejump Help' ); } });