Skip to content

Commit

Permalink
"Version and default version select boxes should be slightly wider" c…
Browse files Browse the repository at this point in the history
…losed [#133 state:resolved]
  • Loading branch information
ignatov committed Aug 12, 2011
1 parent e39a6ed commit 429bcb4
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/main/scala/scala/tools/colladoc/lib/js/JqUI.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ object JqUI {
}

/** Convert selected element to select menu. */
case class SelectMenu(width: Int = 225) extends JsExp with JsMember {
case class SelectMenu(width: Int = 250) extends JsExp with JsMember {
override def toJsCmd = "selectmenu({ width: " + width.toString + " })"
}

Expand Down
20 changes: 19 additions & 1 deletion src/main/scala/scala/tools/colladoc/model/mapper/Comment.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import net.liftweb.mapper._
import net.liftweb.util.Helpers._

import tools.nsc.doc.model.MemberEntity
import xml.NodeSeq

/**
* Mapper for comment table storing documentation changes.
Expand Down Expand Up @@ -73,10 +74,20 @@ class Comment extends LongKeyedMapper[Comment] with IdPK {
case _ => ""
}

/** Link to user's profile. */
def authorProfileHyperlink = User.find(user.is) match {
case Full(u) => u.profileHyperlink
case _ => NodeSeq.Empty
}

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

def atomDateTime: String = atomDateFormatter(dateTime.is).toString

def humanDateTime: String = dateFormatter(dateTime.is).toString

/**
* Comment representation for Atom.
* @return Atom entry for comment
Expand Down Expand Up @@ -137,7 +148,14 @@ object Comment extends Comment with LongKeyedMetaMapper[Comment]
*/
def revisions(qualName: String, valid: Boolean = true) = {
val cmts = changeSets(findAll(By(qualifiedName, qualName), By(Comment.valid, valid), OrderBy(Comment.dateTime, Descending)))
cmts.map{ c => (c.id.is.toString, c.userNameDate) }
cmts.map{ c =>
(c.id.is.toString,
<xml:group>
<span class="datetime" title={c.atomDateTime}>{c.humanDateTime}</span>
by
<span class="author">{c.userName}</span>
</xml:group>.toString)
}
}

/**
Expand Down
12 changes: 6 additions & 6 deletions src/main/scala/scala/tools/colladoc/page/Template.scala
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ class Template(tpl: DocTemplateEntity) extends tools.nsc.doc.html.page.Template(
}
index.vend.reindexEntityComment(mbr)
val m = Model.factory.copyMember(mbr, cmt)(c)
Replace(id(mbr, "full"), memberToCommentBodyHtml(m, isSelf)) & Run("reinit('#" + id(m, "full") + "')") &
Replace(id(mbr, "full"), memberToCommentBodyHtml(m, isSelf)) & Run("reinit('#" + id(m, "full") + "')") & PrettyDate &
(if (!isSelf) JqId(Str(id(mbr, "short"))) ~> JqHtml(inlineToHtml(cmt.short)) ~> JqAttr("id", id(m, "short")) else Noop)
} else
Noop
Expand Down Expand Up @@ -629,7 +629,7 @@ class Template(tpl: DocTemplateEntity) extends tools.nsc.doc.html.page.Template(
}
val m = Model.factory.copyMember(mbr, cmt)(c)

Replace(id(mbr, "full"), memberToCommentBodyHtml(m, isSelf)) & Run("reinit('#" + id(m, "full") + "')") &
Replace(id(mbr, "full"), memberToCommentBodyHtml(m, isSelf)) & Run("reinit('#" + id(m, "full") + "')") & PrettyDate &
(if (!isSelf) JqId(Str(id(mbr, "short"))) ~> JqHtml(inlineToHtml(cmt.short)) ~> JqAttr("id", id(m, "short")) else JsCmds.Noop)
}
val revs = Comment.revisions(mbr.uniqueName) ::: ("source", "Source Comment") :: Nil
Expand All @@ -644,7 +644,7 @@ class Template(tpl: DocTemplateEntity) extends tools.nsc.doc.html.page.Template(
case _ =>
}

Replace(id(mbr, "full"), memberToCommentBodyHtml(mbr, isSelf)) & Run("reinit('#" + id(mbr, "full") + "')") &
Replace(id(mbr, "full"), memberToCommentBodyHtml(mbr, isSelf)) & Run("reinit('#" + id(mbr, "full") + "')") & PrettyDate &
(if (!isSelf) SetHtml(id(mbr, "short"), inlineToHtml(mbr.comment.get.short)) else JsCmds.Noop)
}
val revs = ("source", "Select default") :: Comment.revisions(mbr.uniqueName)
Expand Down Expand Up @@ -693,7 +693,7 @@ class Template(tpl: DocTemplateEntity) extends tools.nsc.doc.html.page.Template(
// TODO: mbr.comment.update(original)
}
val m = Model.factory.copyMember(mbr, cmt)(c)
Replace(id(mbr, "full"), memberToCommentBodyHtml(m, isSelf)) & Run("reinit('#" + id(m, "full") + "')") &
Replace(id(mbr, "full"), memberToCommentBodyHtml(m, isSelf)) & Run("reinit('#" + id(m, "full") + "')") & PrettyDate &
(if (!isSelf) JqId(Str(id(mbr, "short"))) ~> JqHtml(inlineToHtml(cmt.short)) ~> JqAttr("id", id(m, "short")) else JsCmds.Noop)
}

Expand Down Expand Up @@ -734,12 +734,12 @@ class Template(tpl: DocTemplateEntity) extends tools.nsc.doc.html.page.Template(
if (Model.reporter.hasWarnings)
JqId(Str(id(mbr, "text"))) ~> AddClass("ui-state-error")
else
Replace(id(mbr, "form"), memberToCommentBodyHtml(mbr, isSelf)) & Run("reinit('#" + id(mbr, "full") + "')") &
Replace(id(mbr, "form"), memberToCommentBodyHtml(mbr, isSelf)) & Run("reinit('#" + id(mbr, "full") + "')") & PrettyDate &
(if (!isSelf) SetHtml(id(mbr, "short"), inlineToHtml(mbr.comment.get.short)) else JsCmds.Noop)

/** Cancel member entity comment modifications. */
private def cancel(mbr: MemberEntity, isSelf: Boolean): JsCmd =
Replace(id(mbr, "form"), memberToCommentBodyHtml(mbr, isSelf)) & Run("reinit('#" + id(mbr, "full") + "')")
Replace(id(mbr, "form"), memberToCommentBodyHtml(mbr, isSelf)) & Run("reinit('#" + id(mbr, "full") + "')") & PrettyDate

/** Update member entity after comment has been changed. */
private def update(mbr: MemberEntity, docStr: String) = Model.synchronized {
Expand Down
8 changes: 8 additions & 0 deletions src/main/webapp/cotemplate.css
Original file line number Diff line number Diff line change
Expand Up @@ -203,4 +203,12 @@ label.error {
.regular_button > span {
font-weight: normal;
color: #555;
}

span.datetime {
display: inline-block !important;
}

span.author {
display: inline-block !important;
}
6 changes: 4 additions & 2 deletions src/main/webapp/scripts/coindex.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ $(document).ready(function() {
}
});

$(".direct a").live("click", function(){
$(".direct a").live("click", function() {
var id = $(this).attr('id');
var link = '';
switch (id) {
Expand All @@ -131,7 +131,9 @@ $(document).ready(function() {
}
$("#openid_identifier").val(link);
openid_form.submit();
});
});

prettyDate();
});

function resizeFilterBlock() {
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/scripts/cosearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ function infiniteScroll(){
$("#recCount").text(parseInt(recText) + newNum);

var combos=$(result).find("select");
combos.selectmenu({width:225});
combos.selectmenu({width:250});

// append new elements to results page
$("#searchResults").append(result.children());
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/scripts/cotemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function shortcut_enable(){

function reinit(selector) {
$('.button', $(selector)).button();
$('.select', $(selector)).selectmenu({ width: 225 });
$('.select', $(selector)).selectmenu({ width: 250 });
$('.menu', $(selector)).each(function() {
$(this).next().menu({ input: $(this) }).hide();
}).click(function(event) {
Expand Down
1 change: 0 additions & 1 deletion src/main/webapp/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<script src="/scripts/markitup/jquery.markitup.js" type="text/javascript" />
<script src="/scripts/markitup/jquery.markitup.set.js" type="text/javascript" />
<script src="/scripts/cotemplate.js" type="text/javascript"/>
<script src="/scripts/jquery.prettydate.js" type="text/javascript"/>
<link href="/lib/template.css" media="screen" type="text/css" rel="stylesheet" />
<link href="/scripts/markitup/jquery.markitup.css" media="screen" type="text/css" rel="stylesheet"/>
<link href="/scripts/markitup/jquery.markitup.set.css" media="screen" type="text/css" rel="stylesheet"/>
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/templates-hidden/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<script src="/scripts/ui/jquery.ui.selectmenu.js" type="text/javascript" />
<script src="/scripts/ui/ui.notify.js" type="text/javascript" />
<script src="/scripts/jquery.validate.js" type="text/javascript"/>
<script src="/scripts/jquery.prettydate.js" type="text/javascript"/>
<link href="/scripts/ui/css/scaladoc/jquery-ui.css" media="screen" type="text/css" rel="stylesheet"/>
<link href="/scripts/ui/jquery.ui.selectmenu.css" media="screen" type="text/css" rel="stylesheet"/>
<link href="/scripts/ui/ui.notify.css" media="screen" type="text/css" rel="stylesheet"/>
Expand Down

0 comments on commit 429bcb4

Please sign in to comment.