public override IEnumerable<TemplateViewModel> TypePartEditor(ContentTypePartDefinition definition) { if (definition.PartDefinition.Name != "CommentsPart") yield break; var model = new CommentsPartSettingsViewModel { Settings = definition.Settings.GetModel<CommentsPartSettings>(), HtmlFilters = _htmlFilters }; yield return DefinitionTemplate(model); }
public override IEnumerable<TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel) { if (builder.Name != "CommentsPart") yield break; var model = new CommentsPartSettingsViewModel { Settings = new CommentsPartSettings() }; if (updateModel.TryUpdateModel(model, "CommentsPartSettingsViewModel", null, null)) { builder.WithSetting("CommentsPartSettings.DefaultThreadedComments", model.Settings.DefaultThreadedComments.ToString(CultureInfo.InvariantCulture)); builder.WithSetting("CommentsPartSettings.MustBeAuthenticated", model.Settings.MustBeAuthenticated.ToString(CultureInfo.InvariantCulture)); builder.WithSetting("CommentsPartSettings.HtmlFilter", model.Settings.HtmlFilter); } yield return DefinitionTemplate(model); }