Skip to content

Commit

Permalink
Merge pull request #5222 from dimagi/mobile-worker-events
Browse files Browse the repository at this point in the history
Google Analytics events for Mobile Workers page
  • Loading branch information
Nick Pellegrino committed Jan 7, 2015
2 parents f692941 + d20c029 commit aee50ac
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
15 changes: 14 additions & 1 deletion corehq/apps/users/templates/users/edit_commcare_user.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
.text("{% trans 'Password changed successfully' %}");
form.find('.reset-password-body').prepend($alert);
form.find('input').val('');
ga_track_event("Edit Mobile Worker", "Reset password", "{{couch_user_id|escapejs}}");
}
},
error: function (response) {
Expand Down Expand Up @@ -81,6 +82,18 @@
if ($('#delete_user_{{ couch_user.user_id }}').get(0)) {
ko.applyBindings(new DeleteUserButtonModel(), $('#delete_user_{{ couch_user.user_id }}').get(0));
}

// Event tracking
var $deleteModalForm = $("#delete_user_{{ couch_user.user_id }} form");
$("button:submit", $deleteModalForm).on("click", function(){
ga_track_event("Edit Mobile Worker", "Deleted User", "{{couch_user.user_id|escapejs}}", {
'hitCallback': function() {
$deleteModalForm.submit();
}
});
return false;
});

});
{% endif %}

Expand Down Expand Up @@ -121,7 +134,7 @@
</ul>
<div class="tab-content" id="settings">
<div class="tab-pane" id="basic-info">
{% include 'users/partial/basic_info_form.html' %}
{% include 'users/partial/basic_info_form.html' with user_type="mobile"%}
</div>

<div class="tab-pane" id="groups">
Expand Down
2 changes: 1 addition & 1 deletion corehq/apps/users/templates/users/edit_full_user.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{% endblock %}

{% block main_column %}
{% include 'users/partial/basic_info_form.html' %}
{% include 'users/partial/basic_info_form.html' with user_type="web"%}
{% endblock %}

{% block modals %}{{ block.super }}
Expand Down
17 changes: 15 additions & 2 deletions corehq/apps/users/templates/users/partial/basic_info_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,23 @@
return false;
});

$('form[name="user_information"]').on("change", null, null, function() {
var $userInformationForm = $('form[name="user_information"]');
$userInformationForm.on("change", null, null, function() {
$(":submit").prop("disabled", false);
}).on("input", null, null, function() {
$(":submit").prop("disabled", false);
})
});

{% if user_type == "mobile" %}
$("button:submit", $userInformationForm).on("click", function(){
ga_track_event("Edit Mobile Worker", "Updated user info", "{{couch_user_id|escapejs}}", {
'hitCallback': function() {
$userInformationForm.submit();
}
});
return false;
});
{% endif %}

</script>
{% endblock %}

0 comments on commit aee50ac

Please sign in to comment.