mirror of https://github.com/abpframework/abp.git
4 changed files with 82 additions and 57 deletions
@ -1,52 +1,46 @@ |
|||||
@using Microsoft.AspNetCore.Mvc.Localization |
@using Microsoft.AspNetCore.Mvc.Localization |
||||
@using Volo.Abp.Users |
@using Volo.Abp.Users |
||||
@using Volo.CmsKit.Localization |
@using Volo.CmsKit.Localization |
||||
@using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Rating |
|
||||
@inject ICurrentUser CurrentUser |
@inject ICurrentUser CurrentUser |
||||
@model Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Rating.RatingViewModel |
@model Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Rating.RatingViewModel |
||||
@inject IHtmlLocalizer<CmsKitResource> L |
@inject IHtmlLocalizer<CmsKitResource> L |
||||
|
|
||||
@section styles{ |
<div class="cms-rating-area container" data-entity-type="@Model.EntityType" data-entity-id="@Model.EntityId"> |
||||
<abp-style type="typeof(RatingStyleBundleContributor)" /> |
|
||||
} |
|
||||
|
|
||||
@section scripts{ |
|
||||
<abp-script type="typeof(RatingScriptBundleContributor)" /> |
|
||||
} |
|
||||
|
|
||||
<div class="cms-rating-area" data-entity-type="@Model.EntityType" data-entity-id="@Model.EntityId"> |
|
||||
@if (CurrentUser.IsAuthenticated) |
@if (CurrentUser.IsAuthenticated) |
||||
{ |
{ |
||||
<hr/> |
<div class="m-auto"> |
||||
<span class="my-rating-5" data-rating="@(Model.CurrentRating != null ? Model.CurrentRating.StarCount : 0)" data-authenticated="@(Model.CurrentRating != null)"></span> |
<span class="my-rating-5" data-rating="@(Model.CurrentRating != null ? Model.CurrentRating.StarCount : 0)" data-authenticated="@(Model.CurrentRating != null)"></span> |
||||
<span class="live-rating">@(Model.CurrentRating != null ? Model.CurrentRating.StarCount : 0)</span> |
<span class="live-rating">@(Model.CurrentRating != null ? Model.CurrentRating.StarCount + " | " : 0 + "")</span> |
||||
if (Model.CurrentRating != null) |
@if (Model.CurrentRating != null) |
||||
{ |
|
||||
<a href="#" class="rating-undo-link" data-id="@Model.CurrentRating.Id"> |
|
||||
<i class="fa fa-undo"></i> @L["Undo"] |
|
||||
</a> |
|
||||
} |
|
||||
<hr/> |
|
||||
<div class="container text-center"> |
|
||||
<h2 class="mb-5">All Stars</h2> |
|
||||
@if (Model.Ratings != null) |
|
||||
{ |
{ |
||||
<ul class="list-group"> |
<a href="#" class="rating-undo-link m-auto" data-id="@Model.CurrentRating.Id"> |
||||
@foreach (var rating in Model.Ratings) |
<i class="fa fa-undo"></i> @L["Undo"] |
||||
{ |
</a> |
||||
<li class="list-group-item d-flex justify-content-between align-items-center"> |
|
||||
@rating.StarCount @L["Stars"] |
|
||||
<span class="badge badge-primary badge-pill">@rating.Count</span> |
|
||||
</li> |
|
||||
} |
|
||||
</ul> |
|
||||
} |
} |
||||
</div> |
</div> |
||||
|
if (Model.Ratings != null) |
||||
|
{ |
||||
|
<div class="row text-center col-6 mt-3"> |
||||
|
@foreach (var rating in Model.Ratings) |
||||
|
{ |
||||
|
<div class="side col-2"> |
||||
|
<div>@rating.StarCount @L["Stars"]</div> |
||||
|
</div> |
||||
|
<div class="middle col-8"> |
||||
|
<div class="bar-container"> |
||||
|
<div class="bar bar-@rating.StarCount" style="width: @(rating.Count * 100 / Model.TotalRating)%"></div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="side col-2"> |
||||
|
<div>@rating.Count</div> |
||||
|
</div> |
||||
|
} |
||||
|
</div> |
||||
|
} |
||||
} |
} |
||||
else |
else |
||||
{ |
{ |
||||
<div class="float-right mb-2"> |
<span class="my-rating-5" data-authenticated="True" data-toggle="popover" data-placement="right" data-html="true" data-content="<div class='text-center'><a href='@Model.LoginUrl' class='btn btn-primary btn-block'>@L["LoginToRate"]</a></div>"></span> |
||||
<a href="@Model.LoginUrl" class="btn btn-primary">@L["LoginToRate"]</a> |
<span class="rating-login"></span> |
||||
</div> |
|
||||
} |
} |
||||
</div> |
</div> |
||||
@ -1 +1,44 @@ |
|||||
|
.side { |
||||
|
width: 15%; |
||||
|
margin-top:10px; |
||||
|
} |
||||
|
|
||||
|
.middle { |
||||
|
float: left; |
||||
|
width: 70%; |
||||
|
margin-top:10px; |
||||
|
padding-top: 4px; |
||||
|
} |
||||
|
|
||||
|
.row:after { |
||||
|
content: ""; |
||||
|
display: table; |
||||
|
clear: both; |
||||
|
} |
||||
|
|
||||
|
.bar-container { |
||||
|
width: 100%; |
||||
|
background-color: #f1f1f1; |
||||
|
text-align: center; |
||||
|
color: white; |
||||
|
} |
||||
|
|
||||
|
.bar { |
||||
|
height: 18px; |
||||
|
} |
||||
|
|
||||
|
/* Individual bars */ |
||||
|
.bar-5 { background-color: #173F5F; } |
||||
|
.bar-4 { background-color: #20639B; } |
||||
|
.bar-3 { background-color: #3CAEA3; } |
||||
|
.bar-2 { background-color: #F6D55C; } |
||||
|
.bar-1 { background-color: #ED553B; } |
||||
|
|
||||
|
@media (max-width: 400px) { |
||||
|
.side, .middle { |
||||
|
width: 100%; |
||||
|
} |
||||
|
.right { |
||||
|
display: none; |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue