Update button rendering, move css classes to viewdata
This commit is contained in:
@@ -1,12 +1,24 @@
|
||||
@model IEnumerable<LeafInputDataSiteViewModel>
|
||||
@{
|
||||
Layout = "~/Views/Shared/DisplayTemplates/_FieldLayout.cshtml";
|
||||
var grid = new WebGrid(Model, rowsPerPage: 45)
|
||||
{
|
||||
};
|
||||
//Layout = "~/Views/Shared/DisplayTemplates/_FieldLayout.cshtml";
|
||||
Rend("Site Id", string.Join(", ", Model.Select(m => m.SiteId).Distinct()));
|
||||
Rend("Latitude", string.Join(", ", Model.Select(m => m.Latitude).Distinct()));
|
||||
}
|
||||
|
||||
@grid.GetHtml(columns:
|
||||
@helper Rend(string label, string value)
|
||||
{
|
||||
<div class="row pb-lg-2 pb-sm-1 @if (ViewData.Model == null){<text>d-none</text> }">
|
||||
<div class="col-sm-3 text-truncate">
|
||||
@label
|
||||
</div>
|
||||
<div class="col-sm-9">
|
||||
@value
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
@*@grid.GetHtml(columns:
|
||||
grid.Columns(
|
||||
grid.Column("SiteId"),
|
||||
grid.Column("Latitude"),
|
||||
@@ -14,4 +26,4 @@
|
||||
grid.Column("Elevation")
|
||||
),
|
||||
htmlAttributes: new { @class = "table table-sm table-striped table-bordered table-hover" }
|
||||
)
|
||||
)*@
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
@using LeafWeb.WebCms.Controllers
|
||||
@model Tuple<int, string, bool>
|
||||
@using LeafWeb.WebCms.Utility
|
||||
@model Tuple<int, string>
|
||||
@{
|
||||
var leafInputId = Model.Item1;
|
||||
var identifier = Model.Item2;
|
||||
// true for a link, false for a button
|
||||
var buttonType = Model.Item3 ? "btn-link" : "btn-outline-secondary";
|
||||
}
|
||||
@using (Html.BeginUmbracoForm<QueueController>("Cancel", null,
|
||||
new { @class = "confirm clearfix", confirm_msg = "Cancelling cannot be undone! Confirm cancelling '" + identifier + "'." }))
|
||||
{
|
||||
<input type="hidden" name="id" value="@leafInputId"/>
|
||||
<button type="submit" class="btn @buttonType">
|
||||
<button type="submit" @Html.Partial("DisplayTemplates/_ViewDataCssClass") @if(ViewData.IsButtonDisabled()) {<text>disabled</text>}>
|
||||
<span class="fa fa-ban"></span> Cancel
|
||||
</button>
|
||||
}
|
||||
@@ -1,14 +1,11 @@
|
||||
@using LeafWeb.WebCms.Controllers
|
||||
@using LeafWeb.WebCms.Utility
|
||||
@model int
|
||||
@{
|
||||
var url = UmbracoContext.Current.UrlProvider.GetUrl(LeafWebPageIds.Chart);
|
||||
var disabled = ViewData.ContainsKey("Disabled") && (bool) ViewData["Disabled"];
|
||||
var xs = ViewData.ContainsKey("xs") && (bool) ViewData["xs"];
|
||||
}
|
||||
<a href="@url?leafInputId=@Model"
|
||||
class="btn btn-outline-secondary @{if (xs) {<text>btn-sm</text>}} @{if (disabled) {<text>disabled</text>}}"
|
||||
role="button"
|
||||
@{if (disabled) {<text>title="No chart has been generated"</text>}} >
|
||||
<a href="@url?leafInputId=@Model" @Html.Partial("DisplayTemplates/_ViewDataCssClass") role="button"
|
||||
@if (ViewData.IsCssDisabled()) {<text>title="No chart has been generated"</text>} >
|
||||
<span class="fa fa-line-chart" title="Charts"></span>
|
||||
<span class="d-none d-sm-inline">Charts</span>
|
||||
</a>
|
||||
@@ -3,7 +3,6 @@
|
||||
@{
|
||||
var url = UmbracoContext.Current.UrlProvider.GetUrl(LeafWebPageIds.Chart);
|
||||
}
|
||||
<a href="@url?leafInputId=@Model" @Html.Partial("DisplayTemplates/_ViewDataCssClass", new [] {"dropdown-item"}, ViewData)>
|
||||
<span class="fa fa-line-chart"></span>
|
||||
Chart
|
||||
<a href="@url?leafInputId=@Model" @Html.Partial("DisplayTemplates/_ViewDataCssClass")>
|
||||
<span class="fa fa-line-chart"></span> Charts
|
||||
</a>
|
||||
@@ -1,17 +1,15 @@
|
||||
@using LeafWeb.WebCms.Controllers
|
||||
@model Tuple<int, string, bool, bool>
|
||||
@using LeafWeb.WebCms.Utility
|
||||
@model Tuple<int, string>
|
||||
@{
|
||||
var leafInputId = Model.Item1;
|
||||
var identifier = Model.Item2;
|
||||
var isDeletable = Model.Item3;
|
||||
// true for a link, false for a button
|
||||
var buttonType = Model.Item4 ? "btn-link" : "btn-outline-secondary";
|
||||
}
|
||||
@using (Html.BeginUmbracoForm<QueueController>("Delete", null,
|
||||
new { @class = "confirm clearfix", confirm_msg = "Deletion cannot be undone! Confirm deleting '" + identifier + "'." }))
|
||||
{
|
||||
<input type="hidden" name="id" value="@leafInputId"/>
|
||||
<button type="submit" class="btn @buttonType" @{if (!isDeletable) { <text> disabled="disabled" </text> }}>
|
||||
<button type="submit" @Html.Partial("DisplayTemplates/_ViewDataCssClass") @if(ViewData.IsButtonDisabled()) {<text>disabled</text>}>
|
||||
<span class="fa fa-remove"></span> Delete
|
||||
</button>
|
||||
}
|
||||
@@ -1,20 +1,21 @@
|
||||
@using LeafWeb.Core.Utility
|
||||
@{
|
||||
Layout = null;
|
||||
var lowerPropertyName = ViewData.ModelMetadata.PropertyName.ToFirstLower();
|
||||
var meta = ViewData.ModelMetadata;
|
||||
var lowerPropertyName = meta.PropertyName.ToFirstLower();
|
||||
var displayName =
|
||||
string.IsNullOrEmpty(ViewData.ModelMetadata.DisplayName)
|
||||
? ViewData.ModelMetadata.PropertyName.SplitCamelCase()
|
||||
: ViewData.ModelMetadata.DisplayName;
|
||||
string.IsNullOrEmpty(meta.DisplayName)
|
||||
? meta.PropertyName.SplitCamelCase()
|
||||
: meta.DisplayName;
|
||||
|
||||
// string units = (string)ViewData.ModelMetadata.AdditionalValues.ContainsKey("Units") ? ["Units"];
|
||||
}
|
||||
|
||||
<div class="row @lowerPropertyName @if (ViewData.Model == null){<text>d-none</text> }">
|
||||
<div class="col-sm-3 text-truncate">
|
||||
<div class="row pb-lg-3 pb-2 @lowerPropertyName @if (ViewData.Model == null){<text>d-none</text> }">
|
||||
<div class="col-sm-3 text-truncate font-weight-bold border-bottom border-right">
|
||||
@displayName
|
||||
</div>
|
||||
<div class="col-sm-9">
|
||||
<div class="col-sm-9 border-bottom pl-5 pl-sm-2">
|
||||
@RenderBody()
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user