Former-commit-id: a59e6fb04e295d35da34610b1b0061557cc5ce46
Former-commit-id: 3ae6b6aea661d6935df1e8d1d6f3429beafc0854
1.0
wanggang 5 years ago
parent 2a2d119a09
commit 879ebe4340

@ -1,7 +1,12 @@
@{
HtmlTitle = "新建" + ViewContext.ViewData.ModelMetadata.ModelType.GetDisplayName();
var display= ViewContext.ViewData.ModelMetadata.ModelType.GetDisplayName();
HtmlTitle = "新建" + display;
var controller = this.ViewContext.RouteData.Values["controller"].ToString();
}
@Html.EditorForModel()
@section scripts{
@(await Html.PartialAsync("_Script"))
}
@section bread{
<li class="breadcrumb-item"><a href="@Url.Action("Index")">@(display)管理</a></li>
}

@ -1,4 +1,9 @@
@{
HtmlTitle = "查看" + ViewContext.ViewData.ModelMetadata.ModelType.GetDisplayName();
var display = ViewContext.ViewData.ModelMetadata.ModelType.GetDisplayName();
HtmlTitle = "编辑" + display;
var controller = this.ViewContext.RouteData.Values["controller"].ToString();
}
@Html.DisplayForModel()
@Html.DisplayForModel()
@section bread{
<li class="breadcrumb-item"><a href="@Url.Action("Index")">@(display)管理</a></li>
}

@ -1 +1,11 @@
@Html.CheckBox("", new { disabled = "disabled", style = "width:20px;height:20px;margin:2px 0;" })
@{
var model = Model as bool?;
if (model.HasValue && model.Value)
{
<i class="icon ion-checkmark" style="color:green;"></i>
}
else
{
<i class="icon ion-close" style="color:red;"></i>
}
}

@ -1,7 +1,12 @@
@{
HtmlTitle = "编辑" + ViewContext.ViewData.ModelMetadata.ModelType.GetDisplayName();
var display = ViewContext.ViewData.ModelMetadata.ModelType.GetDisplayName();
HtmlTitle = "编辑" + display;
var controller = this.ViewContext.RouteData.Values["controller"].ToString();
}
@Html.EditorForModel()
@section scripts{
@(await Html.PartialAsync("_Script"))
}
@section bread{
<li class="breadcrumb-item"><a href="@Url.Action("Index")">@(display)管理</a></li>
}

@ -1 +1,3 @@
@Html.CheckBox("", new { style = "width:20px;height:20px;margin:2px 0;" })
<div class="form-control" style="border-color:transparent;">
@Html.CheckBox("", new { style = "width:20px;height:20px;margin:2px 0;" })
</div>

@ -6,6 +6,7 @@
var controller = this.ViewContext.RouteData.Values["controller"].ToString();
var action = this.ViewContext.RouteData.Values["action"].ToString();
var url = HtmlAction ?? (ViewData.Keys.Any(o => o.ToLower() == "returnurl") ? Url.Action(null, null, new { ReturnUrl = ViewData["ReturnUrl"] }) : Url.Action(null, null));
var props = ViewData.ModelMetadata.Properties.Where(pm => pm.ShowForEdit);
}
<div class="card card-info">
<form action="@url" method="post" class="form-horizontal">
@ -15,12 +16,17 @@
<div class="col-sm-1 col-form-label"></div>
@Html.ValidationSummary(true, "错误:", new { @class = "text-danger col-sm-8" }, "div")
</div>
@foreach (var prop in ViewData.ModelMetadata.Properties.Where(pm => pm.ShowForEdit && !pm.HideSurroundingHtml))
@foreach (var prop in props)
{
var metadata = prop as Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultModelMetadata;
if (scope != null && scope == ControllerScopeType.Organ && prop.PropertyName == "OrganId")
{
Html.Hidden(prop.PropertyName);
@Html.Hidden(prop.PropertyName)
continue;
}
if (prop.HideSurroundingHtml)
{
@Html.Hidden(prop.PropertyName)
continue;
}
var uihit = prop.DataTypeName ?? prop.TemplateHint;

@ -3,7 +3,6 @@
@using Infrastructure.Web.Mvc
@{
var scope = (Url.ActionContext.ActionDescriptor as ControllerActionDescriptor).ControllerTypeInfo.GetCustomAttribute<ControllerScopeAttribute>()?.Scope;
var inputClass = "form-control";
}
@foreach (var prop in ViewData.ModelMetadata.Properties.Where(pm => pm.ShowForEdit))
{
@ -24,6 +23,10 @@
{
uihit = "SearchTemplates/Boolean.cshtml";
}
if (uihit == "MultilineText")
{
uihit = "String";
}
<div class="col-12 col-sm-6 col-md-4 col-lg-3">
<div class="form-group row">
<label class="col-sm-3 col-form-label" for="@prop.PropertyName" data-ui="@uihit @prop.UnderlyingOrModelType">@prop.GetDisplayName():</label>

@ -1,22 +1,20 @@
@{
var scope = ViewBag.ControllerScope as string;
var props = ViewData.ModelMetadata.Properties.Where(pm => pm.ShowForEdit && !pm.HideSurroundingHtml && !pm.IsComplexType && !pm.IsCollectionType && pm.PropertyName != "Id").ToList();
@using System.Reflection
@using Microsoft.AspNetCore.Mvc.Controllers
@using Infrastructure.Web.Mvc
@{
var scope = (Url.ActionContext.ActionDescriptor as ControllerActionDescriptor).ControllerTypeInfo.GetCustomAttribute<ControllerScopeAttribute>()?.Scope;
var props = ViewData.ModelMetadata.Properties.Where(pm => pm.ShowForEdit && !pm.HideSurroundingHtml && !pm.IsComplexType && !pm.IsCollectionType);
}
@{
foreach (var prop in props)
{
if(scope=="Organ"&&prop.PropertyName=="OrganId")
if (scope != null && scope == ControllerScopeType.Organ && prop.PropertyName == "OrganId")
{
continue;
continue;
}
var templateName = prop.DataTypeName ?? prop.TemplateHint ?? (prop.ModelType == typeof(string) ? typeof(string).Name : null);
<td style="max-width:10em;" data-ext="@templateName">
@if (prop.UnderlyingOrModelType == typeof(bool))
{
@Html.CheckBox(prop.PropertyName, new { disabled = "disabled", style = "width:20px;height:20px;margin:2px 0;" })
}
else
{
@Html.Display(prop.PropertyName, templateName)
}
@Html.Display(prop.PropertyName, templateName)
</td>
}
}

@ -85,11 +85,11 @@
<h1>@HtmlTitle</h1>
</div>
<div class="col-sm-6">
@*<ol class="breadcrumb float-sm-right">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="@Url.Action("Index","Home")">首页</a></li>
@RenderSection("bread", false)
<li class="breadcrumb-item active">@HtmlTitle</li>
</ol>*@
</ol>
</div>
</div>
}

@ -76,5 +76,9 @@ th {
}
h1 {
font-size: 2em;
font-size: 1.5rem;
margin:1rem 0 0 0;
}
.breadcrumb.float-sm-right{
background-color:transparent;
}

@ -39,11 +39,11 @@ namespace IoT.Shared.Areas.Admin.Controllers
entity.PasswordHash = this._encrypitonService.CreatePasswordHash(model.Password, entity.SecurityStamp);
entity.PasswordConfirmed = true;
}
if (string.IsNullOrEmpty(model.Email))
if (!string.IsNullOrEmpty(model.Email))
{
entity.EmailConfirmed = true;
}
if (string.IsNullOrEmpty(model.PhoneNumber))
if (!string.IsNullOrEmpty(model.PhoneNumber))
{
entity.PhoneNumberConfirmed = true;
}

@ -43,25 +43,25 @@
@if (User.Identity.IsAuthenticated)
{
var displayName = User.Claims.FirstOrDefault(o => o.Type == System.Security.Claims.ClaimTypes.GivenName)?.Value ?? User.Identity.Name;
var avatar= User.Claims.FirstOrDefault(o => o.Type == "Avatar")?.Value ?? Url.Content2("~/images/empty.svg");
<li class="nav-item">
<a title="avatar" href="@Url.Action("Index","Account",new { area=""})" class=""><img class="img-circle logo" src="@avatar" /></a>
</li>
<li class="nav-item">
<a title="avatar" href="@Url.Action("Index","Account",new { area=""})" class="@GetLinkClass(area:"",controller:"Account")">@displayName</a>
</li>
<li class="nav-item">
<a class="nav-link" href="@Url.Action("Logout","Account",new { area=""})" click="logout">退出</a>
</li>
var avatar = User.Claims.FirstOrDefault(o => o.Type == "Avatar")?.Value ?? Url.Content2("~/images/empty.svg");
<li class="nav-item">
<a title="avatar" href="@Url.Action("Index","Account",new { area=""})" class=""><img class="img-circle logo" src="@avatar" /></a>
</li>
<li class="nav-item">
<a title="avatar" href="@Url.Action("Index","Account",new { area=""})" class="@GetLinkClass(area:"",controller:"Account")">@displayName</a>
</li>
<li class="nav-item">
<a class="nav-link" href="@Url.Action("Logout","Account",new { area=""})" click="logout">退出</a>
</li>
}
else
{
<li class="nav-item">
<a class="nav-link" href="@Url.Action("Register","Account",new { area=""})">注册</a>
</li>
<li class="nav-item">
<a class="nav-link" href="@Url.Action("Login","Account",new { area=""})">登录</a>
</li>
<li class="nav-item">
<a class="nav-link" href="@Url.Action("Register","Account",new { area=""})">注册</a>
</li>
<li class="nav-item">
<a class="nav-link" href="@Url.Action("Login","Account",new { area=""})">登录</a>
</li>
}
</ul>
</nav>
@ -73,7 +73,7 @@
var organs = new List<Organ>();
var organIdValue = User.Claims.FirstOrDefault(o => o.Type == System.Security.Claims.ClaimTypes.UserData)?.Value;
var organId = Guid.Empty;
if (User.Identity.IsAuthenticated && Guid.TryParse(organIdValue ,out organId))
if (User.Identity.IsAuthenticated && Guid.TryParse(organIdValue, out organId))
{
var userName = User.Identity.Name;
organs = organUserRepo.ReadOnlyTable()
@ -89,18 +89,18 @@
{
var organImage = organs.FirstOrDefault(o => o.Id == organId)?.Image ?? logo;
var list = new SelectList(organs, "Id", "Name", organId);
<img class="logo" src="@Url.Content2(organImage)" />
<span class="brand-text font-weight-light">
<form method="get" action="@Url.Action("ChangeOrgan","Account",new{area=""})">
<input type="hidden" name="ReturnUrl" value="@ViewContext.HttpContext.Request.GetDisplayUrl()" />
@Html.DropDownList("UserCurrentOrganNumber", list,new { @class = "organ submit",style="background-color:#343a40;border-color: #343a40;" })
</form>
</span>
<img class="logo" src="@Url.Content2(organImage)" />
<span class="brand-text font-weight-light">
<form method="get" action="@Url.Action("ChangeOrgan","Account",new{area=""})">
<input type="hidden" name="ReturnUrl" value="@ViewContext.HttpContext.Request.GetDisplayUrl()" />
@Html.DropDownList("UserCurrentOrganNumber", list, new { @class = "organ submit", style = "background-color:#343a40;border-color: #343a40;" })
</form>
</span>
}
else
{
<img class="logo" src="@Url.Content2(logo)" />
<span class="brand-text font-weight-light">@name</span>
<img class="logo" src="@Url.Content2(logo)" />
<span class="brand-text font-weight-light">@name</span>
}
}
</div>
@ -122,18 +122,18 @@
<div class="container-fluid">
@if (!HideBread)
{
<div class="row mb-2">
<div class="col-sm-6">
<h1>@HtmlTitle</h1>
<div class="row mb-2">
<div class="col-sm-6">
<h1>@HtmlTitle</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="@Url.Action("Index","Home")">首页</a></li>
@RenderSection("bread", false)
<li class="breadcrumb-item active">@HtmlTitle</li>
</ol>
</div>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="@Url.Action("Index","Home")">首页</a></li>
@RenderSection("bread", false)
<li class="breadcrumb-item active">@HtmlTitle</li>
</ol>
</div>
</div>
}
@RenderBody()
</div>
@ -146,7 +146,7 @@
<strong>
@Html.Raw(string.Format(copyright, DateTime.Now.Year.ToString()))
</strong>
<div class="float-right d-none d-sm-inline-block">
<div class="float-right d-none d-sm-inline-block" style="padding-right:60px;">
<b>v @Helper.Instance.GetVersion()</b>
</div>
</footer>

Loading…
Cancel
Save