2011-03-11 3 views
0

N2 CMS에서 작업하기 자신의 콘텐츠 유형 Product을 추가하고 있습니다. Product 클래스를 ContentPageBase에서 파생 시켰으며 내용 트리에 추가 할 수 있습니다. 그러나 항목을 편집 할 때 필드가 반전 된 것 같습니다 (TitleText). 모든 예의 항목 (예 : News)의 경우 Title이 항상 맨 위에 표시됩니다.N2 CMS에서 항목을 편집 할 때 필드 배치?

내가 그러나 나는 News 클래스 Title 또는 Text에 대한 특성 재 지정을 참조하지 마십시오 TABNAME에 설정할 수있는 ContainerName 특성이 이해, 그래서 방법이 될 수 있는가?

편집 뉴스 항목

Editing news item

편집 제품

Editing product item

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; } 
    } 
} 

답변

2

제목 및 이름 편집기는 속성 자체가 아니라 클래스에 설정됩니다.

클래스의 WithEditableTitleWithEditableName 속성을 참조하십시오.

News 클래스는 Product 클래스가 사용하는 루트 ContentItem 클래스 대신 ContentPageBase에서 상속되기 때문에 News 클래스를 지정하지 않아도됩니다. ContentPageBase에는 제목과 이름 편집기가 이미 지정되어 있으므로 News은 다시 필요하지 않습니다.

+0

네가 맞아, 나는 그들을 N2 장소로 만든 제품에 다시 지정했다. 감사! – Ropstah

관련 문제