简体   繁体   English

N2CMS问题创建模板的第一部分

[英]N2CMS Issues creating template first parts

What is the proper way of adding template first part as shown here.. https://n2cmsdocs.atlassian.net/wiki/plugins/servlet/mobile#content/view/524349 如此处所示,添加模板第一部分的正确方法是什么。.https ://n2cmsdocs.atlassian.net/wiki/plugins/servlet/mobile#content/view/524349

I have done the same thing in my mvc project and the part appear in the drag drop list with the name of "ContentPart". 我在mvc项目中做了同样的事情,该部件以“ ContentPart”的名称出现在拖放列表中。 When I edit the part, an empty page shows up. 当我编辑零件时,将显示一个空白页面。

If I add more parts in /views/ContentParts/ folder, they don't show up in the drag drop list. 如果我在/ views / ContentParts /文件夹中添加更多零件,则它们不会显示在拖放列表中。

I have tried copying several parts from dinamico source but they don't appear in the list. 我尝试从dinamico来源复制几个零件,但是它们未出现在列表中。 Please help 请帮忙

Your view or model must define some editable fields. 您的视图或模型必须定义一些可编辑的字段。 If you're defining the fields in your view (as in the Dinamico template pack) you can do this with the Content.Define function, ie 如果要在视图中定义字段(例如在Dinamico模板包中),则可以使用Content.Define函数来完成,即

@model Dinamico.Models.ContentPart
@{ 
  Content.Define(a => /* add definitions here */);
}

If you're doing it from your model, you can decorate public properties with attributes like [EditableText] to make them show up in the edit form automatically. 如果您是在模型中执行此操作,则可以使用[EditableText]类的属性来装饰公共属性,以使它们自动显示在编辑表单中。

There are many built-in editor types which are discussed in the documentation here: https://n2cmsdocs.atlassian.net/wiki/display/N2CMS/Built-in+Editor+Types 有许多内置的编辑器类型,将在此处的文档中进行讨论: https : //n2cmsdocs.atlassian.net/wiki/display/N2CMS/Built-in+Editor+Types

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM