public void PopulateValues(ViewLocationExpanderContext context) { var themeContext = (IThemeProvider)context.ActionContext.HttpContext.RequestServices.GetService(typeof(IThemeProvider)); context.Values[ThemeKey] = themeContext.GetWorkingThemeDirPath(context.ActionContext.HttpContext.Request.Host.Host, context.ActionContext.HttpContext.Request.IsMobileDevice()); }
public IEnumerable<string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable<string> viewLocations) { throw new NotImplementedException(); }
public IEnumerable <string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable <string> viewLocations) { // The old locations are /Views/{1}/{0}.cshtml and /Views/Shared/{0}.cshtml where {1} is the controller and {0} is the name of the View // Replace /Views with /Features return(new string[] { "/Features/{1}/{0}.cshtml", "/Features/Shared/{0}.cshtml" }); }
public IEnumerable <string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable <string> viewLocations) { throw new NotImplementedException(); }
public void PopulateValues(ViewLocationExpanderContext context) { // do nothing - not required }
public void PopulateValues(ViewLocationExpanderContext context) { //nothing to do here. }
public IEnumerable <string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable <string> viewLocations) => new List <string> { "/Infrastructure/Email/Views/{0}.cshtml" };
public void PopulateValues(ViewLocationExpanderContext context) { // do nothing.. not entirely needed for this }
public void PopulateValues(ViewLocationExpanderContext context) { context.Values["QuartzViewLocations"] = nameof(HybridQuartzViewLocationExpander); }
public void PopulateValues(ViewLocationExpanderContext context) { this._service = context.ActionContext.HttpContext.RequestServices.GetService <ITenantService>(); this._tenant = this._service.GetCurrentTenant(); }
public IEnumerable <string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable <string> viewLocations) { return(viewLocations.MoveViewsIntoFeaturesFolder().CutomizeSharedWithUnderScore()); }
public void PopulateValues(ViewLocationExpanderContext context) { context.Values["customviewlocation"] = nameof(ViewLocationExpander); }
public IEnumerable <string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable <string> viewLocations) { return(_directoryLocations.Union(viewLocations)); }
/// <inheritdoc /> public virtual IEnumerable <string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable <string> viewLocations) { if (!context.Values.ContainsKey("Theme")) { return(viewLocations); } var currentThemeId = context.Values["Theme"]; var currentThemeAndBaseThemesOrdered = _extensionManager .GetFeatures(new[] { currentThemeId }) .Where(x => x.Extension.IsTheme()) .Reverse(); if (context.ActionContext.ActionDescriptor is PageActionDescriptor page) { var pageViewLocations = PageViewLocations().ToList(); pageViewLocations.AddRange(viewLocations); return(pageViewLocations); IEnumerable <string> PageViewLocations() { if (page.RelativePath.Contains("/Pages/") && !page.RelativePath.StartsWith("/Pages/")) { var pageIndex = page.RelativePath.LastIndexOf("/Pages/"); var moduleFolder = page.RelativePath.Substring(0, pageIndex); var moduleId = moduleFolder.Substring(moduleFolder.LastIndexOf("/") + 1); foreach (var theme in currentThemeAndBaseThemesOrdered) { if (moduleId != theme.Id) { var themeViewsPath = '/' + theme.Extension.SubPath + "/Views"; var themeViewsAreaPath = themeViewsPath + '/' + context.AreaName; yield return(themeViewsAreaPath + "/Shared/{0}" + RazorViewEngine.ViewExtension); yield return(themeViewsPath + "/Shared/{0}" + RazorViewEngine.ViewExtension); } } } } } var result = new List <string>(); if (!String.IsNullOrEmpty(context.AreaName)) { foreach (var theme in currentThemeAndBaseThemesOrdered) { if (context.AreaName != theme.Id) { var themeViewsPath = '/' + theme.Extension.SubPath + "/Views"; var themeViewsAreaPath = themeViewsPath + '/' + context.AreaName; result.Add(themeViewsAreaPath + "/{1}/{0}" + RazorViewEngine.ViewExtension); result.Add(themeViewsAreaPath + "/Shared/{0}" + RazorViewEngine.ViewExtension); result.Add(themeViewsPath + "/Shared/{0}" + RazorViewEngine.ViewExtension); } } } result.AddRange(viewLocations); return(result); }
public void PopulateValues(ViewLocationExpanderContext context) { throw new NotImplementedException(); }
public void PopulateValues(ViewLocationExpanderContext context) { // Don't need anything here, but required by the interface }
public IEnumerable <string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable <string> viewLocations) { return(viewLocations); }
public void PopulateValues(ViewLocationExpanderContext context) { context.Values["theme"] = context.ActionContext.HttpContext.Request.Headers["BUSINESS-ID"].ToString(); }
/// <inheritdoc /> public virtual IEnumerable <string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable <string> viewLocations) { if (!context.Values.ContainsKey("Theme")) { return(viewLocations); } var currentThemeId = context.Values["Theme"]; var currentThemeAndBaseThemesOrdered = _extensionManager .GetFeatures(new[] { currentThemeId }) .Where(x => x.Extension.IsTheme()) .Reverse() .ToList(); // let the application acting as a super theme also for mvc views discovering. var applicationTheme = _extensionManager .GetFeatures() .FirstOrDefault(x => x.Id == _hostingEnvironment.ApplicationName); if (applicationTheme != null) { currentThemeAndBaseThemesOrdered.Insert(0, applicationTheme); } var result = new List <string>(); foreach (var theme in currentThemeAndBaseThemesOrdered) { if (context.AreaName != theme.Id) { var themePagesPath = '/' + theme.Extension.SubPath + "/Pages"; var themeViewsPath = '/' + theme.Extension.SubPath + "/Views"; if (context.AreaName != null) { if (context.PageName != null) { result.Add(themePagesPath + "/{2}/{0}" + RazorViewEngine.ViewExtension); } else { result.Add(themeViewsPath + "/{2}/{1}/{0}" + RazorViewEngine.ViewExtension); } } if (context.PageName != null) { result.Add(themePagesPath + "/Shared/{0}" + RazorViewEngine.ViewExtension); } if (context.AreaName != null) { result.Add(themeViewsPath + "/{2}/Shared/{0}" + RazorViewEngine.ViewExtension); } result.Add(themeViewsPath + "/Shared/{0}" + RazorViewEngine.ViewExtension); } } result.AddRange(viewLocations); return(result); }
public IEnumerable <string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable <string> viewLocations) { return(viewLocations.Select(f => f.Replace("/Views/", $"/Views/{context.Values["theme"]}/")) .Append("/Views/Shared/{0}.cshtml") .Append("/Views/Shared/{1}/{0}.cshtml")); }
public IEnumerable <string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable <string> viewLocations) { return(viewLocations.Select(s => s.Replace("/Views/Shared", _theme))); }
/// <inheritdoc/> public void PopulateValues(ViewLocationExpanderContext context) { // The value we care about - 'page' is already part of the system. We don't need to add it manually. }
public void PopulateValues(ViewLocationExpanderContext context) { context.Values[THEME_KEY] = context.ActionContext.HttpContext.RequestServices.GetRequiredService <IOptions <AppSettings> >().Value.ThemeOptions.ThemeName; }
public IEnumerable <string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable <string> viewLocations) { return(new[] { "/Features/{1}/{0}.cshtml", "/Features/Shared/{0}.cshtml" }); }
public void PopulateValues( ViewLocationExpanderContext context) { }
public IEnumerable <string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable <string> viewLocations) { //extend current view locations return(viewLocations.Concat(ExtendedLocations)); }
public void PopulateValues(ViewLocationExpanderContext context) { // Empty by design }