display rt summary

This commit is contained in:
Luke Pulverenti 2013-05-06 00:50:40 -04:00
parent 4c30399fde
commit 70e4ec0669
5 changed files with 48 additions and 16 deletions

View File

@ -128,6 +128,21 @@
display: inline-block;
}
.criticRatingSummary {
padding: 5px;
font-size: 13px;
background: #555;
margin-top: 1em;
}
.criticRatingSummaryHeader {
text-transform: uppercase;
margin-bottom: 5px;
display: block;
}
@media all and (min-width: 750px) {
.galleryImage {
@ -245,7 +260,7 @@
.detailPageName .itemMiscInfo {
margin-left: 1.5em;
font-family: Arial;
color: #bbb;
color: #ccc;
}
.itemMediaInfo {

View File

@ -40,11 +40,11 @@
</div>
<div data-role="fieldcontain">
<label for="txtCommunityRating">Community rating:</label>
<input type="number" id="txtCommunityRating" name="txtCommunityRating" step=".1" data-mini="true" min="0" max="10" />
<input type="number" id="txtCommunityRating" name="txtCommunityRating" step=".1" data-mini="true" />
</div>
<div data-role="fieldcontain">
<label for="txtCriticRating">Critic rating:</label>
<input type="number" id="txtCriticRating" name="txtCriticRating" step=".1" data-mini="true" min="0" max="10" />
<input type="number" id="txtCriticRating" name="txtCriticRating" step=".1" data-mini="true" />
</div>
<div data-role="fieldcontain">
<label for="txtCriticRatingSummary">Critic rating summary:</label>

View File

@ -123,14 +123,21 @@
<p id="itemCommunityRating"></p>
<p id="itemTagline" style="font-style: italic;"></p>
<p id="itemOverview"></p>
<p id="itemRatings" class="userDataIcons"></p>
<p id="itemPremiereDate"></p>
<p id="itemBudget"></p>
<p id="itemRevenue"></p>
<p id="itemGenres"></p>
<p id="itemStudios"></p>
<p id="itemLinks"></p>
<p id="criticRatingSummary" class="criticRatingSummary" style="display: none;">
<span class="criticRatingSummaryHeader">What the critics say</span>
<span id="criticRatingSummaryText"></span>
</p>
</div>
</div>
<div id="itemSongs"></div>

View File

@ -203,7 +203,7 @@
LibraryBrowser.renderOverview($('#itemOverview', page), item);
if (item.CommunityRating) {
if (item.CommunityRating || item.CriticRating) {
$('#itemCommunityRating', page).html(LibraryBrowser.getRatingHtml(item)).show();
} else {
$('#itemCommunityRating', page).hide();
@ -225,6 +225,14 @@
LibraryBrowser.renderStudios($('#itemStudios', page), item, context);
renderUserDataIcons(page, item);
LibraryBrowser.renderLinks($('#itemLinks', page), item);
if (item.CriticRatingSummary) {
$('#criticRatingSummary', page).show();
$('#criticRatingSummaryText', page).html(item.CriticRatingSummary);
} else {
$('#criticRatingSummary', page).hide();
}
}
function renderChildren(page, item) {

View File

@ -813,9 +813,11 @@
getRatingHtml: function (item) {
var html = "";
if (item.CommunityRating) {
var rating = item.CommunityRating / 2;
var html = "";
for (var i = 1; i <= 5; i++) {
if (rating < i - 1) {
html += "<div class='starRating emptyStarRating' title='" + item.CommunityRating + "'></div>";
@ -827,6 +829,7 @@
html += "<div class='starRating' title='" + item.CommunityRating + "'></div>";
}
}
}
if (item.Type == "Movie" && item.CriticRating != null) {
@ -837,7 +840,6 @@
}
html += '<div class="criticRating">' + item.CriticRating + '%</div>';
}
return html;