diff --git a/Bootstrap.Admin/Content/css/site.css b/Bootstrap.Admin/Content/css/site.css index a9dc7125..f40533c1 100644 --- a/Bootstrap.Admin/Content/css/site.css +++ b/Bootstrap.Admin/Content/css/site.css @@ -396,6 +396,10 @@ a.logo { margin-bottom: 15px; } + .modal-dialog .modal-body .form-inline .form-group input { + padding-right: 30px; + } + .modal-header { background-color: #f5f5f5; border-top-left-radius: 6px; @@ -456,7 +460,7 @@ input.valid { padding-left: 6px; } -.lgbBreadcrumb { +ul.breadcrumb { position: absolute; top: 56px; left: 15px; @@ -464,20 +468,19 @@ input.valid { border-color: #ddd; border-width: 1px 0 0 0; border-style: solid; + background-color: transparent; + border-top-left-radius: 0; + border-top-right-radius: 0; } - .lgbBreadcrumb > ul { - background-color: transparent; + ul.breadcrumb > li.active { + display: inline-block; } - .lgbBreadcrumb > ul > li.active { - display: inline-block; - } + ul.breadcrumb > li.load { + display: none; + } - .lgbBreadcrumb > ul > li.load { - display: none; - } - - .lgbBreadcrumb > ul > li > a > i { - padding-right: 6px; - } + ul.breadcrumb > li > a > i { + padding-right: 6px; + } diff --git a/Bootstrap.Admin/Content/js/Longbow.Common.js b/Bootstrap.Admin/Content/js/Longbow.Common.js index 44004b4b..93fc3bda 100644 --- a/Bootstrap.Admin/Content/js/Longbow.Common.js +++ b/Bootstrap.Admin/Content/js/Longbow.Common.js @@ -164,6 +164,11 @@ })(jQuery); $(function () { + // breadcrumb + var breadcrumb = $('.sidebar-menu > li > a.active > span').text(); + if (breadcrumb === "") $('.breadcrumb > li + li').hide(); + else $('.breadcrumb > li + li').text(breadcrumb); + if ($.isFunction($.validator)) { jQuery.validator.addMethod("ip", function (value, element) { return this.optional(element) || /^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])$/.test(value); diff --git a/Bootstrap.Admin/Controllers/AdminController.cs b/Bootstrap.Admin/Controllers/AdminController.cs index dded4a5e..f2303aa9 100644 --- a/Bootstrap.Admin/Controllers/AdminController.cs +++ b/Bootstrap.Admin/Controllers/AdminController.cs @@ -26,7 +26,6 @@ namespace Bootstrap.Admin.Controllers public ActionResult Users() { var v = new NavigatorBarModel(); - v.BreadcrumbName = "用户管理"; v.ShowMenu = "hide"; v.Menus[1].Active = "active"; v.HomeUrl = "~/Admin"; @@ -39,7 +38,6 @@ namespace Bootstrap.Admin.Controllers public ActionResult Groups() { var v = new NavigatorBarModel(); - v.BreadcrumbName = "部门管理"; v.ShowMenu = "hide"; v.Menus[3].Active = "active"; v.HomeUrl = "~/Admin"; @@ -48,7 +46,6 @@ namespace Bootstrap.Admin.Controllers public ActionResult Roles() { var v = new NavigatorBarModel(); - v.BreadcrumbName = "角色管理"; v.ShowMenu = "hide"; v.Menus[2].Active = "active"; v.HomeUrl = "~/Admin"; @@ -57,7 +54,6 @@ namespace Bootstrap.Admin.Controllers public ActionResult Menus() { var v = new NavigatorBarModel(); - v.BreadcrumbName = "菜单管理"; v.ShowMenu = "hide"; v.Menus[0].Active = "active"; v.HomeUrl = "~/Admin"; diff --git a/Bootstrap.Admin/Models/HeaderBarModel.cs b/Bootstrap.Admin/Models/HeaderBarModel.cs index 80058ba4..632dab07 100644 --- a/Bootstrap.Admin/Models/HeaderBarModel.cs +++ b/Bootstrap.Admin/Models/HeaderBarModel.cs @@ -26,10 +26,6 @@ namespace Bootstrap.Admin.Models /// /// /// - public string BreadcrumbName { get; set; } - /// - /// - /// public string ShowMenu { get; set; } /// /// diff --git a/Bootstrap.Admin/Models/NavigatorBarModel.cs b/Bootstrap.Admin/Models/NavigatorBarModel.cs index d660a68b..8fd25a9e 100644 --- a/Bootstrap.Admin/Models/NavigatorBarModel.cs +++ b/Bootstrap.Admin/Models/NavigatorBarModel.cs @@ -1,5 +1,6 @@ using Bootstrap.DataAccess; using System.Collections.Generic; +using System.Linq; namespace Bootstrap.Admin.Models { @@ -7,7 +8,8 @@ namespace Bootstrap.Admin.Models { public NavigatorBarModel() { - Menus = Menu.RetrieveMenus(); + Menus = MenuHelper.RetrieveMenus().ToList(); + Menus.ForEach(m => m.Active = null); } /// /// diff --git a/Bootstrap.Admin/Models/QueryMenuOption.cs b/Bootstrap.Admin/Models/QueryMenuOption.cs index abbacd7e..833d45b6 100644 --- a/Bootstrap.Admin/Models/QueryMenuOption.cs +++ b/Bootstrap.Admin/Models/QueryMenuOption.cs @@ -1,41 +1,36 @@ -using Bootstrap.DataAccess; -using Longbow.Web.Mvc; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; - -namespace Bootstrap.Admin.Models -{ - public class QueryMenuOption : PaginationOption - { - /// - /// - /// - public string Name { get; set; } - /// - /// - /// - public string Category { get; set; } - - public QueryData RetrieveData() - { - // int limit, int offset, string name, string price, string sort, string order - var data = MenuHelper.RetrieveMenus(string.Empty); - if (!string.IsNullOrEmpty(Name)) - { - data = data.Where(t => t.Name.Contains(Name)); - } - if (!string.IsNullOrEmpty(Category)) - { - data = data.Where(t => t.Category.Contains(Category)); - } - var ret = new QueryData(); - ret.total = data.Count(); - // TODO: 通过option.Sort属性判断对那列进行排序,现在统一对名称列排序 - data = Order == "asc" ? data.OrderBy(t => t.Name) : data.OrderByDescending(t => t.Name); - ret.rows = data.Skip(Offset).Take(Limit); - return ret; - } - } +using Bootstrap.DataAccess; +using Longbow.Web.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace Bootstrap.Admin.Models +{ + public class QueryMenuOption : PaginationOption + { + /// + /// + /// + public string Name { get; set; } + /// + /// + /// + public string Category { get; set; } + + public QueryData RetrieveData() + { + var data = MenuHelper.RetrieveMenus(); + if (!string.IsNullOrEmpty(Name)) + { + data = data.Where(t => t.Name.Contains(Name)); + } + var ret = new QueryData(); + ret.total = data.Count(); + // TODO: 通过option.Sort属性判断对那列进行排序,现在统一对名称列排序 + data = Order == "asc" ? data.OrderBy(t => t.Name) : data.OrderByDescending(t => t.Name); + ret.rows = data.Skip(Offset).Take(Limit); + return ret; + } + } } \ No newline at end of file diff --git a/Bootstrap.Admin/Scripts/Menus.js b/Bootstrap.Admin/Scripts/Menus.js index 310964f5..f18addfd 100644 --- a/Bootstrap.Admin/Scripts/Menus.js +++ b/Bootstrap.Admin/Scripts/Menus.js @@ -1,53 +1,51 @@ -$(function () { - var bsa = new BootstrapAdmin({ - url: '../api/Menus', - dataEntity: new DataEntity({ - map: { - ID: "menuID", - ParentId: "parentId", - Name: "name", - Order: "order", - Icon: "icon", - Url: "url", - Category: "category" - } - }) - }); - - $('table').smartTable({ - url: '../api/Menus', //请求后台的URL(*) - sortName: 'UserName', - queryParams: function (params) { return $.extend(params, { name: $("#txt_menus_name").val(), category: $('#txt_menus_category').val() }); }, //传递参数(*) - columns: [{ checkbox: true }, - { title: "Id", field: "ID", events: bsa.idEvents(), formatter: BootstrapAdmin.idFormatter }, - { title: "父级Id", field: "ParentId", sortable: false }, - { title: "菜单名称", field: "Name", sortable: true }, - { title: "菜单序号", field: "Order", sortable: false }, - { title: "菜单图标", field: "Icon", sortable: false }, - { title: "菜单路径", field: "Url", sortable: false }, - { title: "菜单类别", field: "Category", sortable: false } - ] - }); - - // validate - $('#dataForm').autoValidate({ - name: { - required: true, - maxlength: 50 - }, - icon: { - required: true, - maxlength: 50 - }, - url: { - required: true, - maxlength: 50 - }, - category: { - required: true, - maxlength: 50 - } - }); - - //TODO: 客户端点击保存用户后,要更新页面右上角用户显示名称 +$(function () { + var bsa = new BootstrapAdmin({ + url: '../api/Menus', + dataEntity: new DataEntity({ + map: { + ID: "menuID", + ParentId: "parentId", + Name: "name", + Order: "order", + Icon: "icon", + Url: "url", + Category: "category" + } + }) + }); + + $('table').smartTable({ + url: '../api/Menus', //请求后台的URL(*) + sortName: 'UserName', + queryParams: function (params) { return $.extend(params, { name: $("#txt_menus_name").val(), category: $('#txt_menus_category').val() }); }, //传递参数(*) + columns: [{ checkbox: true }, + { title: "Id", field: "ID", events: bsa.idEvents(), formatter: BootstrapAdmin.idFormatter }, + { title: "父级Id", field: "ParentId", sortable: false }, + { title: "菜单名称", field: "Name", sortable: true }, + { title: "菜单序号", field: "Order", sortable: false }, + { title: "菜单图标", field: "Icon", sortable: false }, + { title: "菜单路径", field: "Url", sortable: false }, + { title: "菜单类别", field: "Category", sortable: false } + ] + }); + + // validate + $('#dataForm').autoValidate({ + name: { + required: true, + maxlength: 50 + }, + icon: { + required: true, + maxlength: 50 + }, + url: { + required: true, + maxlength: 50 + }, + category: { + required: true, + maxlength: 50 + } + }); }); \ No newline at end of file diff --git a/Bootstrap.Admin/Views/Shared/Header.cshtml b/Bootstrap.Admin/Views/Shared/Header.cshtml index 25cb49dc..e28f5347 100644 --- a/Bootstrap.Admin/Views/Shared/Header.cshtml +++ b/Bootstrap.Admin/Views/Shared/Header.cshtml @@ -33,7 +33,7 @@ @Model.DisplayName - +