/** * Created by wisestone on 2018-02-06. */ 'use strict'; define(['app', 'angular'], function (app, angular) { app.directive('cardContent', ["$log", "$rootScope", "$compile", function ($log, $rootScope, $compile) { return { restrict : 'AE', compile : function (tElement, tAttrs) { return function (scope, element, attrs) { var makeTag = ""; scope.task = scope[attrs["cardContent"]]; if (angular.isDefined(scope.task)) { if (scope.task.priorityVo != null) { switch(scope.task.priorityVo.color) { case "btn-danger" : $(element).addClass("item-danger"); break; case "btn-primary" : $(element).addClass("item-primary"); break; case "btn-info" : $(element).addClass("item-info"); break; } } // 지연 여부 확인 if ($rootScope.isDefined(scope.task.completeDate)) { var completeDate = new Date(scope.task.completeDate); var year = new Date().getFullYear(); var month = new String(new Date().getMonth() + 1); var day = new String(new Date().getDate()); var nowDate = new Date(year + "-" + month + "-" + day); if (completeDate.getTime() < nowDate.getTime()) { makeTag += "
지연
"; } } // Body 영역 makeTag += "
"; makeTag += "
"; makeTag += "
" + scope.task.title + "
"; if (angular.isDefined(scope.task.description) && scope.task.description != null && scope.task.description.length > 0) { makeTag += "
" + scope.task.description + "
"; } makeTag += "
"; makeTag += "
"; // temp-pi-body 종료 if (scope.task.taskCommentCount > 0 || scope.task.attachedFileCount > 0 || scope.task.userVos.length > 0 || $rootScope.isDefined(scope.task.startDate)) { // Footer 영역 makeTag += ""; // temp-footer 종료 } var linkFn = $compile(makeTag); var content = linkFn(scope); element.append(content); } }; } } }]) });