Re: [PATCH 2/3] gitweb: decorate a bit more remotes
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Dec 20, 2010, 20:02 UTC
- Message-ID
- <20101220200203.GA24163@burratino>
- In-Reply-To
- <1292871681-4818-3-git-send-email-sylvain@abstraction.fr>
Sylvain Rabot wrote:
Show 13 quoted lines
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -5127,13 +5127,13 @@ sub git_remote_block {
>
> if (defined $fetch) {
> if ($fetch eq $push) {
> - $urls_table .= format_repo_url("URL", $fetch);
> + $urls_table .= format_repo_url("<span class=\"bold\">URL:</span>", $fetch);
> } else {
> - $urls_table .= format_repo_url("Fetch URL", $fetch);
> - $urls_table .= format_repo_url("Push URL", $push) if defined $push;
> + $urls_table .= format_repo_url("<span class=\"bold\">Fetch URL:</span>", $fetch);
> + $urls_table .= format_repo_url("<span class=\"bold\">Push URL:</span>", $push) if defined $push;This makes the formatting of the remote URLs table inconsistent with the other projects_list table (namely the
description ... homepage URL ... repository URL ... owner ... last change ...
table on a repository's summary page). Is that the right thing to do?
If so, maybe something like the following would make sense.
-- 8< -- From: Sylvain Rabot <sylvain@abstraction.fr> Date: Mon, 20 Dec 2010 20:01:20 +0100 Subject: gitweb: decorate a bit more remotes
Put the text "URL" introducing a remote's url in bold and follow it with a colon. This makes the url list easier to visually scan.
Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> --- The justification above is totally made up; I have not checked to see whether it makes the table easier or harder to read. Also: untested.
Maybe the $url part should be esc_url($url)?
gitweb/gitweb.perl | 16 ++++++++++------ gitweb/static/gitweb.css | 13 +++++++++++++ 2 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index d521c93..b870b56 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -3862,7 +3862,11 @@ sub git_print_header_div { sub format_repo_url { my ($name, $url) = @_; - return "<tr class=\"metadata_url\"><td>$name</td><td>$url</td></tr>\n"; + my $row = "<tr class=\"metadata_url\">"; + $row .= ($name eq "" ? "<td></td>" : "<td class=\"metadata_tag\">$name</td>"); + $row .= "<td>$url</td>"; + $row .= "</tr>\n"; + return $row; } # Group output by placing it in a DIV element and adding a header. @@ -5122,7 +5126,7 @@ sub git_remote_block { my $fetch = $rdata->{'fetch'}; my $push = $rdata->{'push'}; - my $urls_table = "<table class=\"projects_list\">\n" ; + my $urls_table = "<table class=\"remote_urls\">\n" ; if (defined $fetch) { if ($fetch eq $push) { @@ -5368,10 +5372,10 @@ sub git_summary { print "<div class=\"title\"> </div>\n"; print "<table class=\"projects_list\">\n" . - "<tr id=\"metadata_desc\"><td>description</td><td>" . esc_html($descr) . "</td></tr>\n" . - "<tr id=\"metadata_owner\"><td>owner</td><td>" . esc_html($owner) . "</td></tr>\n"; + "<tr id=\"metadata_desc\"><td class=\"metadata_tag\">description</td><td>" . esc_html($descr) . "</td></tr>\n" . + "<tr id=\"metadata_owner\"><td class=\"metadata_tag\">owner</td><td>" . esc_html($owner) . "</td></tr>\n"; if (defined $cd{'rfc2822'}) { - print "<tr id=\"metadata_lchange\"><td>last change</td><td>$cd{'rfc2822'}</td></tr>\n"; + print "<tr id=\"metadata_lchange\"><td class=\"metadata_tag\">last change</td><td>$cd{'rfc2822'}</td></tr>\n"; } # use per project git URL list in $projectroot/$project/cloneurl @@ -5390,7 +5394,7 @@ sub git_summary { if ($show_ctags) { my $ctags = git_get_project_ctags($project); my $cloud = git_populate_project_tagcloud($ctags); - print "<tr id=\"metadata_ctags\"><td>Content tags:<br />"; + print "<tr id=\"metadata_ctags\"><td class=\"metadata_tag\">Content tags:<br />"; print "</td>\n<td>" unless %$ctags; print "<form action=\"$show_ctags\" method=\"post\"><input type=\"hidden\" name=\"p\" value=\"$project\" />Add: <input type=\"text\" name=\"t\" size=\"8\" /></form>"; print "</td>\n<td>" if %$ctags; diff --git a/gitweb/static/gitweb.css b/gitweb/static/gitweb.css index 79d7eeb..feb09e5 100644 --- a/gitweb/static/gitweb.css +++ b/gitweb/static/gitweb.css @@ -579,6 +579,19 @@ div.remote { display: inline-block; } +/* + * <b>URL:</b> http://www.example.com/ + * <b>Fetch URL:</b> http://www.example.com/ + * <b>Push URL:</b> http://www.example.com/ + */ +table.remote_urls tr.metadata_url td.metadata_tag:after { + content: ":" +} + +table.remote_urls tr.metadata_url td.metadata_tag { + font-weight: bold; +} + /* Style definition generated by highlight 2.4.5, http://www.andre-simon.de/ */ /* Highlighting theme definition: */
-- 1.7.2.3.554.gc9b5c.dirty