diff --git a/app/styles/play/level/modal/docs.sass b/app/styles/play/level/modal/docs.sass index 3c25f0389..9e5b5b0d5 100644 --- a/app/styles/play/level/modal/docs.sass +++ b/app/styles/play/level/modal/docs.sass @@ -1,2 +1,5 @@ #docs-modal .modal-dialog - width: 800px \ No newline at end of file + width: 800px + + a[data-toggle="tab"] + cursor: pointer diff --git a/app/templates/modal/employer_signup_modal.jade b/app/templates/modal/employer_signup_modal.jade index 1e3605d73..13f861082 100644 --- a/app/templates/modal/employer_signup_modal.jade +++ b/app/templates/modal/employer_signup_modal.jade @@ -46,8 +46,7 @@ block modal-footer if userIsAnonymous if !userIsAuthorized .modal-footer.linkedin - b.signin-text Sign in with LinkedIn to complete the registration process. - script(type="in/Login" id="linkedInAuthButton" data-onAuth="contractCallback") + button.btn.btn-primary(id="create-account-button") Create Account br br | Already have a CodeCombat account? @@ -57,7 +56,6 @@ block modal-footer a.login-link(data-toggle="coco-modal", data-target="modal/login") Please log in to continue. else if !userIsAnonymous && !userIsAuthorized .modal-footer.linkedin - | We will record your name and work history for verification purposes. else if userIsAuthorized && !userHasSignedContract .modal-footer.linkedin button.btn.btn-primary(id="contract-agreement-button") I agree diff --git a/app/views/account/profile_view.coffee b/app/views/account/profile_view.coffee index 7a7b36172..e253b46d0 100644 --- a/app/views/account/profile_view.coffee +++ b/app/views/account/profile_view.coffee @@ -20,7 +20,9 @@ module.exports = class ProfileView extends View @user = me else @user = User.getByID(@userID) - @addResourceToLoad @user, 'user_profile' + @user.fetch() + @listenTo @user, "sync", => + @render() getRenderData: -> context = super() diff --git a/app/views/employers_view.coffee b/app/views/employers_view.coffee index 1fd874890..f588caa6c 100644 --- a/app/views/employers_view.coffee +++ b/app/views/employers_view.coffee @@ -21,10 +21,19 @@ module.exports = class EmployersView extends View super options @getCandidates() + + checkForEmployerSignupHash: => + if window.location.hash is "#employerSignupLoggingIn" + @openModalView application.router.getView("modal/employer_signup","_modal") + window.location.hash = "" afterRender: -> super() @sortTable() if @candidates.models.length + afterInsert: -> + super() + _.delay @checkForEmployerSignupHash, 500 + getRenderData: -> c = super() c.candidates = @candidates.models diff --git a/app/views/modal/employer_signup_modal.coffee b/app/views/modal/employer_signup_modal.coffee index 61154d23b..96251ad3b 100644 --- a/app/views/modal/employer_signup_modal.coffee +++ b/app/views/modal/employer_signup_modal.coffee @@ -13,10 +13,13 @@ module.exports = class EmployerSignupView extends View subscriptions: "server-error": "onServerError" - "created-user-without-reload": "linkedInAuth" + 'linkedin-loaded': 'onLinkedInLoaded' + "created-user-without-reload": 'createdAccount' events: "click #contract-agreement-button": "agreeToContract" + "click #create-account-button": "createAccount" + "click .login-link": "setHashToOpenModalAutomatically" constructor: (options) -> @@ -24,20 +27,31 @@ module.exports = class EmployerSignupView extends View @authorizedWithLinkedIn = IN?.User?.isAuthorized() window.tracker?.trackEvent 'Started Employer Signup' @reloadWhenClosed = false + @linkedinLoaded = Boolean(IN.parse) + @waitingForLinkedIn = false window.contractCallback = => @authorizedWithLinkedIn = IN?.User?.isAuthorized() @render() + onLinkedInLoaded: => + @linkedinLoaded = true + if @waitingForLinkedIn + @renderLinkedInButton() + + renderLinkedInButton: => + IN.parse() + onServerError: (e) -> @disableModalInProgress(@$el) afterInsert: -> super() - linkedInButtonParentElement = document.getElementById("linkedInAuthButton")?.parentNode + linkedInButtonParentElement = document.getElementById("linkedInAuthButton") if linkedInButtonParentElement - IN.parse() - if me.get('anonymous') - $(".IN-widget").get(0).addEventListener('click', @createAccount, true) + if @linkedinLoaded + @renderLinkedInButton() + else + @waitingForLinkedIn = true getRenderData: -> context = super() @@ -78,11 +92,16 @@ module.exports = class EmployerSignupView extends View return forms.applyErrorsToForm(@$el, res.errors) unless res.valid @enableModalInProgress(@$el) auth.createUserWithoutReload userObject, null - IN.User.authorize @render, @ - linkedInAuth: (e) -> - me.fetch() + setHashToOpenModalAutomatically: (e) -> + window.location.hash = "employerSignupLoggingIn" + + createdAccount: -> @reloadWhenClosed = true + @listenTo me,"sync", => + @render() + IN.parse() + me.fetch() destroy: -> reloadWhenClosed = @reloadWhenClosed diff --git a/app/views/play_view.coffee b/app/views/play_view.coffee index d0ea85466..e89f2ddb4 100644 --- a/app/views/play_view.coffee +++ b/app/views/play_view.coffee @@ -230,7 +230,7 @@ module.exports = class PlayView extends View { name: 'Harvest Time' difficulty: 2 - id: 'find-the-spy' + id: 'harvest-time' image: '/file/db/level/529662dfe0df8f0000000007/grab_the_mushroom_icon.png' description: "Collect a hundred mushrooms in just five lines of code - by Nathan Gossett" }