Skip to content

Commit d8029b6

Browse files
author
matt4446
committed
Improved admin menu preview
1 parent 76b122e commit d8029b6

File tree

2 files changed

+32
-8
lines changed

2 files changed

+32
-8
lines changed

Controllers/ServiceController.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ public ServiceController(
4545
public ActionResult Index()
4646
{
4747
var viewModel = new ViewModel.AdminIndexViewModel();
48-
viewModel.Items = this.Services.ContentManager.Query<Orchard.Projections.Models.QueryPart>().List().ToList();
48+
var queries = this.Services.ContentManager.Query<Orchard.Projections.Models.QueryPart>()
49+
.List()
50+
.ToList();
51+
52+
viewModel.Items = queries.Where(e => e.Layouts.Any(layout => layout.Category.IndexOf("JSON", StringComparison.InvariantCultureIgnoreCase) >= 0))
53+
.ToList();
4954

5055
return View(viewModel);
5156
}

Views/Service/index.cshtml

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,27 @@
11
@model JsonProjection.ViewModel.AdminIndexViewModel
2-
<h2>Feeds</h2>
3-
<ul>
4-
@foreach (var item in Model.Items)
5-
{
6-
<li>@Html.ActionLink(item.Name, "Preview", "Service", new { Id = item.Id }, null)</li>
7-
}
8-
</ul>
2+
3+
4+
<table class="items">
5+
<thead>
6+
<tr>
7+
<th colspan="3">
8+
Json Feeds
9+
</th>
10+
</tr>
11+
<tr>
12+
<th>Name</th>
13+
<th>Preview</th>
14+
<th>Feed Source</th>
15+
</tr>
16+
</thead>
17+
<tbody>
18+
@foreach (var item in Model.Items)
19+
{
20+
<tr>
21+
<td>@item.Name</td>
22+
<td>@Html.ActionLink("Preview", "Preview", "Service", new { Id = item.Id }, new { Class = "button" })</td>
23+
<td>@Html.ActionLink("Source", "Feed", "Service", new { Id = item.Id }, new { Class = "button" }) </td>
24+
</tr>
25+
}
26+
</tbody>
27+
</table>

0 commit comments

Comments
 (0)