<commit_before>/**
 * Created by Trevor on 7/10/2015.
 */
var editUser = {
    init: function () {
        $("#username").text(window.args.editUser);

        var host = window.apiRoute + "/getUser/" + window.args.editUser;

        $.get(host, function (data) {
            var userData = $.parseJSON(data);

            var firstName = userData.firstName;
            var lastName = userData.lastName;


            $("#FirstName").val(firstName);
            $("#LastName").val(lastName);
        });

    },

    _submitChanges: function (isConfirmed, callback) {
        var username = $("#username").text();
        var newFirstName = $("#FirstName").val();
        var newLastName = $("#LastName").val();
        var perms = 601;

        var host = window.apiRoute + '/editUser/' +
            '"' + username + '"' + '/'
            + '"' + newFirstName + '"' + '/'
            + '"' + newLastName + '"' + '/'
            + perms + '/' + isConfirmed;

        $.get(host, function (data) {
            callback(data);
        });
    },

    save: function () {
        var message = editUser._submitChanges("true", function (message) {
            alert(message);
        });
    },

    delete: function () {
        var message = editUser._submitChanges("false", function (message) {
            alert(message);
        });
    },

    back: function () {
        navigation.go(window.args.previousPage);
    }
};<commit_msg>The "GUI" part is done. I think I just need to finish out the backend now.<commit_after>/**
 * Created by Trevor on 7/10/2015.
 */
var editUser = {
    init: function () {
        $("#username").text(window.args.editUser);

        var host = window.apiRoute + "/getUser/" + window.args.editUser;

        $.get(host, function (data) {
            var userData = $.parseJSON(data);

            var firstName = userData.firstName;
            var lastName = userData.lastName;


            $("#FirstName").val(firstName);
            $("#LastName").val(lastName);
        });

    },

    _submitChanges: function (isConfirmed, callback) {
        var username = $("#username").text();
        var newFirstName = $("#FirstName").val();
        var newLastName = $("#LastName").val();

        var values = new Array();
        $.each($("input[name='user_permission[]']:checked"), function () {
            values.push($(this).val());
        });

        perms = "";
        for (var i = 0; i < values.length; i++) {
            perms += values[i].toString();
            // alert(values[i]);
        }

        alert("Permissions string is " + perms);

        var host = window.apiRoute + '/editUser/' +
            '"' + username + '"' + '/'
            + '"' + newFirstName + '"' + '/'
            + '"' + newLastName + '"' + '/'
            + perms + '/' + isConfirmed;

        $.get(host, function (data) {
            callback(data);
        });
    },

    save: function () {
        if (confirm('Do you really want to make these edits?')) {

            var message = editUser._submitChanges("true", function (message) {
                alert(message);
            });
        }
    },

    delete: function () {
        if (confirm('Do you really want to delete this user?')) {
            var message = editUser._submitChanges("false", function (message) {
                alert(message);
            });
        }
    },


    back: function () {
        navigation.go(window.args.previousPage);
    }
};
{'fraction_non_alphanumeric': 0.17047756874095513, 'fraction_numerical': 0.005209840810419681, 'mean_word_length': 1.8051948051948052, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3492813', 'n_tokens_mistral': 1003, 'n_tokens_neox': 960, 'n_words': 208}