Skip to content

Commit

Permalink
Table viz: Link column CR1
Browse files Browse the repository at this point in the history
  • Loading branch information
kravets-levko committed Feb 4, 2018
1 parent 55d47ed commit 361b68d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions client/app/components/dynamic-table/default-cell/index.js
Expand Up @@ -2,6 +2,11 @@ import { contains } from 'underscore';
import { renderDefault, renderImage, renderLink } from './utils';
import template from './template.html';

const renderFunctions = {
image: renderImage,
link: renderLink,
};

export default function init(ngModule) {
ngModule.directive('dynamicTableDefaultCell', $sanitize => ({
template,
Expand All @@ -24,12 +29,7 @@ export default function init(ngModule) {
$scope.allowHTML = contains(['image', 'link'], $scope.column.displayAs);
}

let renderValue;
switch ($scope.column.displayAs) {
case 'image': renderValue = renderImage; break;
case 'link': renderValue = renderLink; break;
default: renderValue = renderDefault; break;
}
const renderValue = renderFunctions[$scope.column.displayAs] || renderDefault;

$scope.value = $sanitize(renderValue($scope.column, $scope.row));

Expand Down

0 comments on commit 361b68d

Please sign in to comment.