<commit_before>/**
 * Created with JetBrains RubyMine.
 * User: teamco
 * Date: 5/9/13
 * Time: 11:48 AM
 */

define([
    'modules/Element'
], function defineWorkspaceDataContentElement(BaseElement) {

    /**
     * Define WorkspaceData Content Element
     * @constructor
     * @class WorkspaceDataContentElement
     * @param {WorkspaceDataView} view
     * @param opts
     * @extends BaseElement
     * @extends Renderer
     * @returns {WorkspaceDataContentElement}
     */
    var WorkspaceDataContentElement = function WorkspaceDataContentElement(view, opts) {

        this._config(view, opts, $('<li />')).build({
            $container: opts.$container,
            destroy: false
        });

        /**
         * Define page index
         * @type {number}
         */
        this.index = opts.counter;

        return this.init(opts.data);
    };

    return WorkspaceDataContentElement.extend('WorkspaceDataContentElement', {

        /**
         * Define init
         * @memberOf WorkspaceDataContentElement
         * @param {Page} page
         * @returns {WorkspaceDataContentElement}
         */
        init: function init(page) {

            this.setAttributes(page);
            this.setPublishOn(page);
            this.bindShowPrefs(page);

            this.renderCounter(page);

            /**
             * Define page reference
             * @type {Page}
             */
            this.page = page;

            return this;
        },

        /**
         * Render page widgets counter
         * @member WorkspaceDataContentElement
         * @param {Page} page
         */
        renderCounter: function renderCounter(page) {
            this.$.append(
                $('<div />').addClass('counter')
            );

            this.updateCounter(page);
        },

        /**
         * Update counter text
         * @member WorkspaceDataContentElement
         * @param {Page} page
         */
        updateCounter: function updateCounter(page) {

            /**
             * Get items length
             * @type {Number}
             */
            var items = this.base.lib.hash.hashLength(
                    page.model.getItems()
                ),
                preferences = page.model.getConfig('preferences') || {};

            this.get$counter().
                text(items).
                attr({
                    title: [items, 'items'].join(' ')
                });

            this.renderTooltip({
                title: preferences.title || page.model.getUUID(),
                description: [
                        preferences.description || '', '<br />',
                    '<span>uuid: </span>', page.model.getUUID(), '<br /><br />',
                    '<span>items: </span>', items, '<br />',
                    '<span>index: </span>', 0
                ].join(''),
                $container: this
            });
        },

        /**
         * Get page $counter
         * @member WorkspaceDataContentElement
         * @returns {*|jQuery|HTMLElement}
         */
        get$counter: function get$counter() {
            return $('.counter', this.$);
        },

        /**
         * Define attributes
         * @member WorkspaceDataContentElement
         * @param data
         */
        setAttributes: function setAttributes(data) {

            /**
             * Get config
             * @type {*}
             */
            var config = data.model.getConfig(),
                preferences = data.model.getConfig('preferences') || {};
<commit_msg>fix tooltip<commit_after>/**
 * Created with JetBrains RubyMine.
 * User: teamco
 * Date: 5/9/13
 * Time: 11:48 AM
 */

define([
    'modules/Element'
], function defineWorkspaceDataContentElement(BaseElement) {

    /**
     * Define WorkspaceData Content Element
     * @constructor
     * @class WorkspaceDataContentElement
     * @param {WorkspaceDataView} view
     * @param opts
     * @extends BaseElement
     * @extends Renderer
     * @returns {WorkspaceDataContentElement}
     */
    var WorkspaceDataContentElement = function WorkspaceDataContentElement(view, opts) {

        this._config(view, opts, $('<li />')).build({
            $container: opts.$container,
            destroy: false
        });

        /**
         * Define page index
         * @type {number}
         */
        this.index = opts.counter;

        return this.init(opts.data);
    };

    return WorkspaceDataContentElement.extend('WorkspaceDataContentElement', {

        /**
         * Define init
         * @memberOf WorkspaceDataContentElement
         * @param {Page} page
         * @returns {WorkspaceDataContentElement}
         */
        init: function init(page) {

            this.setAttributes(page);
            this.setPublishOn(page);
            this.bindShowPrefs(page);

            this.renderCounter(page);

            /**
             * Define page reference
             * @type {Page}
             */
            this.page = page;

            return this;
        },

        /**
         * Render page widgets counter
         * @member WorkspaceDataContentElement
         * @param {Page} page
         */
        renderCounter: function renderCounter(page) {
            this.$.append(
                $('<div />').addClass('counter')
            );

            this.updateCounter(page);
        },

        /**
         * Update counter text
         * @member WorkspaceDataContentElement
         * @param {Page} page
         */
        updateCounter: function updateCounter(page) {

            /**
             * Get items length
             * @type {Number}
             */
            var items = this.base.lib.hash.hashLength(
                    page.model.getItems()
                ),
                preferences = page.model.getConfig('preferences') || {};

            this.get$counter().
                text(items).
                attr({
                    title: [items, 'items'].join(' ')
                });

            this.renderTooltip({
                title: preferences.title || page.model.getUUID(),
                description: [
                        preferences.description || '', '<br />',
                    '<span>uuid: </span>', page.model.getUUID(), '<br /><br />',
                    '<span>items: </span>', items, '<br />',
                    '<span>index: </span>', 0
                ].join(''),
                $container: this.view.elements.$workspacedata
            });
        },

        /**
         * Get page $counter
         * @member WorkspaceDataContentElement
         * @returns {*|jQuery|HTMLElement}
         */
        get$counter: function get$counter() {
            return $('.counter', this.$);
        },

        /**
         * Define attributes
         * @member WorkspaceDataContentElement
         * @param data
         */
        setAttributes: function setAttributes(data) {

            /**
             * Get config
             * @type {*}
             */
            var config = data.model.getConfig(),
                preferences = data.model.getConfig('preferences') || {};

{'fraction_non_alphanumeric': 0.12445690259285214, 'fraction_numerical': 0.0025227750525578137, 'mean_word_length': 1.426385583134988, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, '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': '4159183', 'n_tokens_mistral': 1816, 'n_tokens_neox': 1770, 'n_words': 359}