Improvments for dropdown menus

This commit is contained in:
2020-06-25 13:18:43 -04:00
parent 04d582c8e4
commit 7e88de5041
6 changed files with 81 additions and 59 deletions
+16 -11
View File
@@ -111,8 +111,8 @@ else
<span class="d-none d-sm-inline">Actions</span>
</button>
<div class="dropdown-menu" aria-labelledby="actions(@item.Id)">
<button class="dropdown-item">@DetailsLink(item)</button>
<button class="dropdown-item @DisableItem(!item.HasLeafChart)">@ChartLink(item)</button>
@DetailsLink(item)
@ChartLink(item)
@if (item.IsPending)
{
<div class="dropdown-divider"></div>
@@ -124,11 +124,11 @@ else
@if (item.IsCancellable)
{
<div class="dropdown-divider"></div>
<button class="dropdown-item">@CancelLink(item)</button>
@CancelLink(item)
}
<div class="dropdown-divider"></div>
<h6 class="dropdown-header">Download</h6>
<button class="dropdown-item">@DownloadInput(item)</button>
@DownloadInput(item)
<button class="dropdown-item @DisableItem(!item.HasOutputFiles)">@DownloadOutputToUser(item)</button>
<div class="dropdown-divider"></div>
<button class="dropdown-item @DisableItem(!item.IsDeletable)">@DeleteLink(item)</button>
@@ -139,23 +139,28 @@ else
@helper DetailsLink(dynamic item)
{
@Html.Partial("DisplayTemplates/_DetailsLink", (int)item.Id)
@Html.Partial("DisplayTemplates/_DetailsLink", (int)item.Id, new ViewDataDictionary {{"cssClass", new[]{"dropdown-item"}}})
}
@helper ChartLink(dynamic item)
{
@Html.Partial("DisplayTemplates/_ChartLink", (int)item.Id)
var classes = new[]{"dropdown-item"};
if (!item.HasLeafChart)
{
classes = classes.Concat(new[] {"disabled"}).ToArray();
}
@Html.Partial("DisplayTemplates/_ChartLink", (int)item.Id, new ViewDataDictionary {{"cssClass", classes}})
}
@helper DownloadInput(dynamic item)
{
<a href="@Url.Action("DownloadInput", "Queue", new {id = item.Id})">
<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})">
<a href="@Url.Action("DownloadOutputToUser", "Queue", new {id = item.Id})" class="dropdown-item">
<span class="fa fa-download"></span> ToUser
</a>
}
@@ -197,17 +202,17 @@ else
}
@helper DeleteLink(LeafInput item)
{
@Html.Partial("DisplayTemplates/_DeleteForm", Tuple.Create(item.Id, item.Identifier, item.IsDeletable, true))
@Html.Partial("DisplayTemplates/_DeleteForm", Tuple.Create(item.Id, item.Identifier, item.IsDeletable, true), new ViewDataDictionary {{"cssClass", new[]{"dropdown-item"}}})
}
@helper CancelLink(LeafInput item)
{
@Html.Partial("DisplayTemplates/_CancelForm", Tuple.Create(item.Id, item.Identifier, true))
@Html.Partial("DisplayTemplates/_CancelForm", Tuple.Create(item.Id, item.Identifier, true), new ViewDataDictionary {{"cssClass", new[]{"dropdown-item"}}})
}
@helper PriorityForm(LeafInput item, Priority priority)
{
@Html.Partial("DisplayTemplates/_PriorityForm", Tuple.Create(item.Id, item.PendingPriority, priority))
@Html.Partial("DisplayTemplates/_PriorityForm", Tuple.Create(item.Id, item.PendingPriority, priority), new ViewDataDictionary {{"cssClass", new[]{"dropdown-item"}}})
}
@helper DisableItem(bool disabled)