<commit_before>Notes = new Meteor.Collection('notes');


if (Meteor.isClient) {

    notesSub = Meteor.subscribe('notes');


    Template.signup.events = {
        'click input[type=submit]': function(event) {
            event.preventDefault();

            var user = {
                username: $('#username').val(),
                email: $('#email').val(),
                password: $('#password').val()
            };

            if (!user.username || !user.email || !user.password) {
                alert('Please fill in all fields');
            } else {
                Accounts.createUser(user, function(error) {
                    if (error) {
                        alert(error.reason + 'error');
                    } else {
                        Router.go('/mynotes');
                    }
                });
            }
        }
    };



    Template.login.events = {
        'click input[type=submit]': function(event) {
            event.preventDefault();
            var username = $('#username').val();
            var password = $('#password').val();
            Meteor.loginWithPassword(username, password, function(error) {
                if (error) {
                    alert(error.reason + 'error');
                } else {
                    Router.go('/mynotes');
                    alert('You are now logged in.');
                }
            });
        }
    };

    Template.header.user = function() {
        return Meteor.user();
    }

    Template.header.events({
        'click .log-out': function() {
            Meteor.logout();
        }
    });

    Template.header.helpers({
        messages: function() {
            return Messages.find();
        },
        isLoggedIn: function() {
            return !!Meteor.user();
        }

    });

    Template.mynotes.rendered = function() {
        var editor = ace.edit("editor");
        editor.setTheme("ace/theme/pastel_on_dark");
        editor.getSession().setMode("ace/mode/");
        editor.setHighlightActiveLine(true);
        editor.getSession().setUseWorker(true);
        editor.getSession().setUseWrapMode(true);
        editor.setValue("Type Notes Here");

        $(".save").click(function() {

            var text = editor.getValue();
            var countConfused = text.match(/#confused/g);
            var countMorePractice = text.match(/#morepractice/g);
            var countLost = text.match(/#lost/g);

            if (countConfused == null) {
                countConfused = 0;
            } else {
                countConfused = countConfused.length;
            }

            if (countMorePractice == null) {
                countMorePractice = 0;
            } else {
                countMorePractice = countMorePractice.length;
            }

            if (countLost == null) {
                countLost = 0;
            } else {
                countLost = countLost.length;
            }

            var title = $("#title").val();
            var subject = $("#subject").val();
            var topic = $("#topic").val();

            Notes.insert({
                created_at: new Date,
                title: title,
                subject: subject,
                topic: topic,
                text: text,<commit_msg>Title, Subject, Topic not filled alerts<commit_after>Notes = new Meteor.Collection('notes');


if (Meteor.isClient) {

    notesSub = Meteor.subscribe('notes');


    Template.signup.events = {
        'click input[type=submit]': function(event) {
            event.preventDefault();

            var user = {
                username: $('#username').val(),
                email: $('#email').val(),
                password: <PASSWORD>').<PASSWORD>()
            };

            if (!user.username || !user.email || !user.password) {
                alert('Please fill in all fields');
            } else {
                Accounts.createUser(user, function(error) {
                    if (error) {
                        alert(error.reason + 'error');
                    } else {
                        Router.go('/mynotes');
                    }
                });
            }
        }
    };



    Template.login.events = {
        'click input[type=submit]': function(event) {
            event.preventDefault();
            var username = $('#username').val();
            var password = $('#password').val();
            Meteor.loginWithPassword(username, password, function(error) {
                if (error) {
                    alert(error.reason + 'error');
                } else {
                    Router.go('/mynotes');
                    alert('You are now logged in.');
                }
            });
        }
    };

    Template.header.user = function() {
        return Meteor.user();
    }

    Template.header.events({
        'click .log-out': function() {
            Meteor.logout();
        }
    });

    Template.header.helpers({
        messages: function() {
            return Messages.find();
        },
        isLoggedIn: function() {
            return !!Meteor.user();
        }

    });

    Template.mynotes.rendered = function() {
        var editor = ace.edit("editor");
        editor.setTheme("ace/theme/pastel_on_dark");
        editor.getSession().setMode("ace/mode/");
        editor.setHighlightActiveLine(true);
        editor.getSession().setUseWorker(true);
        editor.getSession().setUseWrapMode(true);
        editor.setValue("Type Notes Here");

        $(".save").click(function() {

            var text = editor.getValue();
            var countConfused = text.match(/#confused/g);
            var countMorePractice = text.match(/#morepractice/g);
            var countLost = text.match(/#lost/g);

            if (countConfused == null) {
                countConfused = 0;
            } else {
                countConfused = countConfused.length;
            }

            if (countMorePractice == null) {
                countMorePractice = 0;
            } else {
                countMorePractice = countMorePractice.length;
            }

            if (countLost == null) {
                countLost = 0;
            } else {
                countLost = countLost.length;
            }

            var title = $("#title").val();
            var subject = $("#subject").val();
            var topic = $("#topic").val();

            if (title == "Enter Title...") {
                return alert("Please fill out title form")
            }
            if (subject == "Enter Subject...") {
                return alert("Please fill out subject form")
            }
            if (topic == "Enter Topic...") {
                return alert("Please fill out topic form")
            }

            Notes.insert({
                created_at: new Date,
                title: title,
                subject: subject,
                topic: topic,
                text: text,
{'fraction_non_alphanumeric': 0.13540462427745664, 'fraction_numerical': 0.0008670520231213873, 'mean_word_length': 1.3468972533062056, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4162571', 'n_tokens_mistral': 1849, 'n_tokens_neox': 1697, 'n_words': 338}