views: In the summary, make the sections toggable

As an experiment, make the sections of the summary to be toggable. This
can help readability, although it's unclear if it's worth the additional
complexity and could be removed later.
This commit is contained in:
Alberto Bertogli 2017-08-27 19:35:08 +01:00
parent 5def4c9e01
commit e1349d418c
5 changed files with 33 additions and 17 deletions

@ -124,6 +124,12 @@ span.age-band2 {
color: seagreen; color: seagreen;
} }
/* Toggable titles */
div.toggable-title {
font-weight: bold;
margin-bottom: 0.3em;
}
/* Commit message and diff. */ /* Commit message and diff. */
pre.commit-message { pre.commit-message {
font-size: large; font-size: large;

@ -61,3 +61,13 @@ function replace_timestamps() {
} }
} }
} }
function toggle(id) {
var e = document.getElementById(id);
if (e.style.display == "") {
e.style.display = "none"
} else if (e.style.display == "none") {
e.style.display = ""
}
}

@ -16,7 +16,7 @@
% end % end
% end % end
<table class="nice commits"> <table class="nice commits" id="commits">
% refs = repo.refs() % refs = repo.refs()
% if not defined("commits"): % if not defined("commits"):

@ -5,6 +5,7 @@
<link rel="stylesheet" type="text/css" href="../../static/git-arr.css"/> <link rel="stylesheet" type="text/css" href="../../static/git-arr.css"/>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/> <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name=viewport content="width=device-width, initial-scale=1"> <meta name=viewport content="width=device-width, initial-scale=1">
<script async src="../../static/git-arr.js"></script>
</head> </head>
<body class="summary"> <body class="summary">
@ -35,23 +36,25 @@
% end % end
% if "master" in repo.branch_names(): % if "master" in repo.branch_names():
<b><a href="b/master/t/">[master]</a> /</b><br/> <div class="toggable-title" onclick="toggle('commits')">
% kwargs = dict(repo = repo, tree=repo.tree("master"), <a href="b/master/">commits (master)</a>
% treeroot="b/master/t", dirname=smstr.from_url("")) </div>
% include tree-list **kwargs
<hr/>
% kwargs = dict(repo = repo, start_ref = "refs/heads/master", % kwargs = dict(repo = repo, start_ref = "refs/heads/master",
% limit = repo.info.commits_in_summary, % limit = repo.info.commits_in_summary,
% shorten = shorten, repo_root = ".", offset = 0) % shorten = shorten, repo_root = ".", offset = 0)
% include commit-list **kwargs % include commit-list **kwargs
<hr/> <hr/>
<div class="toggable-title" onclick="toggle('ls')">
<a href="b/master/t/">tree (master)</a>
</div>
% kwargs = dict(repo = repo, tree=repo.tree("master"),
% treeroot="b/master/t", dirname=smstr.from_url(""))
% include tree-list **kwargs
<hr/>
% end % end
<table class="nice"> <div class="toggable-title" onclick="toggle('branches')">branches</div>
<tr> <table class="nice toggable" id="branches">
<th>branches</th>
</tr>
% for b in repo.branch_names(): % for b in repo.branch_names():
<tr> <tr>
<td class="main"><a href="b/{{b}}/">{{b}}</a></td> <td class="main"><a href="b/{{b}}/">{{b}}</a></td>
@ -67,11 +70,8 @@
% tags = list(repo.tags()) % tags = list(repo.tags())
% if tags: % if tags:
<table class="nice"> <div class="toggable-title" onclick="toggle('tags')">tags</div>
<tr> <table class="nice toggable" id="tags">
<th>tags</th>
</tr>
% for name, obj_id in tags: % for name, obj_id in tags:
<tr> <tr>
<td><a href="c/{{obj_id}}/">{{name}}</a></td> <td><a href="c/{{obj_id}}/">{{name}}</a></td>

@ -1,4 +1,4 @@
<table class="nice ls"> <table class="nice toggable ls" id="ls">
% key_func = lambda (t, n, s): (t != 'tree', n.raw) % key_func = lambda (t, n, s): (t != 'tree', n.raw)
% for type, name, size in sorted(tree.ls(dirname.raw), key = key_func): % for type, name, size in sorted(tree.ls(dirname.raw), key = key_func):
<tr class="{{type}}"> <tr class="{{type}}">