N2 CMS での作業 独自のコンテンツ タイプを追加していますProduct
。Product クラスを派生させ、ContentPageBase
それをコンテンツ ツリーに追加できます。ただし、アイテムを編集すると、フィールドが反転しているように見えます (Title
およびText
)。すべての例のアイテム (例: News
)Title
は常に上部に表示されます。
tabnameContainerName
に設定できるプロパティがあることは理解していますが、クラスのプロパティのオーバーライドが表示されないので、どうすればよいでしょうか?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; }
}
}