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

88.89% Statements 8/9
92.86% Branches 13/14
100% Functions 2/2
88.89% Lines 8/9

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 29 30 31  39x                 39x         60x 60x       60x 60x   60x   60x          
/* global define */
define(['oro/datagrid/string-cell', 'oro/translator'],
    function(StringCell, __) {
        'use strict';
 
        /**
         * Boolean column cell
         *
         * @extends oro.datagrid.StringCell
         */
        return StringCell.extend({
            /**
             * Render the boolean.
             */
            render: function () {
                var value = this.formatter.fromRaw(this.model.get(this.column.get("name")));
                Iif (null === value || '' === value) {
                    return this;
                }
 
                var status = (true === value || 'true' === value || '1' === value) ? 'success' : 'important';
                var label = (true === value || 'true' === value || '1' === value) ? __('pim_common.yes') : __('pim_common.no');
 
                this.$el.empty().html('<span class="AknBadge AknBadge--' + status +'">' + __(label) + '</span>');
 
                return this;
            }
        });
    }
);