コード例 #1
0
        public override ActionResult Index(ContentModel model)
        {
            IPublishedContent homeNode    = model.Content.AncestorOrSelf(1);
            USNBaseViewModel  customModel = new USNBaseViewModel(model.Content);

            if (homeNode.IsDocumentType("USNHomepage"))
            {
                IPublishedContent globalSettings = homeNode.Value <IPublishedContent>("websiteConfigurationNode").Children.Where(x => x.IsDocumentType("USNGlobalSettings")).FirstOrDefault();
                IPublishedContent navigation     = homeNode.Value <IPublishedContent>("websiteConfigurationNode").Children.Where(x => x.IsDocumentType("USNNavigation")).FirstOrDefault();
                IPublishedContent footer         = homeNode.Value <IPublishedContent>("websiteConfigurationNode").Children.Where(x => x.IsDocumentType("USNFooter")).FirstOrDefault();
                IPublishedContent websiteStyle   = model.Content.HasValue("overrideWebsiteStyle") ? model.Content.Value <IPublishedContent>("overrideWebsiteStyle") : globalSettings.Value <IPublishedContent>("websiteStyle");

                customModel.HomeNode       = homeNode;
                customModel.GlobalSettings = globalSettings;
                customModel.Navigation     = navigation;
                customModel.Footer         = footer;
                customModel.WebsiteStyle   = websiteStyle;

                //Get Selected Style
                var    selectedStyle = model.Content.HasValue("overrideWebsiteStyle") ? model.Content.Value <IPublishedContent>("overrideWebsiteStyle") : globalSettings.Value <IPublishedContent>("websiteStyle");
                string themeName     = selectedStyle.Value <string>("selectTheme").ToLower().Trim().Replace(" ", "_");
                customModel.ViewPath   = "usn_" + themeName;
                customModel.ScriptPath = "/scripts/usn_" + themeName;
                customModel.CssPath    = "/css/usn_" + themeName;
                customModel.ImagePath  = "/images/usn_" + themeName;
                customModel.StyleID    = selectedStyle.Id;

                return(base.Index(customModel));
            }

            return(base.Index(customModel));
        }
コード例 #2
0
        public override ActionResult Index(RenderModel model)
        {
            IPublishedContent homeNode = model.Content.Site();

            if (homeNode.IsDocumentType("USNHomepage"))
            {
                IPublishedContent globalSettings = homeNode.GetPropertyValue <IPublishedContent>("websiteConfigurationNode").Children.Where(x => x.IsDocumentType("USNGlobalSettings")).First();
                IPublishedContent navigation     = homeNode.GetPropertyValue <IPublishedContent>("websiteConfigurationNode").Children.Where(x => x.IsDocumentType("USNNavigation")).First();

                USNBaseViewModel customModel = new USNBaseViewModel(model.Content);
                customModel.GlobalSettings = globalSettings;
                customModel.Navigation     = navigation;

                return(base.Index(customModel));
            }
            else
            {
                return(base.Index(model));
            }
        }