diff --git a/front/src/css/timeline.css b/front/src/css/timeline.css index 43304d1..53d22e9 100644 --- a/front/src/css/timeline.css +++ b/front/src/css/timeline.css @@ -177,6 +177,46 @@ input.textFilter { .table > div > .type { white-space: nowrap; } +.table .children { + margin-top: 0.2em; + font-size: 0.8em; + line-height: 1.6em; +} +.table .child { + margin-left: 0.5em; +} +.table .child > .child { + margin-left: 1em; +} +.table .child:before { + content: "↳"; +} +.table .child .childArgs { + display: none; +} +.table .child span { + position: relative; +} +.table .child span:hover { + background: #EBD8E2; +} +.table .child span:hover .childArgs { + display: block; + position: absolute; + padding: 0 1em 0 2em; + left: 100%; + top: 0; + background: #EBD8E2; + line-height: 1.3em; + height: 1.3em; + z-index: 1; +} +.table .showingDetails .child span:hover { + background: inherit; +} +.table .showingDetails .child span:hover .childArgs { + display: none; +} .table > div > .value { width: 70%; word-break: break-all; diff --git a/front/src/js/app.js b/front/src/js/app.js index 49e1125..923e474 100644 --- a/front/src/js/app.js +++ b/front/src/js/app.js @@ -12,6 +12,7 @@ var yltApp = angular.module('YellowLabTools', [ 'apiService', 'menuService', 'gradeDirective', + 'jsChildrenDirective', 'offendersDirectives' ]); diff --git a/front/src/js/directives/jsChildrenDirective.js b/front/src/js/directives/jsChildrenDirective.js new file mode 100644 index 0000000..ca7372f --- /dev/null +++ b/front/src/js/directives/jsChildrenDirective.js @@ -0,0 +1,44 @@ +var jsChildrenDirective = angular.module('jsChildrenDirective', []); + +jsChildrenDirective.directive('jsChildren', function() { + + return { + restrict: 'E', + scope: { + node: '=node' + }, + template: '
', + replace: true, + link: function(scope, element, attrs) { + + function recursiveHtmlBuilder(node) { + var html = ''; + + if (node.children) { + node.children.forEach(function(child) { + + var childArgs = ''; + if (child.data.callDetails && child.data.callDetails.arguments && child.data.callDetails.arguments.length > 0) { + childArgs = child.data.callDetails.arguments.join(' : '); + if (childArgs.length > 100) { + childArgs = childArgs.substr(0, 98) + '...'; + } + } + + html += '
' + child.data.type + '
' + childArgs + '
' + recursiveHtmlBuilder(child) + '
'; + }); + } + + return html; + } + + element.append(recursiveHtmlBuilder(scope.node)); + + // Bind a very special behavior: + // We want to display something in the next table-cell, at the same hight. + element.find('span').on('mouseenter', function() { + + }); + } + }; +}); \ No newline at end of file diff --git a/front/src/less/timeline.less b/front/src/less/timeline.less index 3c7a541..1f189fc 100644 --- a/front/src/less/timeline.less +++ b/front/src/less/timeline.less @@ -197,6 +197,56 @@ input.textFilter { white-space:nowrap; } +.table .children { + margin-top: 0.2em; + font-size: 0.8em; + line-height: 1.6em; +} + +.table .child { + margin-left: 0.5em; + + > .child { + margin-left: 1em; + } + + &:before { + content: "↳"; + } + + .childArgs { + display: none; + } + + span { + position: relative; + } + + span:hover { + background: #EBD8E2; + + .childArgs { + display: block; + position: absolute; + padding: 0 1em 0 2em; + left: 100%; + top: 0; + background: #EBD8E2; + line-height: 1.3em; + height: 1.3em; + z-index: 1; + } + } +} + +.table .showingDetails .child span:hover { + background: inherit; + + .childArgs { + display: none; + } +} + .table > div > .value { width: 70%; word-break: break-all; diff --git a/front/src/main.html b/front/src/main.html index 1146a0b..083d943 100644 --- a/front/src/main.html +++ b/front/src/main.html @@ -35,6 +35,7 @@ + diff --git a/front/src/views/timeline.html b/front/src/views/timeline.html index 71210ab..33bbedd 100644 --- a/front/src/views/timeline.html +++ b/front/src/views/timeline.html @@ -78,7 +78,10 @@ }">
{{$index + 1}}
-
{{node.data.type}}
+
+ {{node.data.type}} + +
{{node.data.callDetails.arguments[0]}}