在 N2 CMS 上工作,我正在添加自己的内容类型Product
。我从中派生了我的 Product 类ContentPageBase
,我可以将它添加到内容树中。然而,当我编辑一个项目时,这些字段似乎是反转的(Title
和Text
)。对于所有示例项目(例如News
)Title
,始终显示在顶部。
我知道有一个ContainerName
属性可以设置为tabname,但是我没有看到类Title
或类Text
中的任何属性覆盖News
,那怎么可能呢?
编辑新闻项目
编辑产品
Product.cs(自定义)
using N2;
using N2.Web;
using N2.Details;
using N2.Integrity;
namespace N2.Templates.Mvc.Models.Pages
{
/// <summary>
/// This class represents the data transfer object that encapsulates
/// the information used by the template.
/// </summary>
[PageDefinition("Product")]
[WithEditableTitle, WithEditableName]
[RestrictParents(typeof(ProductSection),typeof(ProductCategory))]
public class Product : ContentPageBase
{
}
}
News.cs(默认)
using System.Web.UI.WebControls;
using N2.Definitions;
using N2.Details;
using N2.Integrity;
using N2.Templates.Mvc.Services;
using N2.Web.Mvc;
using N2.Persistence;
namespace N2.Templates.Mvc.Models.Pages
{
[PageDefinition("News", Description = "A news page.", SortOrder = 155,
IconUrl = "~/Content/Img/newspaper.png")]
[RestrictParents(typeof (NewsContainer))]
public class News : ContentPageBase, ISyndicatable
{
public News()
{
Visible = false;
Syndicate = true;
}
[EditableTextBox("Introduction", 90, ContainerName = Tabs.Content, TextMode = TextBoxMode.MultiLine, Rows = 4,
Columns = 80)]
public virtual string Introduction
{
get { return (string) (GetDetail("Introduction") ?? string.Empty); }
set { SetDetail("Introduction", value, string.Empty); }
}
string ISyndicatable.Summary
{
get { return Introduction; }
}
[Persistable(PersistAs = PropertyPersistenceLocation.Detail)]
public virtual bool Syndicate { get; set; }
}
}