HistoryView: Factor out email formatting

The patches to show the committer's name depend on this.
This commit is contained in:
Benjamin Kramer
2009-03-24 19:44:29 +01:00
parent f3c131ecde
commit 5ff9620ec2
+5 -2
View File
@@ -223,8 +223,11 @@ var enableFeatures = function()
var loadExtendedCommit = function(commit)
{
if (commit.author_email)
$("authorID").innerHTML = commit.author_name + " &lt;<a href='mailto:" + commit.author_email + "'>" + commit.author_email + "</a>&gt;";
var formatEmail = function(name, email) {
return email ? name + " &lt;<a href='mailto:" + email + "'>" + email + "</a>&gt;" : name;
}
$("authorID").innerHTML = formatEmail(commit.author_name, commit.author_email);
$("date").innerHTML = commit.author_date;
$("message").innerHTML = commit.message.replace(/\n/g,"<br>");