Skip to content

Commit

Permalink
Merge pull request #2084 from robertmuehsig/224-pluralize
Browse files Browse the repository at this point in the history
Enhancement for #224
  • Loading branch information
analogrelay committed May 7, 2014
2 parents 913ed76 + 57ddfea commit 27455dc
Showing 1 changed file with 71 additions and 55 deletions.
126 changes: 71 additions & 55 deletions src/NuGetGallery/Views/Users/Packages.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -39,69 +39,85 @@ else

@helper PrintPublishedPackages(IEnumerable<PackageViewModel> packages, bool unlisted)
{
var totlalDownloads = 0;
<table class="sexy-table">
<thead>
<tr>
<th class="first actions">Actions</th>
<th>Package</th>
<th>Package ID</th>
<th>Description</th>
<th class="last">Downloads</th>
var totalDownloads = 0;
var totalPackages = packages.Count();

if (totalPackages > 0)
{
<table class="sexy-table">
<thead>
<tr>
<th class="first actions">Actions</th>
<th>Package</th>
<th>Package ID</th>
<th>Description</th>
<th class="last">Downloads</th>

</tr>
</thead>
<tbody>
@foreach (var package in packages)
{
<tr>
<td class="actions">
@if (unlisted)
{
<a href="@Url.DeletePackage(package)" title="List Package" class="table-action-link">
<i class="icon-share"></i>
</a>
}
else
{
<a href="@Url.EditPackage(package.Id, package.Version)" title="Edit" class="table-action-link">
<i class="icon-edit"></i>
</a>
<a href="@Url.DeletePackage(package)" title="Delete" class="table-action-link">
<i class="icon-trash"></i>
</a>
}
</td>
<td>
<a href="@Url.Package(package)" title="View package page.">@package.Title</a>
</td>
<td>@package.Id</td>
<td>
@if (String.IsNullOrEmpty(package.Description) || package.Description.Length < 65)
{
@package.Description
}
else
{
@package.Description.Substring(0, 65)
<a href="@Url.Package(package)" title="View package page.">...</a>
}
</td>

</tr>
</thead>
<tbody>
@foreach (var package in packages)
{
<td>@package.DownloadCount</td>
</tr>
totalDownloads += package.DownloadCount;
}
</tbody>
<tfoot>
<tr>
<td class="actions">
@if (unlisted)
<td colspan="4">
@if (totalPackages > 1)
{
<a href="@Url.DeletePackage(package)" title="List Package" class="table-action-link">
<i class="icon-share"></i>
</a>
@(string.Format("You have a total of {0} packages.", totalPackages))
}
else
{
<a href="@Url.EditPackage(package.Id, package.Version)" title="Edit" class="table-action-link">
<i class="icon-edit"></i>
</a>
<a href="@Url.DeletePackage(package)" title="Delete" class="table-action-link">
<i class="icon-trash"></i>
</a>
@("You have one package.")
}
</td>
<td>
<a href="@Url.Package(package)" title="View package page.">@package.Title</a>
<td class="total">
@totalDownloads
</td>
<td>@package.Id</td>
<td>
@if (String.IsNullOrEmpty(package.Description) || package.Description.Length < 65)
{
@package.Description
}
else
{
@package.Description.Substring(0, 65)
<a href="@Url.Package(package)" title="View package page.">...</a>
}
</td>

<td>@package.DownloadCount</td>
</tr>
totlalDownloads += package.DownloadCount;
}
</tbody>
<tfoot>
<tr>
<td colspan="4">
You have a total of @packages.Count() package(s).
</td>
<td class="total">
@totlalDownloads
</td>
</tr>
</tfoot>
</table>
</tfoot>
</table>
}
else
{
<p><b>You don't have any packages here.</b></p>
}
}

0 comments on commit 27455dc

Please sign in to comment.