2011-03-11 4 views
0

N2 CMSで作業しています自分自身のコンテンツタイプProductを追加しています。 ProductクラスをContentPageBaseから派生させてコンテンツツリーに追加できます。ただし、アイテムを編集すると、フィールドが反転しているように見えます(TitleおよびText)。すべてのサンプル項目(例:News)の場合は、Titleが常に先頭に表示されます。私はTABNAMEに設定することができContainerNameプロパティがあることを理解N2 cmsで項目を編集するときのフィールド配置ですか?

は、しかし、私はNewsクラスでTitleまたはTextのための任意のプロパティの上書きが表示されていないので、これはどのようにすることができますか?

編集ニュース項目

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

タイトルと名前エディタは、プロパティ自体ではなくクラスに設定されています。

クラスのWithEditableTitleおよびWithEditableName属性を参照してください。

ニュースクラスはProductクラスが使用しているルートContentItemクラスの代わりにContentPageBaseから継承しているため、Newsクラスで指定する必要はありません。 ContentPageBaseにはすでに指定されたタイトルと名前のエディタがありますので、Newsはもう一度する必要はありません。

+0

あなたはそうです、私はそれらをN2の場所にした製品で再び指定しました!ありがとう! – Ropstah

関連する問題