All files / web/bundles/pimdatagrid/js/datagrid/cell boolean-status-cell.js

100% Statements 7/7
100% Branches 5/5
100% Functions 2/2
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28          46x                 46x   1750x 1750x 1750x   1750x   1750x          
/**
 * @author    Tamara Robichet <tamara.robichet@akeneo.com>
 * @copyright 2017 Akeneo SAS (http://www.akeneo.com)
 * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
define(['oro/datagrid/string-cell', 'oro/translator'],
    function(StringCell, __) {
        'use strict';
 
        /**
         * Boolean column cell
         *
         * @extends oro.datagrid.StringCell
         */
        return StringCell.extend({
            render: function () {
                const columnValue = this.model.get(this.column.get('name'));
                const value = this.formatter.fromRaw(columnValue);
                const label = (true === value || 'true' === value || '1' === value) ? '<strong>' + __('Yes') + '</strong>' : __('No');
 
                this.$el.empty().html(label);
 
                return this;
            }
        });
    }
);