Leaf Input Details
This commit is contained in:
@@ -1 +1 @@
|
||||
C:\Users\poprhythm\AppData\Local\Temp\Temporary ASP.NET Files\vs\f80e29bb\faae20bf\App_Web_all.generated.cs.8f9494c4.agsib7ro.dll
|
||||
C:\Users\poprhythm\AppData\Local\Temp\Temporary ASP.NET Files\vs\f80e29bb\faae20bf\App_Web_all.generated.cs.8f9494c4.ymeptwl9.dll
|
||||
@@ -21,7 +21,7 @@ namespace LeafWeb.WebCms.Controllers
|
||||
public ActionResult Details(int id)
|
||||
{
|
||||
var leafInput = DataService.GetLeafInput(id);
|
||||
var viewModel = new LeafInputCreate();
|
||||
var viewModel = new LeafInputDetails(leafInput);
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using AutoMapper;
|
||||
using LeafWeb.Core.DAL;
|
||||
using LeafWeb.Core.Entities;
|
||||
|
||||
namespace LeafWeb.WebCms.Models
|
||||
{
|
||||
@@ -36,18 +37,20 @@ namespace LeafWeb.WebCms.Models
|
||||
|
||||
static LeafInputCreate()
|
||||
{
|
||||
Mapper.CreateMap<LeafInputCreate, Core.Entities.LeafInput>()
|
||||
Mapper.CreateMap<LeafInputCreate, LeafInput>()
|
||||
.ForMember(dest => dest.PhotosynthesisType, opt => opt.Ignore());
|
||||
Mapper.CreateMap<LeafInput, LeafInputCreate>()
|
||||
.ForMember(dest => dest.PhotosynthesisType, opt => opt.Ignore());
|
||||
}
|
||||
|
||||
public LeafInputCreate()
|
||||
{
|
||||
//PhotosynthesisType = new SelectListViewModel();
|
||||
PhotosynthesisType = new SelectListViewModel();
|
||||
}
|
||||
|
||||
public Core.Entities.LeafInput GetLeafInput(DataService db)
|
||||
public LeafInput GetLeafInput(DataService db)
|
||||
{
|
||||
var leafInput = new Core.Entities.LeafInput();
|
||||
var leafInput = new LeafInput();
|
||||
Mapper.Map(this, leafInput);
|
||||
|
||||
leafInput.PhotosynthesisType = db.GetPhotosynthesisType(PhotosynthesisType.Selected);
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using AutoMapper;
|
||||
using LeafWeb.Core.Entities;
|
||||
|
||||
namespace LeafWeb.WebCms.Models
|
||||
{
|
||||
public class LeafInputDetails
|
||||
{
|
||||
[Display(Name = "Name")]
|
||||
[Required(ErrorMessage = "Name required")]
|
||||
[RegularExpression(@"[A-Za-z().]+(\s+[A-Za-z().]+)+", ErrorMessage = "Please provide full name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Display(Name = "Email address")]
|
||||
[Required(ErrorMessage = "An email address is required")]
|
||||
[DataType(DataType.EmailAddress)]
|
||||
[RegularExpression(@"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}", ErrorMessage = "Must be an email address")]
|
||||
public string Email { get; set; }
|
||||
|
||||
[Display(Name = "Identifier")]
|
||||
[Required(ErrorMessage = "A unique identifier is required")]
|
||||
public string Identifier { get; set; }
|
||||
|
||||
[Display(Name = "Site Id")]
|
||||
[Required(ErrorMessage = "The site's name is required")]
|
||||
public string SiteId { get; set; }
|
||||
|
||||
[Display(Name = "Photosyn. Pathway")]
|
||||
[Required(ErrorMessage = "A Photosynthetic pathway must be chosen")]
|
||||
public string PhotosynthesisType { get; set; }
|
||||
|
||||
[DataType(DataType.Date)]
|
||||
[Required]
|
||||
public DateTime Added { get; set; }
|
||||
|
||||
[UIHint("Status")]
|
||||
public string CurrentStatus { get; set; }
|
||||
|
||||
[UIHint("LeafInputStatusViewModels")]
|
||||
public List<LeafInputStatusViewModel> StatusHistory { get; set; }
|
||||
|
||||
static LeafInputDetails()
|
||||
{
|
||||
Mapper.CreateMap<LeafInputStatusType, string>().ConvertUsing(st => st.ToString());
|
||||
Mapper.CreateMap<LeafInputStatusType, LeafInputStatus>().ConvertUsing(st => new LeafInputStatus());
|
||||
Mapper.CreateMap<LeafInputStatus, LeafInputStatusViewModel>();
|
||||
Mapper.CreateMap<LeafInput, LeafInputDetails>();
|
||||
}
|
||||
|
||||
public LeafInputDetails(LeafInput leafInput)
|
||||
{
|
||||
Mapper.Map(leafInput, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using AutoMapper;
|
||||
using LeafWeb.Core.Entities;
|
||||
|
||||
namespace LeafWeb.WebCms.Models
|
||||
{
|
||||
public class LeafInputStatusViewModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[UIHint("Status")]
|
||||
public string Status { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Details { get; set; }
|
||||
public DateTime DateTime { get; set; }
|
||||
|
||||
static LeafInputStatusViewModel()
|
||||
{
|
||||
Mapper.CreateMap<LeafInputStatus, LeafInputStatusViewModel>()
|
||||
.ForMember(dest => dest.Status, opt => opt.MapFrom(li => li.Status.ToString()));
|
||||
}
|
||||
|
||||
public LeafInputStatusViewModel() { }
|
||||
|
||||
public LeafInputStatusViewModel(LeafInputStatus status)
|
||||
{
|
||||
Mapper.Map(status, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
@model LeafWeb.WebCms.Models.LeafInputCreate
|
||||
@model LeafWeb.WebCms.Models.LeafInputDetails
|
||||
|
||||
@Html.DisplayForModel()
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
grid.Column("LeafInputIdentifier", "Identifier"),
|
||||
grid.Column("LeafInputSiteId", "Site Id"),
|
||||
grid.Column("LeafInputName", "Submitted By"),
|
||||
grid.Column("CurrentStatus", "Status", item => StatusFormat(item)),
|
||||
grid.Column("CurrentStatus", "Status", item => Html.Partial("DisplayTemplates/_LeafInputStatus", (string)item.CurrentStatus)),
|
||||
grid.Column("Total Results: " + Model.Count(), format: item => Btns(item))),
|
||||
htmlAttributes: new { @class = "table table-striped table-bordered table-hover table-condensed" }
|
||||
)
|
||||
@@ -24,9 +24,15 @@
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li>@DetailsLink(item)</li>
|
||||
<li @if(!item.HasLeafChart) { <text>class="disabled"</text> }>@ChartLink(item)</li>
|
||||
<li><a href="@Url.Action("DownloadOutputToUser", "Queue", new {id = item.LeafInputId})"><span class="glyphicon glyphicon-download"></span> Download ToUser</a></li>
|
||||
<li><a href="@Url.Action("DownloadInput", "Queue", new {id = item.LeafInputId})"><span class="glyphicon glyphicon-download"></span> Download Input</a></li>
|
||||
<li @if (!item.HasLeafChart)
|
||||
{
|
||||
<text>class="disabled"</text>
|
||||
}>@ChartLink(item)</li>
|
||||
<li role="separator" class="divider"></li>
|
||||
<li class="dropdown-header">Download</li>
|
||||
<li><a href="@Url.Action("DownloadOutputToUser", "Queue", new {id = item.LeafInputId})"><span class="glyphicon glyphicon-download"></span> ToUser</a></li>
|
||||
<li><a href="@Url.Action("DownloadInput", "Queue", new {id = item.LeafInputId})"><span class="glyphicon glyphicon-download"></span> Input</a></li>
|
||||
<li role="separator" class="divider"></li>
|
||||
<li><a href="@Url.Action("Delete", "Queue", new {id = item.LeafInputId})"><span class="glyphicon glyphicon-remove"></span> Delete</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -35,15 +41,13 @@
|
||||
|
||||
@helper DetailsLink(dynamic item)
|
||||
{
|
||||
<a href="@UmbracoContext.Current.UrlProvider.GetUrl(1111)?id=@item.LeafInputId"><span class="glyphicon glyphicon-edit"></span> Details</a>
|
||||
@Html.Partial("DisplayTemplates/_DetailsLink", (int)item.LeafInputId)
|
||||
}
|
||||
|
||||
@helper ChartLink(dynamic item)
|
||||
{
|
||||
<a href="@UmbracoContext.Current.UrlProvider.GetUrl(1100)?leafInputId=@item.LeafInputId"><span class="glyphicon glyphicon-stats"></span> Chart</a>
|
||||
}
|
||||
|
||||
@helper StatusFormat(dynamic item)
|
||||
if (item.HasLeafChart)
|
||||
{
|
||||
<span class="status status-@item.CurrentStatus.ToLower()">@item.CurrentStatus</span>
|
||||
@Html.Partial("DisplayTemplates/_ChartLink", (int)item.LeafInputId)
|
||||
}
|
||||
}
|
||||
@@ -9,24 +9,16 @@
|
||||
grid.Column("LeafInputIdentifier", "Identifier"),
|
||||
grid.Column("LeafInputSiteId", "Site Id"),
|
||||
grid.Column("LeafInputName", "Submitted By"),
|
||||
grid.Column("CurrentStatus", "Status", item => statusFormat(item)),
|
||||
grid.Column("Chart", "Chart", item => chartLink(item))
|
||||
grid.Column("CurrentStatus", "Status", item => Html.Partial("DisplayTemplates/_LeafInputStatus", (string)item.CurrentStatus)),
|
||||
grid.Column("Chart", "Chart", item => ChartLink(item))
|
||||
),
|
||||
htmlAttributes: new { @class = "table table-striped table-bordered table-hover table-condensed" }
|
||||
)
|
||||
|
||||
@helper chartLink(dynamic item)
|
||||
@helper ChartLink(dynamic item)
|
||||
{
|
||||
if (item.HasLeafChart)
|
||||
{
|
||||
<a href="@UmbracoContext.Current.UrlProvider.GetUrl(1100)?leafInputId=@item.LeafInputId" class="btn btn-default btn-xs" role="button">
|
||||
<span class="glyphicon glyphicon-stats"></span>
|
||||
Chart
|
||||
</a>
|
||||
@Html.Partial("DisplayTemplates/_ChartLink", (int)item.LeafInputId)
|
||||
}
|
||||
}
|
||||
|
||||
@helper statusFormat(dynamic item)
|
||||
{
|
||||
<span class="status status-@item.CurrentStatus.ToLower()">@item.CurrentStatus</span>
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
@{
|
||||
Layout = "~/Views/Shared/DisplayTemplates/_FieldLayout.cshtml";
|
||||
}
|
||||
@Html.Encode(Model)
|
||||
@@ -0,0 +1,10 @@
|
||||
@using System.Globalization
|
||||
@model DateTime
|
||||
@{
|
||||
Layout = "~/Views/Shared/DisplayTemplates/_FieldLayout.cshtml";
|
||||
var val =
|
||||
ViewData.ModelMetadata.DisplayFormatString != null
|
||||
?string.Format(ViewData.ModelMetadata.DisplayFormatString, Model)
|
||||
: Model.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
@Html.Encode(val)
|
||||
@@ -0,0 +1,14 @@
|
||||
@using System.Globalization
|
||||
@model DateTime?
|
||||
@{
|
||||
Layout = "~/Views/Shared/DisplayTemplates/_FieldLayout.cshtml";
|
||||
var val =
|
||||
Model.HasValue
|
||||
?
|
||||
ViewData.ModelMetadata.DisplayFormatString != null
|
||||
? string.Format(ViewData.ModelMetadata.DisplayFormatString, Model)
|
||||
: Model.Value.ToString(CultureInfo.InvariantCulture)
|
||||
: string.Empty;
|
||||
}
|
||||
|
||||
@(Model == null ? Html.Encode(ViewData.ModelMetadata.NullDisplayText) : Html.Encode(val))
|
||||
@@ -0,0 +1,4 @@
|
||||
@{
|
||||
Layout = "~/Views/Shared/DisplayTemplates/_FieldLayout.cshtml";
|
||||
}
|
||||
@Html.Encode(Model)
|
||||
@@ -0,0 +1,4 @@
|
||||
@{
|
||||
Layout = "~/Views/Shared/DisplayTemplates/_FieldLayout.cshtml";
|
||||
}
|
||||
<a href="mailto:@Model">@Html.Encode(Model)</a>
|
||||
@@ -0,0 +1,4 @@
|
||||
@{
|
||||
Layout = "~/Views/Shared/DisplayTemplates/_FieldLayout.cshtml";
|
||||
}
|
||||
@Html.Encode(Model)
|
||||
@@ -0,0 +1,17 @@
|
||||
@model IEnumerable<LeafWeb.WebCms.Models.LeafInputStatusViewModel>
|
||||
@{
|
||||
Layout = "~/Views/Shared/DisplayTemplates/_FieldLayout.cshtml";
|
||||
var grid = new WebGrid(Model, rowsPerPage: 45);
|
||||
grid.SortColumn = "DateTime";
|
||||
grid.SortDirection = SortDirection.Descending;
|
||||
}
|
||||
|
||||
@grid.GetHtml(columns:
|
||||
grid.Columns(
|
||||
grid.Column("DateTime", "Time"),
|
||||
grid.Column("Status"),
|
||||
grid.Column("Description"),
|
||||
grid.Column("Details")
|
||||
),
|
||||
htmlAttributes: new { @class = "table table-striped table-bordered table-hover table-condensed" }
|
||||
)
|
||||
@@ -0,0 +1,11 @@
|
||||
@{
|
||||
Layout = null;
|
||||
}
|
||||
@foreach (var prop in ViewData.ModelMetadata.Properties.Where(
|
||||
pm => pm.ShowForDisplay
|
||||
&& !pm.HideSurroundingHtml
|
||||
//&& !pm.ModelType.IsCollection()
|
||||
))
|
||||
{
|
||||
@Html.Display(prop.PropertyName)
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
@model LeafWeb.WebCms.Models.SelectListViewModel
|
||||
@{
|
||||
Layout = "~/Views/Shared/DisplayTemplates/_FieldLayout.cshtml";
|
||||
}
|
||||
|
||||
@(!string.IsNullOrEmpty(Model.Selected) ? Model.ListItems.FirstOrDefault(i => i.Value == Model.Selected.ToString()).Text : string.Empty)
|
||||
@@ -0,0 +1,12 @@
|
||||
@model string
|
||||
@{
|
||||
Layout = "~/Views/Shared/DisplayTemplates/_FieldLayout.cshtml";
|
||||
}
|
||||
@if (Model == null)
|
||||
{
|
||||
@Html.Encode(ViewData.ModelMetadata.NullDisplayText)
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="status status-@Model.ToFirstLower()">@Html.Encode(Model)</span>
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
@{
|
||||
Layout = "~/Views/Shared/DisplayTemplates/_FieldLayout.cshtml";
|
||||
}
|
||||
@if (Model == null)
|
||||
{
|
||||
@Html.Encode(ViewData.ModelMetadata.NullDisplayText)
|
||||
}
|
||||
else
|
||||
{
|
||||
@Html.Encode(Model)
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
@model int
|
||||
<a href="@UmbracoContext.Current.UrlProvider.GetUrl(1100)?leafInputId=@Model" class="btn btn-default btn-xs" role="button">
|
||||
<span class="glyphicon glyphicon-stats"></span>
|
||||
Chart
|
||||
</a>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
@model int
|
||||
<a href="@UmbracoContext.Current.UrlProvider.GetUrl(1111)?id=@Model">
|
||||
<span class="glyphicon glyphicon-edit"></span> Details
|
||||
</a>
|
||||
@@ -0,0 +1,19 @@
|
||||
@using LeafWeb.Core.Utility
|
||||
@{
|
||||
Layout = null;
|
||||
var lowerPropertyName = ViewData.ModelMetadata.PropertyName.ToFirstLower();
|
||||
var displayName =
|
||||
string.IsNullOrEmpty(ViewData.ModelMetadata.DisplayName)
|
||||
? ViewData.ModelMetadata.PropertyName.SplitCamelCase()
|
||||
: ViewData.ModelMetadata.DisplayName;
|
||||
// string units = (string)ViewData.ModelMetadata.AdditionalValues.ContainsKey("Units") ? ["Units"];
|
||||
}
|
||||
|
||||
<dl class="dl-horizontal @lowerPropertyName">
|
||||
<dt>
|
||||
@displayName
|
||||
</dt>
|
||||
<dd>
|
||||
@RenderBody()
|
||||
</dd>
|
||||
</dl>
|
||||
@@ -0,0 +1,2 @@
|
||||
@model string
|
||||
<span class="status status-@Model.ToLower()">@Model</span>
|
||||
@@ -775,6 +775,21 @@
|
||||
<Content Include="Views\Partials\Grid\Bootstrap3-Fluid.cshtml" />
|
||||
<Content Include="Views\Partials\Grid\Bootstrap2-Fluid.cshtml" />
|
||||
<Content Include="Views\MacroPartials\LeafInputQueueDetails.cshtml" />
|
||||
<Content Include="Views\Shared\DisplayTemplates\Boolean.cshtml" />
|
||||
<Content Include="Views\Shared\DisplayTemplates\Date.cshtml" />
|
||||
<Content Include="Views\Shared\DisplayTemplates\DateTime.cshtml" />
|
||||
<Content Include="Views\Shared\DisplayTemplates\Decimal.cshtml" />
|
||||
<Content Include="Views\Shared\DisplayTemplates\EmailAddress.cshtml" />
|
||||
<Content Include="Views\Shared\DisplayTemplates\HiddenInput.cshtml" />
|
||||
<Content Include="Views\Shared\DisplayTemplates\Object.cshtml" />
|
||||
<Content Include="Views\Shared\DisplayTemplates\SelectListViewModel.cshtml" />
|
||||
<Content Include="Views\Shared\DisplayTemplates\String.cshtml" />
|
||||
<Content Include="Views\Shared\DisplayTemplates\_FieldLayout.cshtml" />
|
||||
<Content Include="Views\Shared\DisplayTemplates\Status.cshtml" />
|
||||
<Content Include="Views\Shared\DisplayTemplates\LeafInputStatusViewModels.cshtml" />
|
||||
<Content Include="Views\Shared\DisplayTemplates\_ChartLink.cshtml" />
|
||||
<Content Include="Views\Shared\DisplayTemplates\_LeafInputStatus.cshtml" />
|
||||
<Content Include="Views\Shared\DisplayTemplates\_DetailsLink.cshtml" />
|
||||
<None Include="Web.Debug.config">
|
||||
<DependentUpon>Web.config</DependentUpon>
|
||||
</None>
|
||||
@@ -806,7 +821,9 @@
|
||||
<Compile Include="Controllers\QueueController.cs" />
|
||||
<Compile Include="Controllers\ResultsController.cs" />
|
||||
<Compile Include="Models\ChartViewModel.cs" />
|
||||
<Compile Include="Models\LeafInputDetails.cs" />
|
||||
<Compile Include="Models\LeafInputCreate.cs" />
|
||||
<Compile Include="Models\LeafInputStatusViewModel.cs" />
|
||||
<Compile Include="Models\ResultStatusViewModel.cs" />
|
||||
<Compile Include="Models\SelectListViewModel.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
||||
Vendored
+11
-7
@@ -22,10 +22,13 @@
|
||||
var $chart = $("#chart");
|
||||
$chart.removeAttr('src');
|
||||
|
||||
var curveId = $("option:selected", this).text();
|
||||
if (curveId === "@Html.Raw(selectText)") {
|
||||
// this is the "Select CurveId" instruction
|
||||
if (this.selectedIndex === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var curveId = $("option:selected", this).text();
|
||||
|
||||
var $spinner = $chart.after('<span class="glyphicon glyphicon-refresh gly-spin" style="font-size: 3em"></span>').next('span');
|
||||
|
||||
var leafInputId = getUrlParameter("leafInputId");
|
||||
@@ -33,11 +36,12 @@
|
||||
$chart.load(function () {
|
||||
$spinner.remove();
|
||||
})
|
||||
.error(function () {
|
||||
$chart.removeAttr('src');
|
||||
$spinner.remove();
|
||||
$('#chart-error').addClass('text-danger').text('A problem was encountered loading this chart.');
|
||||
.error(function () {
|
||||
//$chart.removeAttr('src');
|
||||
$spinner.remove();
|
||||
$('#chart-error').addClass('text-danger').text('A problem was encountered loading this chart.');
|
||||
return;
|
||||
})
|
||||
.attr('src', url);
|
||||
.attr('src', url);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user