<commit_before>﻿ var Dashboard = function (config) {
    this.init(config);
    return this;
};

Dashboard.prototype = {
    init: function (config) {
        //map external functions
        $.extend(this, config);
    },
    add: function ($anchor) {
        var self = this;
        $.ajax({
            url: $anchor.attr('href'),
            dataType: 'html',
            success: function (data) {
                $('body').append(data);
                var $dialog = $('#models');
                $('html').click(function () {
                    $dialog.fadeOut('fast', function () {
                        $dialog.remove();
                    });
                });
                $dialog.find('a.close').click(function () {
                    $dialog.fadeOut('fast', function () {
                        $dialog.remove();
                    });
                    return false;
                });
                $(':radio').live('click', function (e) {
                    $(this).closest('form').submit();
                });
            }
        });
        return false;
    },
    publish: function ($input) {
        var self = this;
        $.ajax({
            url: '/dashboard/content/publish',
            type: 'POST',
            dataType: 'html',
            data: { id: $input.attr('name'), published: $input.is(':checked') },
            success: function (data) {
                var $growl = $('<aside />');
                $('body').append($growl)
                $growl.hide().html(data).fadeIn('fast');
                $('html').mousemove(function () {
                    $growl.delay(3000).fadeOut('fast', function () {
                        $(this).remove();
                    });
                });
            }
        });
    },
    remove: function ($anchor) {
        var self = this;
        var $row = $anchor.closest('tr');
        $.ajax({
            url: '/dashboard/content/delete',
            type: 'POST',
            dataType: 'html',
            data: { id: $row.attr('id') },
            success: function (data) {
                $row.fadeTo('fast', 0);
                $row.slideUp('fast');
                var $growl = $('<aside />');
                $('body').append($growl)
                $growl.hide().html(data).fadeIn('fast');
                $('html').mousemove(function () {
                    $growl.delay(3000).fadeOut('fast', function () {
                        $(this).remove();
                    });
                });
            }
        });
    },
    permanentRemove: function ($anchor) {
        var self = this;
        var $row = $anchor.closest('tr');
        $.ajax({
            url: '/dashboard/content/permanentdelete',
            type: 'POST',
            dataType: 'html',
            data: { id: $row.attr('id') },
            success: function (data) {
                $row.fadeTo('fast', 0);
                $row.slideUp('fast');
                var $growl = $('<aside />');
                $('body').append($growl)
                $growl.hide().html(data).fadeIn('fast');
                $('html').mousemove(function () {
                    $growl.delay(3000).fadeOut('fast', function () {
                        $(this).remove();
                    });
                });
            }
        });
    },
    selectPage: function ($input) {
        var self = this;
        var id = $input.attr('id');
        $.ajax({
            url: '/dashboard/dialog/editmodelreference',
            dataType: 'html',
            success: function (data) {
                $('body').append(data);
                var $dialog = $('.overlay');
                $dialog.find('div#scroll').lionbars('dark', true, false, false);
                $dialog.find('a.close').live('click', function () {
                    $dialog.fadeOut('fast', function () {
                        $dialog.remove();
                    });
                    return false;
                });
                $dialog.find('a.cancel').live('click', function () {
                    $dialog.fadeOut('fast', function () {
                        $dialog.remove();
                    });
                    return false;
                });

                $dialog.find('#pages a.link').live('click', function () {
                    $('#' + id + '_Id').val($(this).attr('data-id'));
                    $('#pages li').removeClass('selected');
                    $('.select').parent().removeClass('disabled');
                    $(this).parent('li').addClass('selected');
                    return false;
                });

                $dialog.find('a.select').live('click', function () {
                    $('#' + id + '_Name').val($('#pages li.selected a').text());
                    $dialog.fadeOut('fast', function () {
                        $dialog.remove();
                    });

                    return false;
                });

                $dialog.find('.navigator, .parent a').live('click', function () {
                    $.ajax({
                        url: '/dashboard/dialog/GetChildrenModel',
                        type: 'GET',
                        dataType: 'html',<commit_msg>Fixed issue #17<commit_after>﻿ var Dashboard = function (config) {
    this.init(config);
    return this;
};

Dashboard.prototype = {
    init: function (config) {
        //map external functions
        $.extend(this, config);
    },
    add: function ($anchor) {
        var self = this;
        $.ajax({
            url: $anchor.attr('href'),
            dataType: 'html',
            success: function (data) {
                $('body').append(data);
                var $dialog = $('#models');
                $('html').click(function () {
                    $dialog.fadeOut('fast', function () {
                        $dialog.remove();
                    });
                });
                $dialog.find('a.close').click(function () {
                    $dialog.fadeOut('fast', function () {
                        $dialog.remove();
                    });
                    return false;
                });
                $(':radio').live('click', function (e) {
                    $(this).closest('form').submit();
                });
            }
        });
        return false;
    },
    publish: function ($input) {
        var self = this;
        $.ajax({
            url: '/dashboard/content/publish',
            type: 'POST',
            dataType: 'html',
            data: { id: $input.attr('name'), published: $input.is(':checked') },
            success: function (data) {
                var $growl = $('<aside />');
                $('body').append($growl)
                $growl.hide().html(data).fadeIn('fast');
                $('html').mousemove(function () {
                    $growl.delay(3000).fadeOut('fast', function () {
                        $(this).remove();
                    });
                });
            }
        });
    },
    remove: function ($anchor) {
        var self = this;
        var $row = $anchor.closest('tr');
        $.ajax({
            url: '/dashboard/content/delete',
            type: 'POST',
            dataType: 'html',
            data: { id: $row.attr('id') },
            success: function (data) {
                $row.fadeTo('fast', 0);
                $row.slideUp('fast');
                var $growl = $('<aside />');
                $('body').append($growl)
                $growl.hide().html(data).fadeIn('fast');
                $('html').mousemove(function () {
                    $growl.delay(3000).fadeOut('fast', function () {
                        $(this).remove();
                    });
                });
            }
        });
    },
    permanentRemove: function ($anchor) {
        var self = this;
        var $row = $anchor.closest('tr');
        $.ajax({
            url: '/dashboard/content/permanentdelete',
            type: 'POST',
            dataType: 'html',
            data: { id: $row.attr('id') },
            success: function (data) {
                $row.fadeTo('fast', 0);
                $row.slideUp('fast');
                var $growl = $('<aside />');
                $('body').append($growl)
                $growl.hide().html(data).fadeIn('fast');
                $('html').mousemove(function () {
                    $growl.delay(3000).fadeOut('fast', function () {
                        $(this).remove();
                    });
                });
            }
        });
    },
    selectPage: function ($input) {
        var self = this;
        var id = $input.attr('id');
        $.ajax({
            url: '/dashboard/dialog/editmodelreference',
            dataType: 'html',
            success: function (data) {
                $('body').append(data);
                var $dialog = $('.overlay');
                $dialog.find('div#scroll').lionbars('dark', true, false, false);
                $dialog.find('a.close').live('click', function () {
                    $dialog.fadeOut('fast', function () {
                        $dialog.remove();
                    });
                    return false;
                });
                $dialog.find('a.cancel').live('click', function () {
                    $dialog.fadeOut('fast', function () {
                        $dialog.remove();
                    });
                    return false;
                });

                $dialog.find('#pages a.link').live('click', function () {
                    $('#' + id + '_Id').val($(this).attr('data-id'));
                    $('#pages li').removeClass('selected');
                    $('.select').parent().removeClass('disabled');
                    $(this).parent('li').addClass('selected');
                    return false;
                });

                $dialog.find('a.select').click(function () {
                    $('#' + id + '_Name').val($('#pages li.selected a').text());
                    $dialog.fadeOut('fast', function () {
                        $dialog.remove();
                    });

                    return false;
                });

                $dialog.find('.navigator, .parent a').live('click', function () {
                    $.ajax({
                        url: '/dashboard/dialog/GetChildrenModel',
                        type: 'GET',
                        dataType: 'html',
{'fraction_non_alphanumeric': 0.17243367935409457, 'fraction_numerical': 0.0028835063437139563, 'mean_word_length': 1.1560298383754661, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2498332', 'n_tokens_mistral': 2725, 'n_tokens_neox': 2527, 'n_words': 442}