Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LPS-65309 Ratings #267

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 8 additions & 8 deletions portal-web/docroot/html/taglib/ui/ratings/page.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -140,23 +140,23 @@ if (ratingsEntry != null) {
<liferay-util:whitespace-remover>

<%
int positiveVotes = (int)ratingsStats.getTotalScore();
int positiveVotes = (int)Math.round(ratingsStats.getTotalScore());
int negativeVotes = ratingsStats.getTotalEntries() - positiveVotes;
%>

<c:choose>
<c:when test="<%= !themeDisplay.isSignedIn() || TrashUtil.isInTrash(className, classPK) %>">
<span class="glyphicon glyphicon-thumbs-up rating-element rating-thumb-up rating-<%= (yourScore > 0) ? "on" : "off" %>" title="<liferay-ui:message key="ratings-are-disabled-because-this-entry-is-in-the-recycle-bin" />"><%= positiveVotes %></span>
<span class="glyphicon glyphicon-thumbs-up rating-element rating-thumb-up rating-<%= (yourScore >= 0.5) ? "on" : "off" %>" title="<liferay-ui:message key="ratings-are-disabled-because-this-entry-is-in-the-recycle-bin" />"><%= positiveVotes %></span>

<c:if test="<%= type.equals(RatingsType.THUMBS.getValue()) %>">
<span class="glyphicon glyphicon-thumbs-down rating-element rating-thumb-down rating-<%= (yourScore == 0) ? "on" : "off" %>" title="<liferay-ui:message key="ratings-are-disabled-because-this-entry-is-in-the-recycle-bin" />"><%= negativeVotes %></span>
<span class="glyphicon glyphicon-thumbs-down rating-element rating-thumb-down rating-<%= (yourScore < 0.5) ? "on" : "off" %>" title="<liferay-ui:message key="ratings-are-disabled-because-this-entry-is-in-the-recycle-bin" />"><%= negativeVotes %></span>
</c:if>
</c:when>
<c:otherwise>
<a class="glyphicon glyphicon-thumbs-up rating-element rating-thumb-up rating-<%= (yourScore > 0) ? "on" : "off" %>" href="javascript:;"><%= positiveVotes %></a>
<a class="glyphicon glyphicon-thumbs-up rating-element rating-thumb-up rating-<%= (yourScore >= 0.5) ? "on" : "off" %>" href="javascript:;"><%= positiveVotes %></a>

<c:if test="<%= type.equals(RatingsType.THUMBS.getValue()) %>">
<a class="glyphicon glyphicon-thumbs-down rating-element rating-thumb-down rating-<%= (yourScore == 0) ? "on" : "off" %>" href="javascript:;"><%= negativeVotes %></a>
<a class="glyphicon glyphicon-thumbs-down rating-element rating-thumb-down rating-<%= (yourScore < 0.5) ? "on" : "off" %>" href="javascript:;"><%= negativeVotes %></a>
</c:if>

<div class="rating-input-container">
Expand All @@ -167,10 +167,10 @@ if (ratingsEntry != null) {
String positiveRatingMessage = null;

if (type.equals(RatingsType.THUMBS.getValue())) {
positiveRatingMessage = (yourScore > 0) ? "you-have-rated-this-as-good" : "rate-this-as-good";
positiveRatingMessage = (yourScore >= 0.5) ? "you-have-rated-this-as-good" : "rate-this-as-good";
}
else {
positiveRatingMessage = (yourScore > 0) ? "unlike-this" : "like-this";
positiveRatingMessage = (yourScore >= 0.5) ? "unlike-this" : "like-this";
}
%>

Expand All @@ -184,7 +184,7 @@ if (ratingsEntry != null) {
ratingId = PortalUtil.generateRandomKey(request, "taglib_ui_ratings_page_rating");
%>

<label for="<%= ratingId %>"><liferay-ui:message key='<%= (yourScore == 0) ? "you-have-rated-this-as-bad" : "rate-this-as-bad" %>' /></label>
<label for="<%= ratingId %>"><liferay-ui:message key='<%= (yourScore < 0.5) ? "you-have-rated-this-as-bad" : "rate-this-as-bad" %>' /></label>

<input class="rating-input" id="<%= ratingId %>" name="<portlet:namespace /><%= ratingIdPrefix %>" type="radio" value="down">
</c:if>
Expand Down