public dynamic BuildEditor(IContent content, string metadataType, string fieldTypeName) { var shapes = _contentDisplay.BuildDisplay(content); InternalShapeHolder displayShape = GetShapeFromBuilt(shapes, metadataType, fieldTypeName); var prefix = string.Empty; if (displayShape.IsField) { prefix = displayShape.Shape.ContentPart.PartDefinition.Name + "." + displayShape.Shape.ContentField.Name; } else { prefix = displayShape.Shape.Metadata.Prefix; } var editorShapeType = string.Format("{0}_InlineEdit", metadataType); var editorShapeTemplate = editorShapeType.Replace("_", "."); var viewModel = new InlineViewModel { Content = content, DisplayShape = displayShape.Shape }; _handlers.Invoke(handler => handler.UpdateEditorShape(content, viewModel, _shapeFactory), Logger); var editorShape = Shape.EditorTemplate(TemplateName: editorShapeTemplate, Model: viewModel, Prefix: prefix); return(editorShape); }
private static TagBuilder InlineEditForFieldTagBuilder(Mvc.ViewEngines.Razor.WebViewPage <dynamic> webViewPage, InlineViewModel viewModel, string partTypeName, string fieldTypeName) { var tagBuilder = new TagBuilder("form"); tagBuilder.MergeAttribute("action", webViewPage.Url.EditShape(viewModel.Content.Id, (string)viewModel.DisplayShape.Metadata.Type, "Field", partTypeName, fieldTypeName)); tagBuilder.MergeAttribute("method", "post", true); tagBuilder.MergeAttribute("enctype", "multipart/form-data", true); return(tagBuilder); }