Skip to content

Commit

Permalink
gravatar added to content block
Browse files Browse the repository at this point in the history
  • Loading branch information
ignatov committed Jul 25, 2011
1 parent 0960efd commit b7f9bdc
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ class Content extends LongKeyedMapper[Content] with IdPK {
case _ => NodeSeq.Empty
}

/** Author's email. */
def authorEmail = User.find(user.is) match {
case Full(u) => u.email.is
case _ => ""
}

/** Get change author's username and date. */
def userNameDate: String = "%s by %s".format(dateFormatter(dateTime.is), userName)

Expand Down
2 changes: 2 additions & 0 deletions src/main/scala/scala/tools/colladoc/page/Template.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import tools.nsc.doc.model._
import xml.{NodeSeq, Text}
import lib.DependencyFactory._
import tools.nsc.util.NoPosition
import net.liftweb.widgets.gravatar.Gravatar

/**
* Page containing template entity documentation and user controls.
Expand Down Expand Up @@ -313,6 +314,7 @@ class Template(tpl: DocTemplateEntity) extends tools.nsc.doc.html.page.Template(
/** Render content comment. */
def contentToHtml(c: Content) =
<li id={"content_comment_" + c.id} class="content_comment">
<div class="content_avatar">{Gravatar(c.authorEmail, 20)}</div>
<div class="content_content">{bodyToHtml(parseWiki(c.comment.is, NoPosition))}</div>
<div class="content_info">
<span class="datetime" title={c.atomDateTime}>{c.humanDateTime}</span>
Expand Down
20 changes: 19 additions & 1 deletion src/main/webapp/cotemplate.css
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,28 @@ background-color: #E5E5E5;
}

.content_comment {
margin: 7px 0;
margin: 20px 20px 20px 0;
list-style: none;
}

.content_content {
margin-left: 30px;
}

#add_content_button {
margin-left: 20px;
}

#content_thread {
margin-left: 20px;
}

.content_info {
color: #999999;
margin-top: 10px;
margin-left: 30px;
}

.content_avatar {
float: left;
}

0 comments on commit b7f9bdc

Please sign in to comment.