自动生成菜单,相应控制其方法加上DisplayName、Description特性
This commit is contained in:
@@ -307,3 +307,4 @@ COMCMS.Web/wwwroot/userfiles/
|
||||
/COMCMS.Web/COMCMS.Web.csproj.DotSettings
|
||||
/COMCMS.Web/UploadFile
|
||||
/COMCMS.Web/UploadTemp
|
||||
/WebTest/wwwroot
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -12,6 +13,8 @@ using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
[DisplayName("文章系统")]
|
||||
[Description("文章系统管理,包括文章、文章栏目")]
|
||||
public class ArticleController : AdminBaseController
|
||||
{
|
||||
#region 文章栏目
|
||||
@@ -20,6 +23,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[MyAuthorize( "viewlist", "articlecategory")]
|
||||
[DisplayName("文章栏目")]
|
||||
public IActionResult ArticleCategoryList()
|
||||
{
|
||||
IList<ArticleCategory> list = ArticleCategory.GetListTree(0, -1, false, true);
|
||||
@@ -189,6 +193,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[MyAuthorize("viewlist", "article")]
|
||||
[DisplayName("文章")]
|
||||
public IActionResult ArticleList()
|
||||
{
|
||||
//获取上级栏目
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
ViewBag.ListKinds = list;
|
||||
return View();
|
||||
}
|
||||
[MyAuthorize("viewlist", "guestbook")]
|
||||
[MyAuthorize("viewlist", "guestbook","JSON")]
|
||||
public IActionResult GetGuesbookList(string keyword, int page = 1, int limit = 20)
|
||||
{
|
||||
int numPerPage, currentPage, startRowIndex;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -19,6 +20,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
/// <summary>
|
||||
/// 后台用户管理控制器
|
||||
/// </summary>
|
||||
[DisplayName("管理员")]
|
||||
public class MemberController : AdminBaseController
|
||||
{
|
||||
#region 修改密码
|
||||
@@ -115,6 +117,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
|
||||
#region 管理组管理
|
||||
[MyAuthorize("viewlist", "adminrole")]
|
||||
[DisplayName("管理组")]
|
||||
public IActionResult AdminRole()
|
||||
{
|
||||
IList<AdminRoles> list = AdminRoles.FindAll(AdminRoles._.Id > 0, AdminRoles._.Rank.Asc(), null, 0, 0);
|
||||
@@ -366,6 +369,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
#region 管理员管理
|
||||
//管理员管理
|
||||
[MyAuthorize("viewlist", "admins")]
|
||||
[DisplayName("管理员")]
|
||||
public IActionResult Admins()
|
||||
{
|
||||
//加载管理组
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -13,6 +14,7 @@ using Microsoft.AspNetCore.Http;
|
||||
namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
{
|
||||
[Area("AdminCP")]
|
||||
[DisplayName("后台权限")]
|
||||
public class PermissionController : AdminBaseController
|
||||
{
|
||||
#region 事件管理
|
||||
@@ -107,6 +109,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
#region 后台栏目管理
|
||||
//后台菜单列表
|
||||
[MyAuthorize( "viewlist", "adminmenu")]
|
||||
[DisplayName("后台栏目")]
|
||||
public IActionResult AdminMenuList()
|
||||
{
|
||||
IList<AdminMenu> list = AdminMenu.GetListTree(0, -1, false, true);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MailKit" Version="2.0.7" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.5" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.5" />
|
||||
<PackageReference Include="MimeKit" Version="2.0.7" />
|
||||
<PackageReference Include="MySql.Data" Version="8.0.13" />
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using COMCMS.Core;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NewLife.Reflection;
|
||||
using XCode;
|
||||
|
||||
namespace COMCMS.Web.Common
|
||||
{
|
||||
public class MenuRegister
|
||||
{
|
||||
private static void StartRegister()
|
||||
{
|
||||
// 操作项定义
|
||||
var menuEventDic = new Dictionary<string, KeyValuePair<int, string>>
|
||||
{
|
||||
{ "add",new KeyValuePair<int, string>(1,"添加")},
|
||||
{ "edit",new KeyValuePair<int, string>(2,"修改")},
|
||||
{ "del",new KeyValuePair<int, string>(3,"删除")},
|
||||
{ "view",new KeyValuePair<int, string>(4,"查看")},
|
||||
{ "viewlist",new KeyValuePair<int, string>(5,"查看列表")},
|
||||
{ "import",new KeyValuePair<int, string>(6,"导入")},
|
||||
{ "export",new KeyValuePair<int, string>(7,"导出")},
|
||||
{ "filter",new KeyValuePair<int, string>(8,"搜索")},
|
||||
{ "batch",new KeyValuePair<int, string>(9,"批量操作")},
|
||||
{ "recycle",new KeyValuePair<int, string>(10,"回收站")},
|
||||
{ "confirm",new KeyValuePair<int, string>(11,"确认")},
|
||||
|
||||
};
|
||||
|
||||
var asms = AppDomain.CurrentDomain.GetAssemblies();
|
||||
foreach (var asmItem in asms)
|
||||
{
|
||||
var types = asmItem.GetTypes().Where(e => e.Name.EndsWith("Controller")).ToList();
|
||||
if (types.Count == 0) continue;
|
||||
|
||||
foreach (var type in types)
|
||||
{
|
||||
// 控制器名称
|
||||
var ctrName = type.Name.TrimEnd("Controller");
|
||||
|
||||
// 控制器展示名
|
||||
var ctrDpName = type.GetDisplayName();
|
||||
|
||||
var ctrDes = type.GetDescription();
|
||||
|
||||
var url = ctrName;
|
||||
|
||||
var fAdminMenu = AdminMenu.Find(AdminMenu._.MenuKey == ctrName + "Sys" & AdminMenu._.Link == "#");
|
||||
var nAdminMenu = new AdminMenu
|
||||
{
|
||||
Description = ctrDes,
|
||||
IsHide = 0,
|
||||
Level = 0,
|
||||
Link = "#",
|
||||
Location = "0,",
|
||||
MenuKey = ctrName + "Sys",
|
||||
MenuName = ctrDpName,
|
||||
PId = 0
|
||||
};
|
||||
var pAdminMenu = fAdminMenu ?? nAdminMenu;
|
||||
if (pAdminMenu.Id > 0)
|
||||
{
|
||||
pAdminMenu.Description = nAdminMenu.Description;
|
||||
pAdminMenu.MenuName = nAdminMenu.MenuName;
|
||||
}
|
||||
pAdminMenu.Save();
|
||||
|
||||
// 控制器所有包含MyAuthorizeAttribute的方法
|
||||
var acts = type.GetMethods()
|
||||
.Where(w => w.IsDefined(typeof(MyAuthorizeAttribute)))
|
||||
.ToList();
|
||||
|
||||
if (!acts.Any()) continue;
|
||||
|
||||
var eventKeyDic = new Dictionary<string, int>();
|
||||
var adminMenuEventList = new List<AdminMenuEvent>();
|
||||
|
||||
foreach (var method in acts)
|
||||
{
|
||||
var dn = method.GetDisplayName();
|
||||
var methodDes = method.GetDescription();
|
||||
var actName = method.Name;
|
||||
var myAuthorize = method.GetCustomAttribute<MyAuthorizeAttribute>();
|
||||
|
||||
var menuKey = myAuthorize.GetValue("_menuKey").ToString();
|
||||
var eventKey = myAuthorize.GetValue("_eventKey").ToString();
|
||||
var returnType = myAuthorize.GetValue("_returnType").ToString();
|
||||
|
||||
//保存菜单
|
||||
if (eventKey == "viewlist" && returnType == "HTML")
|
||||
{
|
||||
var adminMenu = AdminMenu.Find(AdminMenu._.MenuKey == menuKey & AdminMenu._.Link == url + "/" + actName) ?? new AdminMenu
|
||||
{
|
||||
Description = methodDes,
|
||||
IsHide = 0,
|
||||
Level = pAdminMenu.Level + 1,
|
||||
Link = url + "/" + actName,
|
||||
Location = pAdminMenu.Location + ",",
|
||||
MenuKey = menuKey,
|
||||
MenuName = dn,
|
||||
PId = pAdminMenu.Id
|
||||
};
|
||||
adminMenu.Save();
|
||||
|
||||
eventKeyDic[menuKey] = adminMenu.Id;
|
||||
}
|
||||
|
||||
// 保存操作
|
||||
var adminmenuevent = AdminMenuEvent.Find(AdminMenuEvent._.MenuId == menuEventDic[eventKey].Key
|
||||
& AdminMenuEvent._.MenuKey == menuKey & AdminMenuEvent._.EventKey == eventKey)
|
||||
?? new AdminMenuEvent
|
||||
{
|
||||
MenuKey = menuKey,
|
||||
MenuId = menuEventDic[eventKey].Key,
|
||||
EventKey = eventKey,
|
||||
EventName = menuEventDic[eventKey].Value
|
||||
};
|
||||
adminMenuEventList.Add(adminmenuevent);
|
||||
}
|
||||
|
||||
adminMenuEventList.ForEach(f => f.MenuId = eventKeyDic.ContainsKey(f.MenuKey) ? eventKeyDic[f.MenuKey] : 0);
|
||||
adminMenuEventList.Save();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static void Register()
|
||||
{
|
||||
Task.Run(() => { StartRegister(); }).LogException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,9 @@ namespace COMCMS.Web
|
||||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
// 注册菜单
|
||||
MenuRegister.Register();
|
||||
|
||||
//注入自己的HttpContext
|
||||
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
||||
//services.AddMvc().AddSessionStateTempDataProvider();
|
||||
|
||||
+7
-1
@@ -15,7 +15,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "COMCMS.API", "COMCMS.API\CO
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lib.Core", "Lib.Core\Lib.Core.csproj", "{D95FC3C1-B035-4A19-A706-71C31DD1E52D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NewLife.UserGroup.WebUploader", "NewLife.UserGroup.WebUploader\NewLife.UserGroup.WebUploader.csproj", "{F8D6AE11-1436-44CA-BDD9-4AFD7B489DD0}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NewLife.UserGroup.WebUploader", "NewLife.UserGroup.WebUploader\NewLife.UserGroup.WebUploader.csproj", "{F8D6AE11-1436-44CA-BDD9-4AFD7B489DD0}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebTest", "WebTest\WebTest.csproj", "{9226DDB8-57D8-484A-9B3E-CB73CDB2F20B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -51,6 +53,10 @@ Global
|
||||
{F8D6AE11-1436-44CA-BDD9-4AFD7B489DD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F8D6AE11-1436-44CA-BDD9-4AFD7B489DD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F8D6AE11-1436-44CA-BDD9-4AFD7B489DD0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9226DDB8-57D8-484A-9B3E-CB73CDB2F20B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9226DDB8-57D8-484A-9B3E-CB73CDB2F20B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9226DDB8-57D8-484A-9B3E-CB73CDB2F20B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9226DDB8-57D8-484A-9B3E-CB73CDB2F20B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace WebTest
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
CreateWebHostBuilder(args).Build().Run();
|
||||
}
|
||||
|
||||
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
|
||||
WebHost.CreateDefaultBuilder(args)
|
||||
.UseStartup<MyStartup>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using COMCMS.Web;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.HttpsPolicy;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace WebTest
|
||||
{
|
||||
public class MyStartup : Startup
|
||||
{
|
||||
public MyStartup(IConfiguration configuration) : base(configuration)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//public class Startup
|
||||
//{
|
||||
// public Startup(IConfiguration configuration)
|
||||
// {
|
||||
// Configuration = configuration;
|
||||
// }
|
||||
|
||||
// public IConfiguration Configuration { get; }
|
||||
|
||||
// // This method gets called by the runtime. Use this method to add services to the container.
|
||||
// public void ConfigureServices(IServiceCollection services)
|
||||
// {
|
||||
// services.Configure<CookiePolicyOptions>(options =>
|
||||
// {
|
||||
// // This lambda determines whether user consent for non-essential cookies is needed for a given request.
|
||||
// options.CheckConsentNeeded = context => true;
|
||||
// options.MinimumSameSitePolicy = SameSiteMode.None;
|
||||
// });
|
||||
|
||||
|
||||
// services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
|
||||
// }
|
||||
|
||||
// // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
// public void Configure(IApplicationBuilder app, IHostingEnvironment env)
|
||||
// {
|
||||
// if (env.IsDevelopment())
|
||||
// {
|
||||
// app.UseDeveloperExceptionPage();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// app.UseExceptionHandler("/Home/Error");
|
||||
// app.UseHsts();
|
||||
// }
|
||||
|
||||
// app.UseHttpsRedirection();
|
||||
// app.UseStaticFiles();
|
||||
// app.UseCookiePolicy();
|
||||
|
||||
// app.UseMvc(routes =>
|
||||
// {
|
||||
// routes.MapRoute(
|
||||
// name: "default",
|
||||
// template: "{controller=Home}/{action=Index}/{id?}");
|
||||
// });
|
||||
// }
|
||||
//}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
@{
|
||||
ViewData["Title"] = "About";
|
||||
}
|
||||
<h2>@ViewData["Title"]</h2>
|
||||
<h3>@ViewData["Message"]</h3>
|
||||
|
||||
<p>Use this area to provide additional information.</p>
|
||||
@@ -0,0 +1,17 @@
|
||||
@{
|
||||
ViewData["Title"] = "Contact";
|
||||
}
|
||||
<h2>@ViewData["Title"]</h2>
|
||||
<h3>@ViewData["Message"]</h3>
|
||||
|
||||
<address>
|
||||
One Microsoft Way<br />
|
||||
Redmond, WA 98052-6399<br />
|
||||
<abbr title="Phone">P:</abbr>
|
||||
425.555.0100
|
||||
</address>
|
||||
|
||||
<address>
|
||||
<strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br />
|
||||
<strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a>
|
||||
</address>
|
||||
@@ -0,0 +1,94 @@
|
||||
@{
|
||||
ViewData["Title"] = "Home Page";
|
||||
}
|
||||
|
||||
<div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="6000">
|
||||
<ol class="carousel-indicators">
|
||||
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
|
||||
<li data-target="#myCarousel" data-slide-to="1"></li>
|
||||
<li data-target="#myCarousel" data-slide-to="2"></li>
|
||||
</ol>
|
||||
<div class="carousel-inner" role="listbox">
|
||||
<div class="item active">
|
||||
<img src="~/images/banner1.svg" alt="ASP.NET" class="img-responsive" />
|
||||
<div class="carousel-caption" role="option">
|
||||
<p>
|
||||
Learn how to build ASP.NET apps that can run anywhere.
|
||||
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkID=525028&clcid=0x409">
|
||||
Learn More
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<img src="~/images/banner2.svg" alt="Visual Studio" class="img-responsive" />
|
||||
<div class="carousel-caption" role="option">
|
||||
<p>
|
||||
There are powerful new features in Visual Studio for building modern web apps.
|
||||
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkID=525030&clcid=0x409">
|
||||
Learn More
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<img src="~/images/banner3.svg" alt="Microsoft Azure" class="img-responsive" />
|
||||
<div class="carousel-caption" role="option">
|
||||
<p>
|
||||
Learn how Microsoft's Azure cloud platform allows you to build, deploy, and scale web apps.
|
||||
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkID=525027&clcid=0x409">
|
||||
Learn More
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
|
||||
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
|
||||
<span class="sr-only">Previous</span>
|
||||
</a>
|
||||
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
|
||||
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
|
||||
<span class="sr-only">Next</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<h2>Application uses</h2>
|
||||
<ul>
|
||||
<li>Sample pages using ASP.NET Core MVC</li>
|
||||
<li>Theming using <a href="https://go.microsoft.com/fwlink/?LinkID=398939">Bootstrap</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<h2>How to</h2>
|
||||
<ul>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkID=398600">Add a Controller and View</a></li>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699315">Manage User Secrets using Secret Manager.</a></li>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699316">Use logging to log a message.</a></li>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699317">Add packages using NuGet.</a></li>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699319">Target development, staging or production environment.</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<h2>Overview</h2>
|
||||
<ul>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkId=518008">Conceptual overview of what is ASP.NET Core</a></li>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699320">Fundamentals of ASP.NET Core such as Startup and middleware.</a></li>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkId=398602">Working with Data</a></li>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkId=398603">Security</a></li>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkID=699321">Client side development</a></li>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkID=699322">Develop on different platforms</a></li>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkID=699323">Read more on the documentation site</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<h2>Run & Deploy</h2>
|
||||
<ul>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkID=517851">Run your app</a></li>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkID=517853">Run tools such as EF migrations and more</a></li>
|
||||
<li><a href="https://go.microsoft.com/fwlink/?LinkID=398609">Publish to Microsoft Azure Web Apps</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,6 @@
|
||||
@{
|
||||
ViewData["Title"] = "Privacy Policy";
|
||||
}
|
||||
<h2>@ViewData["Title"]</h2>
|
||||
|
||||
<p>Use this page to detail your site's privacy policy.</p>
|
||||
@@ -0,0 +1,41 @@
|
||||
@using Microsoft.AspNetCore.Http.Features
|
||||
|
||||
@{
|
||||
var consentFeature = Context.Features.Get<ITrackingConsentFeature>();
|
||||
var showBanner = !consentFeature?.CanTrack ?? false;
|
||||
var cookieString = consentFeature?.CreateConsentCookie();
|
||||
}
|
||||
|
||||
@if (showBanner)
|
||||
{
|
||||
<nav id="cookieConsent" class="navbar navbar-default navbar-fixed-top" role="alert">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#cookieConsent .navbar-collapse">
|
||||
<span class="sr-only">Toggle cookie consent banner</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<span class="navbar-brand"><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span></span>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse">
|
||||
<p class="navbar-text">
|
||||
Use this space to summarize your privacy and cookie use policy.
|
||||
</p>
|
||||
<div class="navbar-right">
|
||||
<a asp-controller="Home" asp-action="Privacy" class="btn btn-info navbar-btn">Learn More</a>
|
||||
<button type="button" class="btn btn-default navbar-btn" data-cookie-string="@cookieString">Accept</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<script>
|
||||
(function () {
|
||||
document.querySelector("#cookieConsent button[data-cookie-string]").addEventListener("click", function (el) {
|
||||
document.cookie = el.target.dataset.cookieString;
|
||||
document.querySelector("#cookieConsent").classList.add("hidden");
|
||||
}, false);
|
||||
})();
|
||||
</script>
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>@ViewData["Title"] - WebTest</title>
|
||||
|
||||
<environment include="Development">
|
||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
|
||||
<link rel="stylesheet" href="~/css/site.css" />
|
||||
</environment>
|
||||
<environment exclude="Development">
|
||||
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/css/bootstrap.min.css"
|
||||
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
|
||||
asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />
|
||||
<link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />
|
||||
</environment>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a asp-area="" asp-controller="Home" asp-action="Index" class="navbar-brand">WebTest</a>
|
||||
</div>
|
||||
<div class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a asp-area="" asp-controller="Home" asp-action="Index">Home</a></li>
|
||||
<li><a asp-area="" asp-controller="Home" asp-action="About">About</a></li>
|
||||
<li><a asp-area="" asp-controller="Home" asp-action="Contact">Contact</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<partial name="_CookieConsentPartial" />
|
||||
|
||||
<div class="container body-content">
|
||||
@RenderBody()
|
||||
<hr />
|
||||
<footer>
|
||||
<p>© 2018 - WebTest</p>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<environment include="Development">
|
||||
<script src="~/lib/jquery/dist/jquery.js"></script>
|
||||
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
|
||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||
</environment>
|
||||
<environment exclude="Development">
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.3.1.min.js"
|
||||
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
|
||||
asp-fallback-test="window.jQuery"
|
||||
crossorigin="anonymous"
|
||||
integrity="sha384-tsQFqpEReu7ZLhBV2VZlAu7zcOV+rXbYlF2cqB8txI/8aZajjp4Bqd+V6D5IgvKT">
|
||||
</script>
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/bootstrap.min.js"
|
||||
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
|
||||
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"
|
||||
crossorigin="anonymous"
|
||||
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa">
|
||||
</script>
|
||||
<script src="~/js/site.min.js" asp-append-version="true"></script>
|
||||
</environment>
|
||||
|
||||
@RenderSection("Scripts", required: false)
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,18 @@
|
||||
<environment include="Development">
|
||||
<script src="~/lib/jquery-validation/dist/jquery.validate.js"></script>
|
||||
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"></script>
|
||||
</environment>
|
||||
<environment exclude="Development">
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.17.0/jquery.validate.min.js"
|
||||
asp-fallback-src="~/lib/jquery-validation/dist/jquery.validate.min.js"
|
||||
asp-fallback-test="window.jQuery && window.jQuery.validator"
|
||||
crossorigin="anonymous"
|
||||
integrity="sha384-rZfj/ogBloos6wzLGpPkkOr/gpkBNLZ6b6yLy4o+ok+t/SAKlL5mvXLr0OXNi1Hp">
|
||||
</script>
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validation.unobtrusive/3.2.9/jquery.validate.unobtrusive.min.js"
|
||||
asp-fallback-src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
|
||||
asp-fallback-test="window.jQuery && window.jQuery.validator && window.jQuery.validator.unobtrusive"
|
||||
crossorigin="anonymous"
|
||||
integrity="sha384-ifv0TYDWxBHzvAk2Z0n8R434FL1Rlv/Av18DXE43N/1rvHyOG4izKst0f2iSLdds">
|
||||
</script>
|
||||
</environment>
|
||||
@@ -0,0 +1,2 @@
|
||||
@using WebTest
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@@ -0,0 +1,3 @@
|
||||
@{
|
||||
Layout = "_Layout";
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\COMCMS.Web\COMCMS.Web.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Controllers\" />
|
||||
<Folder Include="Models\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Debug",
|
||||
"System": "Information",
|
||||
"Microsoft": "Information"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
Reference in New Issue
Block a user