109 lines
3.5 KiB
Plaintext
109 lines
3.5 KiB
Plaintext
@using LeafWeb.Core.Entities
|
|
@using LeafWeb.WebCms.Utility
|
|
@model LeafInput
|
|
@{
|
|
var admin = ViewData.ContainsKey("admin");
|
|
}
|
|
|
|
<div class="btn-group text-nowrap" role="group">
|
|
<div class="btn-group" role="group">
|
|
<button id="actions(@Model.Id)" type="button" class="btn btn-outline-secondary btn-sm dropdown-toggle"
|
|
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Actions">
|
|
<span class="d-none d-sm-inline">Actions</span>
|
|
</button>
|
|
<div class="dropdown-menu" aria-labelledby="actions(@Model.Id)">
|
|
@DetailsLink(Model)
|
|
@ChartLink(Model)
|
|
@if (admin && Model.IsPending)
|
|
{
|
|
<div class="dropdown-divider"></div>
|
|
<h6 class="dropdown-header">Priority</h6>
|
|
<button class="dropdown-item @DisableItem(Model.PendingPriority == Priority.High)">@PriorityForm(Model, Priority.High)</button>
|
|
<button class="dropdown-item @DisableItem(Model.PendingPriority == Priority.Normal)">@PriorityForm(Model, Priority.Normal)</button>
|
|
<button class="dropdown-item @DisableItem(Model.PendingPriority == Priority.Low)">@PriorityForm(Model, Priority.Low)</button>
|
|
}
|
|
@if (admin && Model.IsCancellable)
|
|
{
|
|
<div class="dropdown-divider"></div>
|
|
@CancelLink(Model)
|
|
}
|
|
<div class="dropdown-divider"></div>
|
|
<h6 class="dropdown-header">Download</h6>
|
|
@DownloadInput(Model)
|
|
@DownloadOutputToUser(Model)
|
|
@if (admin)
|
|
{
|
|
<div class="dropdown-divider"></div>
|
|
@DeleteLink(Model)
|
|
}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@helper DetailsLink(dynamic item)
|
|
{
|
|
var cssClass = CssClassUtil.CreateCssClassDataDictionary("dropdown-item");
|
|
|
|
@Html.Partial("DisplayTemplates/_DetailsLink", (int)item.Id, cssClass)
|
|
}
|
|
|
|
@helper ChartLink(dynamic item)
|
|
{
|
|
var cssClass = CssClassUtil.CreateCssClassDataDictionary("dropdown-item");
|
|
|
|
if (!item.HasLeafChart)
|
|
{
|
|
cssClass.SetCssDisabled();
|
|
}
|
|
@Html.Partial("DisplayTemplates/_ChartLink", (int)item.Id, cssClass)
|
|
}
|
|
|
|
@helper DownloadInput(dynamic item)
|
|
{
|
|
<a href="@Url.Action("DownloadInput", "Queue", new {id = item.Id})" class="dropdown-item">
|
|
<span class="fa fa-download"></span> Input
|
|
</a>
|
|
}
|
|
@helper DownloadOutputToUser(dynamic item)
|
|
{
|
|
<a href="@Url.Action("DownloadOutputToUser", "Queue", new {id = item.Id})" class="dropdown-item @DisableItem(!item.HasOutputFiles)">
|
|
<span class="fa fa-download"></span> ToUser
|
|
</a>
|
|
}
|
|
@helper DeleteLink(LeafInput item)
|
|
{
|
|
var cssClass
|
|
= CssClassUtil.CreateCssClassDataDictionary("dropdown-item");
|
|
if (!item.IsDeletable)
|
|
{
|
|
cssClass.SetCssDisabled();
|
|
}
|
|
@Html.Partial("DisplayTemplates/_DeleteForm", Tuple.Create(item.Id, item.Identifier), cssClass)
|
|
}
|
|
|
|
@helper CancelLink(LeafInput item)
|
|
{
|
|
var cssClass
|
|
= CssClassUtil.CreateCssClassDataDictionary("dropdown-item");
|
|
if (!item.IsCancellable)
|
|
{
|
|
cssClass.SetCssDisabled();
|
|
}
|
|
@Html.Partial("DisplayTemplates/_CancelForm", Tuple.Create(item.Id, item.Identifier), cssClass)
|
|
}
|
|
|
|
@helper PriorityForm(LeafInput item, Priority priority)
|
|
{
|
|
var cssClass
|
|
= CssClassUtil.CreateCssClassDataDictionary("dropdown-item");
|
|
|
|
@Html.Partial("DisplayTemplates/_PriorityForm", Tuple.Create(item.Id, item.PendingPriority, priority), cssClass)
|
|
}
|
|
|
|
@helper DisableItem(bool disabled)
|
|
{
|
|
if (disabled)
|
|
{<text>disabled</text>}
|
|
}
|
|
|