Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' into github-connect-request
Browse files Browse the repository at this point in the history
Conflicts:
	kuma/users/templates/socialaccount/signup.html
  • Loading branch information
jezdez committed Aug 13, 2014
2 parents e3aa0e2 + e74d49d commit ad9f05f
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 8 deletions.
5 changes: 3 additions & 2 deletions kuma/users/templates/socialaccount/connections.html
Expand Up @@ -21,7 +21,8 @@ <h1>{{ _("Account connections") }}</h1>
{% endif %}

<ul class="no-bullets">
{% for base_account in form.accounts %}

{% for base_account in form.accounts.order_by('provider') %}
{% with account=base_account.get_provider_account() %}
<li>
<label for="id_account_{{ base_account.id }}">
Expand All @@ -32,7 +33,7 @@ <h1>{{ _("Account connections") }}</h1>
<i class="icon-user larger no-margin" aria-hidden="true"></i>
{% endif %}
<span class="socialaccount_provider {{ base_account.provider }} {{ account.get_brand().id }}">{{ account.get_brand().name }}</span>
<em class="uid">{{ account}}</em>
<em class="uid">{{ account }}</em>
</label>
</li>
{% endwith %}
Expand Down
19 changes: 18 additions & 1 deletion kuma/users/templates/socialaccount/signup.html
Expand Up @@ -112,7 +112,7 @@ <h1>{{ _('Sign up') }}</h1>
<li class="{{ 'exists' if email_choice.choice_value in matching_uids }}">
{% if email_choice.choice_value == form.other_email_value %}
{{ email_choice.tag() }}
<label for="{{ id_for_label }}" class="inner">{{ _('other:') }}</label>
<label for="{{ id_for_label }}" class="inner other-label">{{ _('other:') }}</label>
{{ form.other_email }}
{{ form.other_email.error }}
{% else %}
Expand Down Expand Up @@ -149,3 +149,20 @@ <h1>{{ _('Sign up') }}</h1>
</div>
</section>
{% endblock %}

{% block js %}
{{ super() }}
<script>
(function ($) {
'use strict';

var $otherLabel = $('.other-label');
var $otherRadio = $otherLabel.prev();
$otherLabel.next().on('focus', function() {
$otherRadio.prop('checked', true);
});

})(jQuery);
</script>

{% endblock %}
47 changes: 43 additions & 4 deletions media/redesign/js/main.js
@@ -1,4 +1,4 @@
(function(doc, $) {
(function(win, doc, $) {
'use strict';

/*
Expand Down Expand Up @@ -40,8 +40,8 @@
// Track event of which was clicked
var serviceUsed = $(this).data('service'); // "Persona" or "GitHub"
mdn.analytics.trackEvent({
category: 'Sign-in',
action: 'Start',
category: 'Authentication',
action: 'Started sign-in',
label: serviceUsed.toLowerCase()
});

Expand Down Expand Up @@ -250,5 +250,44 @@
cache: true
});

/*
Track users successfully logging in and out
*/
('localStorage' in win) && (function() {
var serviceKey = 'login-service';
var serviceStored = localStorage.getItem(serviceKey);
var serviceCurrent = $('body').data(serviceKey);

try {

// User just logged in
if(serviceCurrent && !serviceStored) {
localStorage.setItem(serviceKey, serviceCurrent);

mdn.optimizely.push(['trackEvent', 'login-' + serviceCurrent]);
mdn.analytics.trackEvent({
category: 'Authentication',
action: 'Finished sign-in',
label: serviceCurrent
});
}

// User just logged out
else if(!serviceCurrent && serviceStored) {
localStorage.removeItem(serviceKey);

mdn.optimizely.push(['trackEvent', 'logout-' + serviceStored]);
mdn.analytics.trackEvent({
category: 'Authentication',
action: 'Signed out',
label: serviceStored
});
}

}
catch (e) {
// Browser probably doesn't support localStorage
}
})();

})(document, jQuery);
})(window, document, jQuery);
2 changes: 1 addition & 1 deletion templates/base.html
Expand Up @@ -64,7 +64,7 @@
{% include "includes/google_analytics.html" %}
{% endif %}
</head>
<body {% block body_attributes %}{% endblock %} class="{% block bodyclass %}{% endblock %}">
<body {% block body_attributes %}{% endblock %} class="{% block bodyclass %}{% endblock %}"{% if request.user.is_authenticated() %} data-login-service="{{ request.session.sociallogin_provider }}"{% endif %}>

{% include "includes/config.html" %}

Expand Down

0 comments on commit ad9f05f

Please sign in to comment.