<commit_before>/**
 * Created with JetBrains RubyMine.
 * User: teamco
 * Date: 11/24/12
 * Time: 10:13 PM
 * To change this template use File | Settings | File Templates.
 */

define([
    'modules/View',
    'element/application/application.element',
    'element/header.element',
    'element/footer.element',
    'element/application/application.content.element',
    'element/export.element'
], function defineApplicationView(BaseView, ApplicationElement, Header, Footer, ApplicationContentElement, ExportElement) {

    /**
     * View
     * @constructor
     * @class ApplicationView
     * @extends BaseView
     */
    var ApplicationView = function ApplicationView() {
    };

    return ApplicationView.extend('ApplicationView', {

        /**
         * Render Application
         * @memberOf ApplicationView
         */
        renderApplication: function renderApplication() {

            /**
             * Define $application
             * @type {ApplicationElement}
             */
            this.elements.$application = new ApplicationElement(this, {
                $container: this.getConfigHTML().container,
                mode: this.controller.getMode(),
                id: true
            });

            this.header(Header, this.get$item());
            this.workspaces();
            this.footer(Footer, this.get$item());
        },

        /**
         * Render Workspaces container
         * @memberOf ApplicationView
         */
        workspaces: function workspaces() {

            /**
             * Define $workspaces
             * @type {ApplicationContentElement}
             */
            this.elements.$workspaces = new ApplicationContentElement(this, {
                $container: this.get$item().$,
                style: 'workspaces'
            });
        },

        /**
         * Render export lin
         * @memberOf ApplicationView
         */
        renderExportLink: function renderExportLink(data) {

            /**
             * Define export element
             * @type {ExportElement}
             */
            this.elements.$export = new ExportElement(this, {
                $container: this.get$item().$,
                style: 'export-url',
                data: data
            });
        },

        /**
         * Handle notification renderer
         * @memberOf ApplicationView
         * @param xhr
         * @param {string} status
         */
        handleNotificationsRenderer: function handleNotificationsRenderer(xhr, status) {

            /**
             * Define buttons
             * @type {*}
             */
            var buttons = {
                reject: {
                    text: this.i18n.t('cancel'),
                    events: {
                        click: 'rejectModalEvent'
                    }
                }
            };

            /**
             * Define responseJSON
             * @type {Ajax.Response.responseJSON|*}
             */
            var responseJSON = xhr.responseJSON;

            this.modalDialog({
                style: 'handle-' + status,
                type: status,
                title: xhr.status,
                text: xhr.statusText,
                html: (responseJSON || {}).error,
                cover: true,
                autoclose: true,
                buttons: buttons
            });

            this.controller.handleSendLog(xhr, status);
        },

        /**
         * Start rendering
         * @memberOf ApplicationView
         * @param {boolean} [silent]
         */
        render: function render(silent) {
<commit_msg>add autoclose modal on error<commit_after>/**
 * Created with JetBrains RubyMine.
 * User: teamco
 * Date: 11/24/12
 * Time: 10:13 PM
 * To change this template use File | Settings | File Templates.
 */

define([
    'modules/View',
    'element/application/application.element',
    'element/header.element',
    'element/footer.element',
    'element/application/application.content.element',
    'element/export.element'
], function defineApplicationView(BaseView, ApplicationElement, Header, Footer, ApplicationContentElement, ExportElement) {

    /**
     * View
     * @constructor
     * @class ApplicationView
     * @extends BaseView
     */
    var ApplicationView = function ApplicationView() {
    };

    return ApplicationView.extend('ApplicationView', {

        /**
         * Render Application
         * @memberOf ApplicationView
         */
        renderApplication: function renderApplication() {

            /**
             * Define $application
             * @type {ApplicationElement}
             */
            this.elements.$application = new ApplicationElement(this, {
                $container: this.getConfigHTML().container,
                mode: this.controller.getMode(),
                id: true
            });

            this.header(Header, this.get$item());
            this.workspaces();
            this.footer(Footer, this.get$item());
        },

        /**
         * Render Workspaces container
         * @memberOf ApplicationView
         */
        workspaces: function workspaces() {

            /**
             * Define $workspaces
             * @type {ApplicationContentElement}
             */
            this.elements.$workspaces = new ApplicationContentElement(this, {
                $container: this.get$item().$,
                style: 'workspaces'
            });
        },

        /**
         * Render export lin
         * @memberOf ApplicationView
         */
        renderExportLink: function renderExportLink(data) {

            /**
             * Define export element
             * @type {ExportElement}
             */
            this.elements.$export = new ExportElement(this, {
                $container: this.get$item().$,
                style: 'export-url',
                data: data
            });
        },

        /**
         * Handle notification renderer
         * @memberOf ApplicationView
         * @param xhr
         * @param {string} status
         */
        handleNotificationsRenderer: function handleNotificationsRenderer(xhr, status) {

            /**
             * Define buttons
             * @type {*}
             */
            var buttons = {
                reject: {
                    text: this.i18n.t('cancel'),
                    events: {
                        click: 'rejectModalEvent'
                    }
                }
            };

            /**
             * Define responseJSON
             * @type {Ajax.Response.responseJSON|*}
             */
            var responseJSON = xhr.responseJSON;

            this.modalDialog({
                style: 'handle-' + status,
                type: status,
                title: xhr.status,
                text: xhr.statusText,
                html: (responseJSON || {}).error,
                cover: true,
                autoclose: status === 'danger',
                buttons: buttons
            });

            this.controller.handleSendLog(xhr, status);
        },

        /**
         * Start rendering
         * @memberOf ApplicationView
         * @param {boolean} [silent]
         */
        render: function render(silent) {

{'fraction_non_alphanumeric': 0.10707377728654324, 'fraction_numerical': 0.0033158331030671458, 'mean_word_length': 1.3883206862421642, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4331073', 'n_tokens_mistral': 1798, 'n_tokens_neox': 1691, 'n_words': 357}