コード例 #1
0
        private static Node CreateNode(ElementView elementView)
        {
            var element      = elementView.Element;
            var labels       = element.GetTags();
            var categoryRefs = labels.Select(x => new CategoryRef {
                Ref = x
            }).ToList();

            if (element.Parent != null)
            {
                categoryRefs.Insert(0, new CategoryRef
                {
                    Ref = element.Parent.Id
                });
            }
            categoryRefs.Reverse();
            return(new Node
            {
                Id = element.Id,
                Group = element.IsContainer() ? "Expanded" : null,
                Label = element.Name,
                Description = string.IsNullOrEmpty(element.Description) ? null : element.Description,
                Reference = element.Url,
                Category = categoryRefs.Select(x => x.Ref).FirstOrDefault(),
                CategoryRefs = categoryRefs
            });
        }
コード例 #2
0
        private async Task <ElementRender> GetElementRender(long tenantId, Guid elementTypeId, long elementId, long pageId)
        {
            IElementSettings elementSettings = await _elementServiceFactory.ReadElementSettingsAsync(tenantId, elementTypeId, elementId);

            object elementContent = await _elementServiceFactory.ReadElementContentAsync(tenantId, elementTypeId, elementId, pageId);

            if (elementSettings == null)
            {
                return new ElementRender {
                           PartialViewName = "~/Views/Elements/NotFound.cshtml"
                }
            }
            ;

            ElementView elementView = new ElementView
            {
                Settings = elementSettings,
                Content  = elementContent
            };

            return(new ElementRender
            {
                PartialViewName = $"~/Views/Elements/{elementTypeId}.cshtml",
                ElementView = elementView
            });
        }
コード例 #3
0
        //pw:change it to handlers
        public ElementView GetTaskList(int?bagId, string path)
        {
            if (!string.IsNullOrEmpty(path))
            {
                bagId = FindCorrectRoot(bagId, path);
            }

            Domain.Element element = _taskRepository.GetStructure(bagId);
            ElementView    st      = _mapper.Map <Domain.Element, ElementView>(element);

            return(st);
        }
コード例 #4
0
        private static Category CreateCategory(ElementView elementView)
        {
            var element = elementView.Element;

            if (element.Parent == null)
            {
                return(null);
            }
            return(new Category {
                Id = element.Parent.Id, Label = element.Parent.Name
            });
        }
コード例 #5
0
 protected override bool CheckCanDraw(ElementView elementView)
 {
     return(FilterText.IsNullOrEmpty());
 }
コード例 #6
0
 protected virtual bool CheckCanDraw(ElementView elementView)
 {
     return(true);
 }
コード例 #7
0
 protected override bool CheckCanDraw(ElementView elementView)
 {
     return(base.CheckCanDraw(elementView) || elementView.Data.A.Contains(FilterText));
 }