All files / web/bundles/pimui/js/form/common user-main-image.ts

91.67% Statements 11/12
50% Branches 2/4
100% Functions 2/2
90.91% Lines 10/11

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 271110x 1110x 1110x                 1110x       1110x 2264x 2264x 2264x         1110x   1110x  
const MainImage = require('pim/form/common/main-image');
const UserContext = require('pim/user-context');
const MediaUrlGenerator = require('pim/media-url-generator');
 
/**
 * Display main image with user avatar
 *
 * @author    Pierre Allard <pierre.allard@akeneo.com>
 * @copyright 2019 Akeneo SAS (http://www.akeneo.com)
 * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
class UserMainImage extends MainImage {
  /**
   * @{inheritdoc}
   */
  getPath() {
    const filePath = UserContext.get('avatar').filePath;
    Eif (null === filePath || undefined === filePath) {
      return 'bundles/pimui/images/info-user.png';
    }
 
    return MediaUrlGenerator.getMediaShowUrl(UserContext.get('avatar').filePath, 'thumbnail_small');
  }
}
 
export = UserMainImage