protected override async Task ProcessCoreAsync(TagHelperContext context, TagHelperOutput output) { output.SuppressOutput(); if (!Name.HasValue() || !Template.HasValue()) { return; } var widget = new ComponentWidgetInvoker("Menu", new { name = Name, template = Template }); //var menu = await _menuService.GetMenuAsync(Name); //if (menu == null) //{ // return; //} //var model = await menu.CreateModelAsync(Template, (ControllerContext)ActionContextAccessor.ActionContext); //var root = model?.Root; //if (root == null) //{ // return; //} output.TagMode = TagMode.StartTagAndEndTag; //var partial = await HtmlHelper.PartialAsync("Menus/" + Template, model); var partial = await widget.InvokeAsync(ViewContext); output.Content.SetHtmlContent(partial); }
public WidgetInvoker GetTemplateWidget(FacetGroup facetGroup) { var templateName = GetTemplateName(facetGroup); if (templateName.IsEmpty()) { return(null); } var widget = new ComponentWidgetInvoker("FacetGroup", new { facetGroup, templateName }) { Order = facetGroup.DisplayOrder }; return(widget); }
/// <summary> /// Registers actions to render user menus in widget zones. /// </summary> private async Task ProcessUserMenusAsync() { var menusInfo = await _menuStorage.GetUserMenuInfosAsync(); foreach (var info in menusInfo) { var widget = new ComponentWidgetInvoker("Menu", new { name = info.SystemName, template = info.Template }) { Order = info.DisplayOrder }; _widgetProvider.RegisterWidget(info.WidgetZones, widget); } }
protected override async Task ProcessCoreAsync(TagHelperContext context, TagHelperOutput output) { var model = new FileUploaderModel { Name = Name, Path = Path, UploadUrl = UploadUrl, UploadText = UploadText, DisplayRemoveButton = DisplayRemoveButton, DisplayBrowseMediaButton = DisplayBrowseMediaButton, DisplayRemoveButtonAfterUpload = DisplayRemoveButtonAfterUpload, HasTemplatePreview = HasTemplatePreview, DownloadEnabled = DownloadEnabled, MultiFile = MultiFile, TypeFilter = TypeFilter, PreviewContainerId = PreviewContainerId, MainFileId = MainFileId, MaxFileSize = MaxFileSize, EntityType = EntityType, EntityId = EntityId, DeleteUrl = DeleteUrl, SortUrl = SortUrl, EntityAssignmentUrl = EntityAssignmentUrl, UploadedFiles = UploadedFiles, OnUploading = OnUploading, OnUploadCompleted = OnUploadCompleted, OnError = OnError, OnFileRemoved = OnFileRemoved, OnAborted = OnAborted, OnCompleted = OnCompleted, OnMediaSelected = OnMediaSelected }; var extensions = _mediaTypeResolver.ParseTypeFilter(TypeFilter.HasValue() ? TypeFilter : "*"); model.AcceptedFileExtensions = "." + string.Join(",.", extensions); var widget = new ComponentWidgetInvoker("FileUploader", new { model }); var partial = await widget.InvokeAsync(ViewContext); output.TagMode = TagMode.StartTagAndEndTag; output.TagName = null; output.Content.SetHtmlContent(partial); }