views: Change the "repository" line into "git clone"

We display the location of the repository, but the entire row is not
convenient for copy-pasting.

This patch changes the wording to "git clone" so the entire row can be
copied and pasted into a terminal.

There's a trick, because if we just changed the wording to:

  <td>git clone</td> <td>https://example.com/repo</td>

that would get copied as:

  git clone\thttps://example.com/repo

which does not work well when pasted into a terminal (as the \t gets
"eaten" in most cases).

So this patch changes the HTML to have a space after "clone":

  <td>git clone </td> <td>https://example.com/repo</td>

and the CSS to preserve the space, so the following gets copied:

  git clone \thttps://example.com/repo

which works when pasting on a terminal.
This commit is contained in:
Alberto Bertogli 2017-08-27 16:11:47 +01:00
parent 56b0b34930
commit d7f0e4a265
2 changed files with 5 additions and 1 deletions

@ -205,6 +205,10 @@ table.repo_info tr:hover {
} }
table.repo_info td.category { table.repo_info td.category {
font-weight: bold; font-weight: bold;
/* So we can copy-paste rows and preserve spaces, useful for the row:
* git clone | url
*/
white-space: pre-wrap;
} }
table.repo_info td { table.repo_info td {
vertical-align: top; vertical-align: top;

@ -25,7 +25,7 @@
% end % end
% if repo.info.git_url: % if repo.info.git_url:
<tr> <tr>
<td class="category">repository</td> <td class="category">git clone </td>
<td>{{! '<br/>'.join(repo.info.git_url.split())}}</td> <td>{{! '<br/>'.join(repo.info.git_url.split())}}</td>
</tr> </tr>
% end % end