예제 #1
0
        public static string EvaluateRouteUrl(string routeName, HtmlGenericControl control, DotvvmProperty urlSuffixProperty, IDotvvmRequestContext context)
        {
            var coreUrl = GenerateRouteUrlCore(routeName, control, context) + (control.GetValue(urlSuffixProperty) as string ?? "");

            if ((bool)control.GetValue(Internal.IsSpaPageProperty))
            {
                return("#!/" + coreUrl);
            }
            else
            {
                return(context.TranslateVirtualPath(coreUrl));
            }
        }
예제 #2
0
        public static string EvaluateRouteUrl(string routeName, HtmlGenericControl control, DotvvmProperty urlSuffixProperty, IDotvvmRequestContext context)
        {
            var coreUrl = GenerateRouteUrlCore(routeName, control, context) + (control.GetValue(urlSuffixProperty) as string ?? "");

            if ((bool)control.GetValue(Internal.IsSpaPageProperty))
            {
                return "#!/" + coreUrl;
            }
            else
            {
                return context.TranslateVirtualPath(coreUrl);
            }
        }
예제 #3
0
        private static string GetUrlSuffixExpression(HtmlGenericControl control, DotvvmProperty urlSuffixProperty)
        {
            var urlSuffixBinding = control.GetValueBinding(urlSuffixProperty);

            if (urlSuffixBinding != null)
            {
                return("(" + urlSuffixBinding.GetKnockoutBindingExpression(control) + ")");
            }
            else
            {
                return(JsonConvert.SerializeObject(control.GetValue(urlSuffixProperty) as string ?? ""));
            }
        }
예제 #4
0
        public static string GenerateKnockoutHrefExpression(string routeName, HtmlGenericControl control, RenderContext context)
        {
            var link = GenerateRouteLinkCore(routeName, control, context);

            if ((bool)control.GetValue(Internal.IsSpaPageProperty))
            {
                return string.Format("'#!/' + {0}", link);
            }
            else
            {
                return string.Format("'{0}' + {1}", context.RequestContext.TranslateVirtualPath("~/"), link);
            }
        }
예제 #5
0
        public static string EvaluateRouteUrl(string routeName, HtmlGenericControl control, RenderContext context)
        {
            var coreUrl = GenerateRouteUrlCore(routeName, control, context);

            if ((bool)control.GetValue(Internal.IsSpaPageProperty))
            {
                return "#!/" + coreUrl;
            }
            else
            {
                return context.RequestContext.TranslateVirtualPath(coreUrl);
            }
        }
예제 #6
0
        public static string GenerateKnockoutHrefExpression(string routeName, HtmlGenericControl control, RenderContext context)
        {
            var link = GenerateRouteLinkCore(routeName, control, context);

            if ((bool)control.GetValue(Internal.IsSpaPageProperty))
            {
                return(string.Format("'#!/' + {0}", link));
            }
            else
            {
                return(string.Format("'{0}' + {1}", context.RequestContext.TranslateVirtualPath("~/"), link));
            }
        }
예제 #7
0
        public static string EvaluateRouteUrl(string routeName, HtmlGenericControl control, RenderContext context)
        {
            var coreUrl = GenerateRouteUrlCore(routeName, control, context);

            if ((bool)control.GetValue(Internal.IsSpaPageProperty))
            {
                return("#!/" + coreUrl);
            }
            else
            {
                return(context.RequestContext.TranslateVirtualPath(coreUrl));
            }
        }
예제 #8
0
        public static string GenerateKnockoutHrefExpression(string routeName, HtmlGenericControl control, DotvvmProperty urlSuffixProperty, IDotvvmRequestContext context)
        {
            var link = GenerateRouteLinkCore(routeName, control, context);

            var urlSuffix = GetUrlSuffixExpression(control, urlSuffixProperty);
            if ((bool)control.GetValue(Internal.IsSpaPageProperty))
            {
                return $"'#!/' + {link} + {urlSuffix}";
            }
            else
            {
                return $"'{context.TranslateVirtualPath("~/")}' + {link} + {urlSuffix}";
            }
        }
예제 #9
0
        public static string GenerateKnockoutHrefExpression(string routeName, HtmlGenericControl control, DotvvmProperty urlSuffixProperty, IDotvvmRequestContext context)
        {
            var link = GenerateRouteLinkCore(routeName, control, context);

            var urlSuffix = GetUrlSuffixExpression(control, urlSuffixProperty);

            if ((bool)control.GetValue(Internal.IsSpaPageProperty))
            {
                return($"'#!/' + {link} + {urlSuffix}");
            }
            else
            {
                return($"'{context.TranslateVirtualPath("~/")}' + {link} + {urlSuffix}");
            }
        }
예제 #10
0
 private static string GetUrlSuffixExpression(HtmlGenericControl control, DotvvmProperty urlSuffixProperty)
 {
     var urlSuffixBinding = control.GetValueBinding(urlSuffixProperty);
     string urlSuffix;
     if (urlSuffixBinding != null)
     {
         urlSuffix = urlSuffixBinding.GetKnockoutBindingExpression();
     }
     else
     {
         urlSuffix = JsonConvert.SerializeObject(control.GetValue(urlSuffixProperty) as string ?? "");
     }
     return urlSuffix;
 }