Scribe.js/static/js/directives/log.js
Guillaume Wuip 55c4b90960 Add docs
2014-11-13 21:33:37 +01:00

92 lines
2 KiB
JavaScript

(function () {
'use strict';
/**
* Log directive
*
* Represents a single log
*/
window.app.directive('log', [function () {
return {
scope : {
/**
* log
*
* The log object
* @type {Object}
*/
log : "=",
/**
* showFile
*
* Force to show file ?
*
* @type {Boolean}
*/
showFile : "=",
/**
* showTime
*
* Force to show time ?
*
* @type {Boolean}
*/
showTime : "=",
/**
* showDate
*
* Force to show date ?
*
* @type {Boolean}
*/
showDate : "=",
/**
* showTags
*
* Force to show tags ?
*
* @type {Boolean}
*/
showTags : "="
},
restrict : 'E',
templateUrl : 'partials/elements/log.html',
replace : true,
controller : ['$scope', function ($scope) {
/**
* $scope.handleTags
*
* As tags could be string or object,
* extracts the tag message
*
* @type {Function}
*/
$scope.handleTags = function (tag) {
if (typeof tag === 'string') {
return tag;
} else if (typeof tag === 'object') {
return tag.msg || '';
} else {
return tag;
}
};
}]
};
}]);
}());