Add search page
This commit is contained in:
@@ -3,12 +3,22 @@ using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using LeafWeb.Core.Entities;
|
||||
using LeafWeb.Core.Utility;
|
||||
using Umbraco.Web.Mvc;
|
||||
|
||||
namespace LeafWeb.WebCms.Controllers
|
||||
{
|
||||
public class ResultsController : BaseController
|
||||
{
|
||||
public ActionResult Index()
|
||||
[MemberAuthorize(AllowGroup = "Authenticated")]
|
||||
public ActionResult Search()
|
||||
{
|
||||
var viewModel =
|
||||
from li in DataService.GetLeafInputsOrdered()
|
||||
select li;
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
public ActionResult Recent()
|
||||
{
|
||||
var dateThreshold = DateTime.Today.Subtract(TimeSpan.FromDays(90));
|
||||
var viewModel =
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
@using Umbraco.Web.Models
|
||||
@using Umbraco.Web.Controllers
|
||||
@{
|
||||
var loginModel = new LoginModel { RedirectUrl = "/leaf-data/manage-queue/" };
|
||||
var loginModel = new LoginModel { RedirectUrl = "/leaf-data/search/" };
|
||||
}
|
||||
|
||||
<div class="container mt-3">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@inherits Umbraco.Web.Macros.PartialViewMacroPage
|
||||
|
||||
@{
|
||||
Html.RenderAction("Index", "Results");
|
||||
Html.RenderAction("Recent", "Results");
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
@inherits Umbraco.Web.Macros.PartialViewMacroPage
|
||||
|
||||
@{
|
||||
Html.RenderAction("Search", "Results");
|
||||
}
|
||||
@@ -14,6 +14,11 @@
|
||||
@* For each child page under the home node *@
|
||||
@foreach (var childPage in home.Children.Where("Visible"))
|
||||
{
|
||||
if (library.IsProtected(childPage.id, childPage.path)
|
||||
&& !library.HasAccess(childPage.id, childPage.path))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (childPage.Children.Where("Visible").Any())
|
||||
{
|
||||
<li class="nav-item dropdown @(childPage.IsAncestorOrSelf(CurrentPage) ? "active" : null)">
|
||||
@@ -23,7 +28,7 @@
|
||||
@childPage.Name
|
||||
</a>
|
||||
|
||||
@childPages(childPage.Children)
|
||||
@childPages(childPage.Children, childPage.Name == "Admin" && loginStatus.IsLoggedIn && admin)
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -41,18 +46,12 @@
|
||||
</ul>
|
||||
<div class="navbar-text text-light text-left">
|
||||
@Html.Partial("LoginStatus")
|
||||
@if (loginStatus.IsLoggedIn && admin)
|
||||
{
|
||||
<div class="align-items-center">
|
||||
<a href="~/umbraco#"><span class="fa fa-cog"></span> Site Editor</a>
|
||||
<i class="fa fa-lock fa-fw text-danger" aria-hidden="true"></i>
|
||||
</div>
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@helper childPages(dynamic pages)
|
||||
@helper childPages(dynamic pages, bool appendSiteEditor)
|
||||
{
|
||||
@* Ensure that we have a collection of pages *@
|
||||
if (pages.Where("Visible").Any())
|
||||
@@ -72,6 +71,14 @@
|
||||
}
|
||||
</a>
|
||||
}
|
||||
|
||||
@if (appendSiteEditor)
|
||||
{
|
||||
<a class="dropdown-item text-light" href="~/umbraco#">
|
||||
<span class="fa fa-cog"></span> Site Editor
|
||||
<i class="fa fa-lock fa-fw text-danger" aria-hidden="true"></i>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
@using LeafWeb.Core.Entities
|
||||
@using LeafWeb.WebCms.Utility
|
||||
@model IQueryable<LeafInput>
|
||||
@{
|
||||
var grid = new WebGrid(Model, rowsPerPage: 45);
|
||||
}
|
||||
dfdf
|
||||
<div class="table-responsive">
|
||||
@grid.Table(columns:
|
||||
grid.Columns(
|
||||
grid.Column("Identifier", "Identifier"),
|
||||
grid.Column("SiteId", "Site Id"),
|
||||
//grid.Column("Name", "Submitted By"),
|
||||
grid.Column("CurrentStatus", "Status", item => Status(item.Value)),
|
||||
grid.Column("", "", item => ChartLink(item.Value))
|
||||
),
|
||||
htmlAttributes: new { @class = "table table-sm table-striped table-bordered table-hover" }
|
||||
)
|
||||
@grid.PagerList()
|
||||
</div>
|
||||
|
||||
@helper ChartLink(LeafInput leafInput)
|
||||
{
|
||||
var cssClass = CssClassUtil.CreateCssClassDataDictionary("btn", " btn-outline-secondary", "btn-sm");
|
||||
if (!leafInput.HasLeafChart)
|
||||
{
|
||||
cssClass.SetCssDisabled();
|
||||
}
|
||||
@Html.Partial("DisplayTemplates/_ChartButton", leafInput.Id, cssClass)
|
||||
}
|
||||
|
||||
@helper Status(LeafInput leafInput)
|
||||
{
|
||||
@Html.Partial("DisplayTemplates/_LeafInputStatus", leafInput)
|
||||
}
|
||||
@@ -996,7 +996,7 @@
|
||||
<Content Include="Views\MacroPartials\LeafInputCreate.cshtml" />
|
||||
<None Include="Backload\Web.Backload.config" />
|
||||
<Content Include="Views\Results\DownloadNotFound.cshtml" />
|
||||
<Content Include="Views\Results\Index.cshtml" />
|
||||
<Content Include="Views\Results\Search.cshtml" />
|
||||
<Content Include="Views\MacroPartials\Results.cshtml" />
|
||||
<Content Include="Views\Chart\DataError.cshtml" />
|
||||
<Content Include="Views\Chart\Index.cshtml" />
|
||||
@@ -1069,6 +1069,8 @@
|
||||
<Content Include="Views\Shared\DisplayTemplates\LeafInputDataViewModels.cshtml" />
|
||||
<Content Include="Views\Shared\DisplayTemplates\_ViewDataCssClass.cshtml" />
|
||||
<Content Include="Views\Shared\_LeafDataQuery.cshtml" />
|
||||
<Content Include="Views\Results\Recent.cshtml" />
|
||||
<Content Include="Views\MacroPartials\Search.cshtml" />
|
||||
<None Include="Web.Debug.config">
|
||||
<DependentUpon>Web.config</DependentUpon>
|
||||
</None>
|
||||
|
||||
Reference in New Issue
Block a user