Download:
child 69:4ec316ee87e8
parent 67:cdceebad7d96
68:58a9dddf8731
Anton Shestakov <av6@dwimlabs.net>, Sun, 26 Jun 2016 09:26:16 +0800
viewer: make task blocks collapsible (except cleanup)

3 файлов изменено, 36 вставок(+), 1 удалений(-) [+]
incoming.py file | annotate | diff | comparison | revisions
static/main.css file | annotate | diff | comparison | revisions
templates/check.html file | annotate | diff | comparison | revisions
--- a/incoming.py Sat Jun 25 22:11:38 2016 +0800
+++ b/incoming.py Sun Jun 26 09:26:16 2016 +0800
@@ -145,6 +145,9 @@
warnings += dw
item.update(extra)
+ if state is not None:
+ item['task'] = state
+
result.append(item)
domain, user, name = parse_project_url(url)
--- a/static/main.css Sat Jun 25 22:11:38 2016 +0800
+++ b/static/main.css Sun Jun 26 09:26:16 2016 +0800
@@ -44,6 +44,20 @@
padding-right: 10px;
}
+.check-log a.collapser {
+ margin-left: 8px;
+ color: inherit;
+ text-decoration: underline;
+}
+
+.check-log a.collapser::before {
+ content: '[-]'
+}
+
+.check-log a.collapser.collapsed::before {
+ content: '[+]'
+}
+
.check-log .error {
color: #f277a1;
}
--- a/templates/check.html Sat Jun 25 22:11:38 2016 +0800
+++ b/templates/check.html Sun Jun 26 09:26:16 2016 +0800
@@ -43,11 +43,29 @@
</div>
<pre class="check-log">{#
#}{% for number, line in enumerate(lines, 1) %}{#
- #}<div id="l{{ number }}"{% if 'cls' in line %} class="{{ line['cls'] }}"{% end %}>{#
+ #}<div id="l{{ number }}"{% if 'task' in line %} data-task="{{ line['task'] }}"{% end %}{% if 'cls' in line %} class="{{ line['cls'] }}"{% end %}>{#
#}<a href="#l{{ number }}" class="lineno" data-line-number="{{ number }}"></a>{#
#}{{ line['text'] }}{#
+ #}{% if line.get('cls') == 'task' and line.get('task') != 'cleanup' %}{#
+ #}<a class="collapser"></a>{#
+ #}{% end %}{#
#}</div>{#
#}{% end %}{#
#}</pre>
+ <script>
+ (function($) {
+ $('.check-log .collapser').each(function() {
+ var $collapser = $(this);
+ var $header = $collapser.closest('div');
+ var task = $header.attr('data-task');
+ var $lines = $header.nextAll('[data-task="' + task + '"]');
+ $collapser.on('click', function() {
+ $collapser.toggleClass('collapsed');
+ var collapsed = $collapser.hasClass('collapsed');
+ $lines.toggleClass('uk-hidden', collapsed);
+ });
+ });
+ })(jQuery);
+ </script>
</div>
{% end %}