Contact button opens Intercom for teachers

This commit is contained in:
Matt Lott 2016-09-21 10:19:52 -07:00
parent f1b1cdbdcc
commit 062990851a
8 changed files with 18 additions and 7 deletions

View file

@ -130,7 +130,7 @@ mixin accountLinks
li
strong(data-i18n="nav.support")
li
a(tabindex=-1, data-toggle="coco-modal", data-target="core/ContactModal", data-i18n="nav.contact")
a.contact-modal(tabindex=-1, data-i18n="nav.contact")
li
a(href="https://www.facebook.com/codecombat", data-i18n="nav.facebook")
li

View file

@ -63,7 +63,7 @@ block footer
#footer-links
a(href="/about", data-i18n="nav.about")
a(tabindex=-1, data-toggle="coco-modal", data-target="core/ContactModal", data-i18n="nav.contact")
a.contact-modal(tabindex=-1, data-i18n="nav.contact")
a(href='http://blog.codecombat.com/', data-i18n="nav.blog")
a(href='https://jobs.lever.co/codecombat', tabindex=-1, data-i18n="nav.careers")
a(href='/legal', tabindex=-1, data-i18n="nav.legal")

View file

@ -60,7 +60,7 @@
li
a(href=view.forumLink(), data-i18n="nav.forum")
li
a(tabindex=-1, data-toggle="coco-modal", data-target="core/ContactModal", data-i18n="nav.contact")
a.contact-modal(tabindex=-1, data-i18n="nav.contact")
li
a(href='/community', data-i18n="nav.community")

View file

@ -120,7 +120,7 @@ block header
li
a(href='http://discourse.codecombat.com/category/artisan', data-i18n="nav.forum", target="_blank") Forum
li
a(data-toggle="coco-modal", data-target="core/ContactModal", data-i18n="nav.contact") Email
a.contact-modal(data-i18n="nav.contact")
block outer_content
.outer-content

View file

@ -71,7 +71,7 @@ block header
li
a(href='http://discourse.codecombat.com/category/artisan', data-i18n="nav.forum", target="_blank") Forum
li
a(data-toggle="coco-modal", data-target="core/ContactModal", data-i18n="nav.contact") Email
a.contact-modal(data-i18n="nav.contact")
block outer_content
.outer-content

View file

@ -37,7 +37,7 @@ block header
li
a(href='http://discourse.codecombat.com/category/diplomat', data-i18n="nav.forum", target="_blank") Forum
li
a(data-toggle="coco-modal", data-target="core/ContactModal", data-i18n="nav.contact") Email
a.contact-modal(data-i18n="nav.contact")
block outer_content
.outer-content.container-fluid

View file

@ -70,5 +70,5 @@ if view.showAds()
if !me.get('anonymous')
#play-footer(class=me.isPremium() ? "premium" : "")
p(class='footer-link-text').picoctf-hide
a.contact-link(title='Send CodeCombat a message', tabindex=-1, data-i18n="nav.contact") Contact
a.contact-link(title='Send CodeCombat a message', tabindex=-1, data-i18n="nav.contact")

View file

@ -21,6 +21,7 @@ module.exports = class CocoView extends Backbone.View
'click #loading-error .login-btn': 'onClickLoadingErrorLoginButton'
'click #loading-error #create-account-btn': 'onClickLoadingErrorCreateAccountButton'
'click #loading-error #logout-btn': 'onClickLoadingErrorLogoutButton'
'click .contact-modal': 'onClickContactModal'
subscriptions: {}
shortcuts: {}
@ -176,6 +177,16 @@ module.exports = class CocoView extends Backbone.View
msg = $.i18n.t 'loading_error.connection_failure', defaultValue: 'Connection failed.'
noty text: msg, layout: 'center', type: 'error', killer: true, timeout: 3000
onClickContactModal: (e) ->
if me.isTeacher()
if application.isProduction()
window.Intercom?('show')
else
alert('Teachers, Intercom widget only available in production.')
else
ContactModal = require 'views/core/ContactModal'
@openModalView(new ContactModal())
onClickLoadingErrorLoginButton: (e) ->
e.stopPropagation() # Backbone subviews and superviews will handle this call repeatedly otherwise
AuthModal = require 'views/core/AuthModal'