From 00e0b0b5e8497d2aa05d8d2b4aa77918f1650eb0 Mon Sep 17 00:00:00 2001 From: Argo-MacBookPro Date: Fri, 10 Aug 2018 16:05:24 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E4=BB=A3=E7=A0=81=EF=BC=9A?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E8=AE=BE=E8=AE=A1=E7=BD=91=E7=AB=99=E7=9A=AE?= =?UTF-8?q?=E8=82=A4=E9=80=BB=E8=BE=91=EF=BC=8C=E7=A7=BB=E9=99=A4=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E7=AB=AF=E8=AF=B7=E6=B1=82api/css=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/AdminController.cs | 2 +- .../Controllers/Api/CssController.cs | 33 ------------------- Bootstrap.Admin/Models/ModelBase.cs | 5 +++ Bootstrap.Admin/Models/ProfilesModel.cs | 8 +---- Bootstrap.Admin/Models/ThemeModel.cs | 26 +++++++++++++++ Bootstrap.Admin/Views/Admin/Profiles.cshtml | 2 +- Bootstrap.Admin/Views/Admin/Settings.cshtml | 16 +++++++-- Bootstrap.Admin/Views/Shared/Footer.cshtml | 2 +- Bootstrap.Admin/Views/Shared/Header.cshtml | 2 +- Bootstrap.Admin/Views/Shared/_Layout.cshtml | 7 +++- Bootstrap.Admin/wwwroot/js/Longbow.Common.js | 16 ++------- Bootstrap.Admin/wwwroot/js/Settings.js | 16 +-------- Bootstrap.DataAccess/DictHelper.cs | 7 ++-- 13 files changed, 63 insertions(+), 79 deletions(-) delete mode 100644 Bootstrap.Admin/Controllers/Api/CssController.cs create mode 100644 Bootstrap.Admin/Models/ThemeModel.cs diff --git a/Bootstrap.Admin/Controllers/AdminController.cs b/Bootstrap.Admin/Controllers/AdminController.cs index 9b7292ed..d12e60ea 100644 --- a/Bootstrap.Admin/Controllers/AdminController.cs +++ b/Bootstrap.Admin/Controllers/AdminController.cs @@ -89,7 +89,7 @@ namespace Bootstrap.Admin.Controllers /// public ActionResult Settings() { - return View(new NavigatorBarModel(this)); + return View(new ThemeModel(this)); } /// diff --git a/Bootstrap.Admin/Controllers/Api/CssController.cs b/Bootstrap.Admin/Controllers/Api/CssController.cs deleted file mode 100644 index da85ecb2..00000000 --- a/Bootstrap.Admin/Controllers/Api/CssController.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Bootstrap.DataAccess; -using Bootstrap.Security; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using System.Collections.Generic; -using System.Linq; - -namespace Bootstrap.Admin.Controllers.Api -{ - [Route("api/[controller]")] - public class CssController : Controller - { - /// - /// 获得当前样式接口 - /// - /// - [HttpGet] - [AllowAnonymous] - public JsonResult Get() - { - return new JsonResult(DictHelper.RetrieveActiveCss().FirstOrDefault().Code); - } - /// - /// 获得网站所有样式表 - /// - /// - [HttpPost] - public IEnumerable Post() - { - return DictHelper.RetrieveWebCss(); - } - } -} diff --git a/Bootstrap.Admin/Models/ModelBase.cs b/Bootstrap.Admin/Models/ModelBase.cs index 0eddb7cb..03d35ee0 100644 --- a/Bootstrap.Admin/Models/ModelBase.cs +++ b/Bootstrap.Admin/Models/ModelBase.cs @@ -14,6 +14,7 @@ namespace Bootstrap.Admin.Models { Title = DictHelper.RetrieveWebTitle(); Footer = DictHelper.RetrieveWebFooter(); + Theme = DictHelper.RetrieveActiveTheme(); } /// /// @@ -23,5 +24,9 @@ namespace Bootstrap.Admin.Models /// /// public string Footer { get; private set; } + /// + /// + /// + public string Theme { get; private set; } } } \ No newline at end of file diff --git a/Bootstrap.Admin/Models/ProfilesModel.cs b/Bootstrap.Admin/Models/ProfilesModel.cs index 4f8f7d8c..b30cea60 100644 --- a/Bootstrap.Admin/Models/ProfilesModel.cs +++ b/Bootstrap.Admin/Models/ProfilesModel.cs @@ -10,17 +10,13 @@ namespace Bootstrap.Admin.Models /// /// /// - public class ProfilesModel : NavigatorBarModel + public class ProfilesModel : ThemeModel { /// /// 获得/设置 头像文件大小 /// public long Size { get; } /// - /// 获得 系统配置的所有样式表 - /// - public IEnumerable Csss { get; } - /// /// /// /// @@ -32,8 +28,6 @@ namespace Bootstrap.Admin.Models { Size = new FileInfo(fileName).Length; } - - Csss = DictHelper.RetrieveWebCss(); } } } \ No newline at end of file diff --git a/Bootstrap.Admin/Models/ThemeModel.cs b/Bootstrap.Admin/Models/ThemeModel.cs new file mode 100644 index 00000000..1171fc58 --- /dev/null +++ b/Bootstrap.Admin/Models/ThemeModel.cs @@ -0,0 +1,26 @@ +using Bootstrap.DataAccess; +using Bootstrap.Security; +using Microsoft.AspNetCore.Mvc; +using System.Collections.Generic; + +namespace Bootstrap.Admin.Models +{ + /// + /// + /// + public class ThemeModel : NavigatorBarModel + { + /// + /// + /// + /// + public ThemeModel(ControllerBase controller) : base(controller) + { + Themes = DictHelper.RetrieveThemes(); + } + /// + /// 获得 系统配置的所有样式表 + /// + public IEnumerable Themes { get; } + } +} diff --git a/Bootstrap.Admin/Views/Admin/Profiles.cshtml b/Bootstrap.Admin/Views/Admin/Profiles.cshtml index 17125df6..043691c0 100644 --- a/Bootstrap.Admin/Views/Admin/Profiles.cshtml +++ b/Bootstrap.Admin/Views/Admin/Profiles.cshtml @@ -84,7 +84,7 @@