Skip to content

Commit

Permalink
DropDownTree template.
Browse files Browse the repository at this point in the history
  • Loading branch information
SeriaWei committed Sep 1, 2024
1 parent 62025fb commit 68d60f4
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
@using Easy.ViewPort.jsTree
@using ZKEACMS.Article.Models

@model int?
@model object
@{
var descriptor = ViewData.ModelMetadata.GetViewDescriptor();
Script.Reqiured("jsTree").AtFoot();
Script.Reqiured("dropdown-tree").AtFoot();
Style.Reqiured("jsTree").AtHead();
Script.Reqiured("dropdown-tree").AtFoot();
Style.Reqiured("dropdown-tree").AtHead();
var categoryTree = Html.Tree<ArticleType>().Source("GetArticleTypeTree", "ArticleType", new { module = "admin" })

var descriptor = ViewData.ModelMetadata.GetViewDescriptor();
var categoryTree = Html.Tree<object>().Source(descriptor.Properties["action"], descriptor.Properties["controller"], new { module = descriptor.Properties["module"] })
.On(Events.Loaded, "dropdownTreeLoaded")
.On(Events.ActiveNode, "dropdownTreeSelectted");

Expand Down

This file was deleted.

6 changes: 2 additions & 4 deletions src/ZKEACMS/Article/Models/ArticleEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ protected override void ViewConfigure()
ViewConfig(m => m.ImageThumbUrl).AsTextBox().MediaSelector();
ViewConfig(m => m.ImageUrl).AsTextBox().MediaSelector();
ViewConfig(m => m.ArticleTypeID)
.AsDropDownList()
.DataSource(ViewDataKeys.ArticleCategory, SourceType.ViewData)
.Required()
.SetTemplate("ArticleTypeTree")
.AsDropDownTree("GetArticleTypeTree", "ArticleType", "admin")
.Required()
.ShowInGrid();

ViewConfig(m => m.ArticleContent).AsTextArea().AddClass(StringKeys.HtmlEditorClass);
Expand Down
9 changes: 9 additions & 0 deletions src/ZKEACMS/Extend/TagsHelperExtend.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,14 @@ public static TextBoxDescriptor AsProductSelector(this TagsHelper helper)
descriptor.ReadOnly();
return descriptor;
}
public static DropDownListDescriptor AsDropDownTree(this TagsHelper helper, string action, string controller, string module)
{
var descriptor = helper.AsDropDownList();
descriptor.SetTemplate("DropDownTree");
descriptor.AddProperty("action", action);
descriptor.AddProperty("controller", controller);
descriptor.AddProperty("module", module);
return descriptor;
}
}
}
4 changes: 1 addition & 3 deletions src/ZKEACMS/Product/Models/Product.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,8 @@ protected override void ViewConfigure()
ViewConfig(m => m.PartNumber).AsTextBox().ShowInGrid().Search(Query.Operators.Contains);
ViewConfig(m => m.BrandCD).AsHidden();
ViewConfig(m => m.ProductCategoryID)
.AsDropDownList()
.AsDropDownTree("GetProductCategoryTree", "ProductCategory", "admin")
.Required()
.DataSource(ViewDataKeys.ProductCategory, SourceType.ViewData)
.SetTemplate("ProductCategoryTree")
.ShowInGrid();

ViewConfig(m => m.ProductTags).AsTextBox().SetTemplate("TagSelector");
Expand Down

0 comments on commit 68d60f4

Please sign in to comment.