Esempio n. 1
0
        public AjaxUrl AddAction(string action)
        {
            AjaxUrl ajaxUrl = new AjaxUrl();

            ajaxUrl.Controller = this.Controller;
            ajaxUrl.Action     = action;
            this._Urls.Add(ajaxUrl);
            return(ajaxUrl);
        }
Esempio n. 2
0
        public AjaxUrl AddPath(string path)
        {
            AjaxUrl ajaxUrl = new AjaxUrl();

            ajaxUrl.Controller = (string)null;
            ajaxUrl.Action     = path;
            this._Urls.Add(ajaxUrl);
            return(ajaxUrl);
        }
Esempio n. 3
0
        public override void Init(TagHelperContext context)
        {
            if (!string.IsNullOrWhiteSpace(RelativeUrl))
            {
                AjaxUrl = RelativeUrl;
            }
            else if (Page != null)
            {
                AjaxUrl = DocumentURLProvider.GetUrl(Page);
            }
            else if (Documentid > 0)
            {
                // Get Document
                Page = PageRetriever.RetrieveMultiple(query =>
                                                      query.WhereEquals(nameof(TreeNode.DocumentID), Documentid)
                                                      .Published(false)
                                                      , cache =>
                                                      cache.Key($"PartialWidgetPageAjaxTagHelperGetDocument|{Documentid}")
                                                      .Dependencies((pages, deps) => deps.Pages(pages))
                                                      ).FirstOrDefault();
                if (Page != null)
                {
                    AjaxUrl = DocumentURLProvider.GetUrl(Page);
                }
            }

            if (!string.IsNullOrWhiteSpace(AjaxUrl))
            {
                Render = true;
                // Append Special Url parameter
                AjaxUrl += $"{(AjaxUrl.IndexOf('?') == -1 ? '?' : '&')}{PartialWidgetPageHelper.GetPartialUrlParameter()}=true";
            }
            else
            {
                Render = false;
            }
            base.Init(context);
        }