Skip to content

Commit

Permalink
introduced floating line for new comments on proposals
Browse files Browse the repository at this point in the history
  • Loading branch information
fcamblor committed Feb 12, 2022
1 parent 0a28d24 commit 865412b
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 38 deletions.
8 changes: 8 additions & 0 deletions app/assets/css/cfp.less
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,14 @@ div.chat_list {
background-color: #f6f6f6;
}

div.chat_new_comments_indicator {
text-align: center;
background-color: #f6f6f6;
border-top: 1px solid red;
color: red;
border-bottom: 1px solid red;
}

div.chat_people {
overflow: hidden;
clear: both;
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/CFPAdmin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ object CFPAdmin extends SecureCFPController {
val proposalsByAuths = allProposalByProposal(proposal)
val userWatchPref = ProposalUserWatchPreference.proposalUserWatchPreference(proposal.id, userId)
val maybeDelayedReviewReason = Review.proposalDelayedReviewReason(userId, proposal.id)
views.html.CFPAdmin.showProposal(proposal, proposalsByAuths, speakerDiscussion, internalDiscussion, msgToSpeakerForm, msgInternalForm, voteForm, maybeMyVote, maybeMyPreviousVote, userId, userWatchPref, maybeDelayedReviewReason)
val proposalLastVisit = Proposal.userProposalLastVisits(userId).get(proposal.id)
views.html.CFPAdmin.showProposal(proposal, proposalsByAuths, speakerDiscussion, internalDiscussion, msgToSpeakerForm, msgInternalForm, voteForm, maybeMyVote, maybeMyPreviousVote, userId, userWatchPref, maybeDelayedReviewReason, proposalLastVisit)
}

def openForReview(proposalId: String) = SecuredAction(IsMemberOf("cfp")) {
Expand Down
6 changes: 3 additions & 3 deletions app/views/CFPAdmin/showProposal.scala.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@(proposal: Proposal, proposalsByAuths: Map[String, Map[String, Proposal]], speakerComments: List[Comment], internalComments: List[Comment], msgToSpeakerForm: Form[String], msgInternalForm: Form[String], voteForm: Form[Int], maybeMyVote: Option[Review], maybeMyPreviousVote: Option[Review], currentUser: String, userWatchPref: ProposalUserWatchPreference, maybeVoteDelayedReason: Option[String])(implicit flash: Flash, lang: Lang, req: RequestHeader)
@(proposal: Proposal, proposalsByAuths: Map[String, Map[String, Proposal]], speakerComments: List[Comment], internalComments: List[Comment], msgToSpeakerForm: Form[String], msgInternalForm: Form[String], voteForm: Form[Int], maybeMyVote: Option[Review], maybeMyPreviousVote: Option[Review], currentUser: String, userWatchPref: ProposalUserWatchPreference, maybeVoteDelayedReason: Option[String], proposalLastVisit: Option[org.joda.time.DateTime])(implicit flash: Flash, lang: Lang, req: RequestHeader)

@main("[CFP] " + proposal.id + "/" + proposal.title) {
<div class="row">
Expand Down Expand Up @@ -258,7 +258,7 @@ <h4 class="text-light"><i class="far fa-comments"></i> @Messages("admin.sp.commi
}
</div>
<div class="card-body">
@tags.renderComments(speakerComments)
@tags.renderComments(speakerComments, proposalLastVisit)
</div>
</div>
</div>
Expand Down Expand Up @@ -306,7 +306,7 @@ <h4><i class="fas fa-comments"></i> @Messages("admin.sp.internal")</h4>
}
</div>
<div class="card-body">
@tags.renderComments(internalComments)
@tags.renderComments(internalComments, proposalLastVisit)
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion app/views/CallForPaper/showCommentForProposal.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ <h3><i class="fas fa-bullhorn"></i> @Messages("comment.proposal")</h3>
</div>

<div class="card-body">
@tags.renderComments(comments)
@tags.renderComments(comments, None)
</div>
</div>
</div>
Expand Down
73 changes: 40 additions & 33 deletions app/views/tags/renderComments.scala.html
Original file line number Diff line number Diff line change
@@ -1,35 +1,42 @@
@(comments: List[models.Comment])
@comments.map { c =>
@models.Speaker.findByUUID(c.uuidAuthor).map { speaker =>
@models.Webuser.findByUUID(c.uuidAuthor).map { webuser =>
<div class="chat_list">
<div class="chat_people">
<div class="chat_img">
@if(speaker.avatarUrl.isEmpty) {
<img class="media-object" width="35" src="//www.gravatar.com/avatar/@Webuser.gravatarHash(webuser.email)?s=35" alt="@webuser.cleanName" title="@webuser.cleanName"/>
} else {
<img class="media-object" width="35" src="@speaker.avatarUrl.get" alt="@webuser.cleanName" title="@webuser.cleanName"/>
}
</div>
<div class="chat_ib">
<h5>
<a href="@routes.CFPAdmin.showSpeakerAndTalks(c.uuidAuthor)">@webuser.cleanName</a>
<span class="chat_date"> @Messages("tags.renderComment.postedBy",
library.FormatDate.jodaDateFormat(c.eventDate.get, play.api.i18n.Lang.defaultLang),
library.FormatDate.jodaTimeFormat(c.eventDate.get, play.api.i18n.Lang.defaultLang))</span>
</h5>
@defining(c.msg.replaceAll("script", ".script").replaceAll("\n", "<br>")) { message: String =>
<p>@Html(message)</p>
@models.Proposal.ProposalIDRegExp.findAllIn(message).map { proposalIdRef =>
<p>@tags.linkToProposal(proposalIdRef)</p>
}
@models.Proposal.HttpUrl.findAllIn(message).map { test =>
<p><a href="@test" target="_blank"><i class="fas fa-external-link"></i> @test</a></p>
}
}
</div>
</div>
</div>
}
@(comments: List[models.Comment], maybeProposalLastVisit: Option[org.joda.time.DateTime])
@defining(comments.reverse.find{ comment => maybeProposalLastVisit.map { proposalLastVisit => proposalLastVisit.isBefore(comment.eventDate.get) }.getOrElse(true) }){ maybeFirstUnwatchedComment: Option[Comment] =>
@comments.zipWithIndex.map{ case (c, index) =>
@models.Speaker.findByUUID(c.uuidAuthor).map { speaker =>
@models.Webuser.findByUUID(c.uuidAuthor).map { webuser =>
<div class="chat_list">
<div class="chat_people">
<div class="chat_img">
@if(speaker.avatarUrl.isEmpty) {
<img class="media-object" width="35" src="//www.gravatar.com/avatar/@Webuser.gravatarHash(webuser.email)?s=35" alt="@webuser.cleanName" title="@webuser.cleanName"/>
} else {
<img class="media-object" width="35" src="@speaker.avatarUrl.get" alt="@webuser.cleanName" title="@webuser.cleanName"/>
}
</div>
<div class="chat_ib">
<h5>
<a href="@routes.CFPAdmin.showSpeakerAndTalks(c.uuidAuthor)">@webuser.cleanName</a>
<span class="chat_date"> @Messages("tags.renderComment.postedBy",
library.FormatDate.jodaDateFormat(c.eventDate.get, play.api.i18n.Lang.defaultLang),
library.FormatDate.jodaTimeFormat(c.eventDate.get, play.api.i18n.Lang.defaultLang))</span>
</h5>
@defining(c.msg.replaceAll("script", ".script").replaceAll("\n", "<br>")) { message: String =>
<p>@Html(message)</p>
@models.Proposal.ProposalIDRegExp.findAllIn(message).map { proposalIdRef =>
<p>@tags.linkToProposal(proposalIdRef)</p>
}
@models.Proposal.HttpUrl.findAllIn(message).map { test =>
<p><a href="@test" target="_blank"><i class="fas fa-external-link"></i> @test</a></p>
}
}
</div>
</div>
</div>
@if(maybeFirstUnwatchedComment.map(c == _).getOrElse(false)) {
<div class="chat_new_comments_indicator">
<i class="fas fa-arrow-alt-circle-up"></i> Nouveaux messages <i class="fas fa-arrow-alt-circle-up"></i>
</div>
}
}
}
}
}

0 comments on commit 865412b

Please sign in to comment.