Ejemplo n.º 1
0
 /// <summary>
 /// Registers renderers/templates which are not automatically discovered,
 /// i.e. partial views whose names does not match a content type's name.
 /// </summary>
 /// <remarks>
 /// Using only partial views instead of controllers for blocks and page partials
 /// has performance benefits as they will only require calls to RenderPartial instead of
 /// RenderAction for controllers.
 /// Registering partial views as templates this way also enables specifying tags and
 /// that a template supports all types inheriting from the content type/model type.
 /// </remarks>
 public void Register(TemplateModelCollection viewTemplateModelRegistrator)
 {
     // Add BasePage templates
     viewTemplateModelRegistrator.Add(typeof(CallToActionCardA), _ctaRenderingService.Service.GetAvailableTemplates().ToArray());
     viewTemplateModelRegistrator.Add(typeof(RecipeIngredientBlock), _recipeIngredientRenderingService.Service.GetAvailableTemplates().ToArray());
     viewTemplateModelRegistrator.Add(typeof(BlogContentBlock), _blogContentBlockRenderingService.Service.GetAvailableTemplates().ToArray());
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Registers renderers/templates which are not automatically discovered,
        /// i.e. partial views whose names does not match a content type's name.
        /// </summary>
        /// <remarks>
        /// Using only partial views instead of controllers for blocks and page partials
        /// has performance benefits as they will only require calls to RenderPartial instead of
        /// RenderAction for controllers.
        /// Registering partial views as templates this way also enables specifying tags and
        /// that a template supports all types inheriting from the content type/model type.
        /// </remarks>
        public void Register(TemplateModelCollection viewTemplateModelRegistrator)
        {
            viewTemplateModelRegistrator.Add(typeof(SitePageData), new TemplateModel
            {
                Name                = "PagePartial",
                Inherit             = true,
                AvailableWithoutTag = true,
                Path                = PagePartialPath("PagePartial.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(SitePageData), new TemplateModel
            {
                Name    = "PagePartialWide",
                Inherit = true,
                Tags    = new[] { Global.ContentAreaTags.FullWidth, Global.ContentAreaTags.ThreeQuartersWidth, Global.ContentAreaTags.TwoThirdsWidth },
                Path    = PagePartialPath("PagePartialWide.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(TeaserBlock), new TemplateModel
            {
                Name = "TeaserBlockWide",
                Tags = new[] { Global.ContentAreaTags.TwoThirdsWidth, Global.ContentAreaTags.ThreeQuartersWidth, Global.ContentAreaTags.FullWidth },
                AvailableWithoutTag = true,
                Path = BlockPath("TeaserBlockWide.cshtml")
            });


            viewTemplateModelRegistrator.Add(typeof(IContentData), new TemplateModel
            {
                Name                = "NoRendererMessage",
                Inherit             = true,
                AvailableWithoutTag = false,
                Path                = BlockPath("NoRenderer.cshtml")
            });
        }
Ejemplo n.º 3
0
        public void Register(TemplateModelCollection viewTemplateModelRegistrator)
        {
            viewTemplateModelRegistrator.Add(typeof(JumbotronBlock), new TemplateModel
            {
                Tags = new[] { EPiBootstrapArea.ContentAreaTags.FullWidth },
                AvailableWithoutTag = false,
                Path = BlockPath("JumbotronBlockWide")
            });

            viewTemplateModelRegistrator.Add(typeof(CallToActionBlock), new TemplateModel
            {
                Tags = new[]
                {
                    EPiBootstrapArea.ContentAreaTags.OneQuarterWidth,
                    EPiBootstrapArea.ContentAreaTags.OneThirdWidth
                },
                AvailableWithoutTag = true,
                Path = BlockPath("CallToActionBlockNarrow")
            });

            viewTemplateModelRegistrator.Add(typeof(ServicePage), new TemplateModel
            {
                Name = "ServicePagePartial",
                AvailableWithoutTag = true,
                Inherit             = true,
                Path = PagePartialPath("ServicePageTeaser")
            });
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Registers renderers/templates which are not automatically discovered,
        /// i.e. partial views whose names does not match a content type's name.
        /// </summary>
        /// <remarks>
        /// Using only partial views instead of controllers for blocks and page partials
        /// has performance benefits as they will only require calls to RenderPartial instead of
        /// RenderAction for controllers.
        /// Registering partial views as templates this way also enables specifying tags and
        /// that a template supports all types inheriting from the content type/model type.
        /// </remarks>
        public void Register(TemplateModelCollection viewTemplateModelRegistrator)
        {
            // We want a special renderer for the HtmlBlock when rendered in full view
            viewTemplateModelRegistrator.Add(typeof(HtmlBlock), new TemplateModel()
            {
                Name    = "Html Block rendered in Full view",
                Inherit = true,
                Tags    = new[] { WebGlobal.ContentAreaTags.FullWidth },
                Path    = BlockPath("HtmlBlock.Full.cshtml"),
                TemplateTypeCategory = TemplateTypeCategories.MvcPartialView,
                AvailableWithoutTag  = false,
                Default = false
            });

            viewTemplateModelRegistrator.Add(typeof(ArticlePage), new TemplateModel()
            {
                Name    = "Article rendered in Full view",
                Inherit = true,
                Tags    = new[] { WebGlobal.ContentAreaTags.FullWidth },
                Path    = BlockPath("ArticlePage.Full.cshtml"),
                TemplateTypeCategory = TemplateTypeCategories.MvcPartialView,
                AvailableWithoutTag  = false,
                Default = false
            });

            viewTemplateModelRegistrator.Add(typeof(ArticleWithSidebarPage), new TemplateModel()
            {
                Name    = "Article with sidebar rendered in Full view",
                Inherit = true,
                Tags    = new[] { WebGlobal.ContentAreaTags.FullWidth },
                Path    = BlockPath("ArticlePage.Full.cshtml"),
                TemplateTypeCategory = TemplateTypeCategories.MvcPartialView,
                AvailableWithoutTag  = false,
                Default = false
            });


            // All Slider blocks are rendered specially
            viewTemplateModelRegistrator.Add(typeof(VariationContent), new TemplateModel()
            {
                Name    = "Product Variation renderer for the Slider block",
                Inherit = true,
                Tags    = new[] { WebGlobal.ContentAreaTags.Slider },
                Path    = BlockPath("Slider.Variation.cshtml"),
                TemplateTypeCategory = TemplateTypeCategories.MvcPartialView,
                AvailableWithoutTag  = false,
                Default = false
            });
            viewTemplateModelRegistrator.Add(typeof(ProductContent), new TemplateModel()
            {
                Name    = "Product Variation renderer for the Slider block",
                Inherit = true,
                Tags    = new[] { WebGlobal.ContentAreaTags.Slider },
                Path    = BlockPath("Slider.Product.cshtml"),
                TemplateTypeCategory = TemplateTypeCategories.MvcPartialView,
                AvailableWithoutTag  = false,
                Default = false
            });
        }
Ejemplo n.º 5
0
        public void Register(TemplateModelCollection viewTemplateModelRegistrator)
        {
            viewTemplateModelRegistrator.Add(typeof(AttendSubmitButton), new TemplateModel
            {
                Path = FormPath("AttendSubmitButton.ascx")
            });

            viewTemplateModelRegistrator.Add(typeof(AttendSessionForm), new TemplateModel
            {
                Path = FormPath("AttendSessionForm.ascx")
            });
        }
Ejemplo n.º 6
0
        public void Register(TemplateModelCollection viewTemplateModelRegistrator)
        {
            viewTemplateModelRegistrator.Add(typeof(AttendSubmitButton), new TemplateModel
            {
                Path = FormPath("AttendSubmitButton.ascx")
            });

            viewTemplateModelRegistrator.Add(typeof(AttendSessionForm), new TemplateModel
            {
                Path = FormPath("AttendSessionForm.ascx")
            });

        }
        /// <summary>
        /// Registers renderers/templates which are not automatically discovered, 
        /// i.e. partial views whose names does not match a content type's name.
        /// </summary>
        /// <remarks>
        /// Using only partial views instead of controllers for blocks and page partials
        /// has performance benefits as they will only require calls to RenderPartial instead of
        /// RenderAction for controllers.
        /// Registering partial views as templates this way also enables specifying tags and 
        /// that a template supports all types inheriting from the content type/model type.
        /// </remarks>
        public void Register(TemplateModelCollection viewTemplateModelRegistrator)
        {
            viewTemplateModelRegistrator.Add(typeof(JumbotronBlock), new TemplateModel
            {
                Tags = new[] { Global.ContentAreaTags.FullWidth },
                AvailableWithoutTag = false,
                Path = BlockPath("JumbotronBlockWide.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(TeaserBlock), new TemplateModel
            {
                Name = "TeaserBlockWide",
                Tags = new[] { Global.ContentAreaTags.TwoThirdsWidth, Global.ContentAreaTags.FullWidth },
                AvailableWithoutTag = false,
                Path = BlockPath("TeaserBlockWide.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(SitePageData), new TemplateModel
            {
                Name = "PagePartial",
                Inherited = true,
                AvailableWithoutTag = true,
                Path = PagePartialPath("Page.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(SitePageData), new TemplateModel
            {
                Name = "PagePartialWide",
                Inherited = true,
                Tags = new[] { Global.ContentAreaTags.TwoThirdsWidth, Global.ContentAreaTags.FullWidth },
                AvailableWithoutTag = false,
                Path = PagePartialPath("PageWide.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(ContactPage), new TemplateModel
            {
                Name = "ContactPagePartialWide",
                Tags = new[] { Global.ContentAreaTags.TwoThirdsWidth, Global.ContentAreaTags.FullWidth },
                AvailableWithoutTag = false,
                Path = PagePartialPath("ContactPageWide.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(IContentData), new TemplateModel
            {
                Name = "NoRendererMessage",
                Inherited = true,
                Tags = new[] { Global.ContentAreaTags.NoRenderer },
                AvailableWithoutTag = false,
                Path = BlockPath("NoRenderer.cshtml")
            });
        }
Ejemplo n.º 8
0
        /// <summary>
        ///		Carga el archivo de definición de plantillas
        /// </summary>
        internal TemplateModelCollection Load(string strFileName)
        {
            TemplateModelCollection objColTemplates = new TemplateModelCollection(System.IO.Path.GetDirectoryName(strFileName));

            // Carga las plantillas
            if (System.IO.File.Exists(strFileName))
            {
                MLFile objMLFile = new LibMarkupLanguage.Services.XML.XMLParser().Load(strFileName);

                foreach (MLNode objMLRoot in objMLFile.Nodes)
                {
                    if (objMLRoot.Name == "Templates")
                    {
                        foreach (MLNode objMLTemplate in objMLRoot.Nodes)
                        {
                            if (objMLTemplate.Name == "Page")
                            {
                                LanguageStructModel.StructType intIDType = GetLanguageStruct(objMLTemplate.Attributes["StructType"].Value);
                                string strRelativeFileName = objMLTemplate.Attributes["File"].Value;
                                string strRootTemplate     = objMLTemplate.Attributes["RootTemplate"].Value;

                                if (intIDType != LanguageStructModel.StructType.Unknown && !strRelativeFileName.IsEmpty())
                                {
                                    objColTemplates.Add(intIDType, strRelativeFileName, strRootTemplate);
                                }
                            }
                        }
                    }
                }
            }
            // Devuelve la colección de plantillas
            return(objColTemplates);
        }
        public void Register(TemplateModelCollection viewTemplateModelRegistrator)
        {
            viewTemplateModelRegistrator.Add(typeof(PageData), new TemplateModel
            {
                Name = "PartialPage",
                Inherit = true,
                AvailableWithoutTag = true,
                TemplateTypeCategory = TemplateTypeCategories.MvcPartialView,
                Path = "~/Views/Shared/_Page.cshtml"
            });

            viewTemplateModelRegistrator.Add(typeof(TeaserBlock), new TemplateModel
            {
                Name = "TeaserBlockWide",
                Tags = new[] { Global.ContentAreaTags.Wide, Global.ContentAreaTags.Full },
                AvailableWithoutTag = false,
                Path = "~/Shared/TeaserBlockWide.cshtml"
            });
        }
 public void Register(TemplateModelCollection viewTemplateModelRegistrator)
 {
     viewTemplateModelRegistrator.Add(typeof(TeaserBlock), new TemplateModel
     {
         Name = "Teaser Block",
         AvailableWithoutTag = true,
         Inherit             = false,
         Path = BlockPath("TeaserBlock.cshtml")
     });
 }
Ejemplo n.º 11
0
 public void Register(TemplateModelCollection viewTemplateModelRegistrator)
 {
     viewTemplateModelRegistrator.Add(typeof(EditorialPageBase), new TemplateModel
     {
         Name                = "RelatedContent",
         Inherit             = true,
         AvailableWithoutTag = true,
         Path                = PagePartialPath("EditorialPageBase.cshtml")
     });
     //viewTemplateModelRegistrator.Add(typeof(BackgroundVideoBlock), new TemplateModel
     //{
     //    Name = "VideoBanner",
     //    Inherit = true,
     //    Tags = new[] { TagNames.VideoBanner },
     //    AvailableWithoutTag = false,
     //    Path = PagePartialPath("VideoBanner.cshtml")
     //});
     viewTemplateModelRegistrator.Add(typeof(ImageFile), new TemplateModel
     {
         Name                = "ImageSliderItem",
         Inherit             = true,
         Tags                = new[] { TagNames.ContentSlider },
         AvailableWithoutTag = false,
         Path                = PagePartialPath("ImageSliderItem.cshtml")
     });
     viewTemplateModelRegistrator.Add(typeof(TextBlock), new TemplateModel
     {
         Name                = "TextSliderItem",
         Inherit             = true,
         Tags                = new[] { TagNames.ContentSlider },
         AvailableWithoutTag = false,
         Path                = PagePartialPath("TextSliderItem.cshtml")
     });
     viewTemplateModelRegistrator.Add(typeof(MouseoverItemBlock), new TemplateModel
     {
         Name                = "MouseoverItem",
         Inherit             = true,
         Tags                = new[] { TagNames.MouseoverItem },
         AvailableWithoutTag = false,
         Path                = PagePartialPath("MouseoverItem.cshtml")
     });
 }
 public void Register(TemplateModelCollection viewTemplateModelRegistrator)
 {
     viewTemplateModelRegistrator.Add(typeof(PageData), new TemplateModel
     {
         Name = "PartialPage",
         Inherit = true,
         AvailableWithoutTag = true,
         TemplateTypeCategory = TemplateTypeCategories.MvcPartialView,
         Path = "~/Views/Shared/_Page.cshtml"
     });
 }
Ejemplo n.º 13
0
 public void Register(TemplateModelCollection viewTemplateModelRegistrator)
 {
     viewTemplateModelRegistrator.Add(typeof(PromotionData), new TemplateModel
     {
         Name                 = "PartialPromotion",
         Inherit              = true,
         AvailableWithoutTag  = true,
         TemplateTypeCategory = TemplateTypeCategories.MvcPartialView,
         Path                 = $"{FoundationFolder}_Promotion.cshtml"
     });
 }
Ejemplo n.º 14
0
 public void Register(TemplateModelCollection viewTemplateModelRegistrator)
 {
     viewTemplateModelRegistrator.Add(typeof(PageData), new TemplateModel
     {
         Name                 = "PartialPage",
         Inherit              = true,
         AvailableWithoutTag  = true,
         TemplateTypeCategory = TemplateTypeCategories.MvcPartialView,
         Path                 = "~/Views/Shared/_Page.cshtml"
     });
 }
 public void Register(TemplateModelCollection viewTemplateModelRegistrator)
 {
     viewTemplateModelRegistrator.Add(typeof(PageData),
         new EPiServer.DataAbstraction.TemplateModel() {
             Name = "PageTeaser",
             Description = "Displays a teaser of a page.",
             Path = "~/Views/Shared/PageTeaser.cshtml",
             Inherited = true
         }
     );
 }
 public void Register(TemplateModelCollection viewTemplateModelRegistrator)
 {
     viewTemplateModelRegistrator.Add(typeof(ListBlock),
                                      new EPiServer.DataAbstraction.TemplateModel()
     {
         Name                = "List",
         Description         = "Displays a List",
         Path                = "~/Features/Blocks/List/ListBlock.cshtml",
         AvailableWithoutTag = true
     },
                                      new EPiServer.DataAbstraction.TemplateModel()
     {
         Name        = "MockupList",
         Description = "Displays a List mockup.",
         Path        = "~/Mockups/Blocks/List/ListBlock.cshtml",
         Tags        = new string[] { "mockup" }
     });
 }
        /// <summary>
        ///		Carga el archivo de definición de plantillas
        /// </summary>
        internal TemplateModelCollection Load(string strPathTemplates)
        {
            TemplateModelCollection objColTemplates = new TemplateModelCollection(strPathTemplates);
            string strFileName = System.IO.Path.Combine(strPathTemplates, "Templates.tpt");

            // Carga las plantillas
            if (System.IO.File.Exists(strFileName))
            {
                MLFile objMLFile = new LibMarkupLanguage.Services.XML.XMLParser().Load(strFileName);

                foreach (MLNode objMLRoot in objMLFile.Nodes)
                {
                    if (objMLRoot.Name == "Templates")
                    {
                        foreach (MLNode objMLTemplate in objMLRoot.Nodes)
                        {
                            if (objMLTemplate.Name == "Page" || objMLTemplate.Name == "Index")
                            {
                                TemplateModel.TemplateType intIDType = TemplateModel.TemplateType.Page;
                                string strName             = objMLTemplate.Attributes["Name"].Value;
                                string strStructType       = objMLTemplate.Attributes["StructType"].Value;
                                string strRelativeFileName = objMLTemplate.Attributes["File"].Value;
                                string strRootTemplate     = objMLTemplate.Attributes["RootTemplate"].Value;

                                // Asigna el tipo de plantilla de los índices
                                if (objMLTemplate.Name == "Index")
                                {
                                    intIDType = TemplateModel.TemplateType.Index;
                                }
                                // Devuelve el tipo de plantilla
                                if ((intIDType == TemplateModel.TemplateType.Index || !strStructType.IsEmpty()) && !strRelativeFileName.IsEmpty())
                                {
                                    objColTemplates.Add(intIDType, strName, strStructType, strRelativeFileName, strRootTemplate);
                                }
                            }
                        }
                    }
                }
            }
            // Devuelve la colección de plantillas
            return(objColTemplates);
        }
Ejemplo n.º 18
0
        /// <summary>
        ///		Carga el archivo de definición de plantillas
        /// </summary>
        internal TemplateModelCollection Load(string pathTemplates)
        {
            TemplateModelCollection templates = new TemplateModelCollection(pathTemplates);
            string fileName = System.IO.Path.Combine(pathTemplates, "Templates.tpt");

            // Carga las plantillas
            if (System.IO.File.Exists(fileName))
            {
                MLFile fileML = new LibMarkupLanguage.Services.XML.XMLParser().Load(fileName);

                foreach (MLNode rootML in fileML.Nodes)
                {
                    if (rootML.Name == "Templates")
                    {
                        foreach (MLNode templateML in rootML.Nodes)
                        {
                            if (templateML.Name == "Page" || templateML.Name == "Index")
                            {
                                TemplateModel.TemplateType type = TemplateModel.TemplateType.Page;
                                string name             = templateML.Attributes["Name"].Value;
                                string structType       = templateML.Attributes["StructType"].Value;
                                string relativeFileName = templateML.Attributes["File"].Value;
                                string rootTemplate     = templateML.Attributes["RootTemplate"].Value;

                                // Asigna el tipo de plantilla de los índices
                                if (templateML.Name == "Index")
                                {
                                    type = TemplateModel.TemplateType.Index;
                                }
                                // Devuelve el tipo de plantilla
                                if ((type == TemplateModel.TemplateType.Index || !structType.IsEmpty()) && !relativeFileName.IsEmpty())
                                {
                                    templates.Add(type, name, structType, relativeFileName, rootTemplate);
                                }
                            }
                        }
                    }
                }
            }
            // Devuelve la colección de plantillas
            return(templates);
        }
Ejemplo n.º 19
0
        public TemplateModelCollection GetTemplates(ICategory category, ILanguageType langType)
        {
            TemplateModelCollection filtered_templates = new TemplateModelCollection();

            if (this._templates == null || this._templates.Count == 0)
            {
                this._templates = GetTemplates();
            }

            Logger.Debug(String.Format("Applying filter [Category = '{0}' And LanguageType = '{1}'] on all templates", category.Name, langType.Name));

            foreach (ITemplate template in this._templates)
            {
                if (template.Category.Equals(category.Name) && template.LanguageType.Equals(langType.Name))
                {
                    filtered_templates.Add(template);
                }
            }

            return(filtered_templates);
        }
        /// <summary>
        /// Registers renderers/templates which are not automatically discovered, 
        /// i.e. partial views whose names does not match a content type's name.
        /// </summary>
        /// <remarks>
        /// Using only partial views instead of controllers for blocks and page partials
        /// has performance benefits as they will only require calls to RenderPartial instead of
        /// RenderAction for controllers.
        /// Registering partial views as templates this way also enables specifying tags and 
        /// that a template supports all types inheriting from the content type/model type.
        /// </remarks>
        public void Register(TemplateModelCollection viewTemplateModelRegistrator)
        {
            // We want a special renderer for the HtmlBlock when rendered in full view
            viewTemplateModelRegistrator.Add(typeof (HtmlBlock), new TemplateModel()
            {
                Name = "Html Block rendered in Full view",
                Inherit = true,
                Tags = new[] { WebGlobal.ContentAreaTags.FullWidth },
                Path = BlockPath("HtmlBlock.Full.cshtml"),
                TemplateTypeCategory = TemplateTypeCategories.MvcPartialView,
                AvailableWithoutTag = false,
                Default = false
            });

            //viewTemplateModelRegistrator.Add(typeof(ProductTeaserBlock), new TemplateModel
            //{
            //	Name = "ProductTeaserEditBlock",
            //	Inherited = true,
            //	Tags = new [] { RenderingTags.Edit, RenderingTags.Preview },
            //	Path = BlockPath("ProductTeaserEditBlock.cshtml"),
            //	TemplateTypeCategory = TemplateTypeCategories.MvcPartial
            //});
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Registers renderers/templates which are not automatically discovered,
        /// i.e. partial views whose names does not match a content type's name.
        /// </summary>
        /// <remarks>
        /// Using only partial views instead of controllers for blocks and page partials
        /// has performance benefits as they will only require calls to RenderPartial instead of
        /// RenderAction for controllers.
        /// Registering partial views as templates this way also enables specifying tags and
        /// that a template supports all types inheriting from the content type/model type.
        /// </remarks>
        public void Register(TemplateModelCollection viewTemplateModelRegistrator)
        {
            // We want a special renderer for the HtmlBlock when rendered in full view
            viewTemplateModelRegistrator.Add(typeof(HtmlBlock), new TemplateModel()
            {
                Name    = "Html Block rendered in Full view",
                Inherit = true,
                Tags    = new[] { WebGlobal.ContentAreaTags.FullWidth },
                Path    = BlockPath("HtmlBlock.Full.cshtml"),
                TemplateTypeCategory = TemplateTypeCategories.MvcPartialView,
                AvailableWithoutTag  = false,
                Default = false
            });


            //viewTemplateModelRegistrator.Add(typeof(ProductTeaserBlock), new TemplateModel
            //{
            //	Name = "ProductTeaserEditBlock",
            //	Inherited = true,
            //	Tags = new [] { RenderingTags.Edit, RenderingTags.Preview },
            //	Path = BlockPath("ProductTeaserEditBlock.cshtml"),
            //	TemplateTypeCategory = TemplateTypeCategories.MvcPartial
            //});
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Registers renderers/templates which are not automatically discovered,
        /// i.e. partial views whose names does not match a content type's name.
        /// </summary>
        /// <remarks>
        /// Using only partial views instead of controllers for blocks and page partials
        /// has performance benefits as they will only require calls to RenderPartial instead of
        /// RenderAction for controllers.
        /// Registering partial views as templates this way also enables specifying tags and
        /// that a template supports all types inheriting from the content type/model type.
        /// </remarks>
        public void Register(TemplateModelCollection viewTemplateModelRegistrator)
        {
            viewTemplateModelRegistrator.Add(typeof(SitePageData), new TemplateModel
            {
                Name                = "SitePageOnLeft",
                Inherit             = true,
                Tags                = new[] { ContentAreaTags.SitePageOnLeft },
                AvailableWithoutTag = false,
                Path                = PagePartialPath("SitePageOnLeft.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(SitePageData), new TemplateModel
            {
                Name                = "SitePageOnRight",
                Inherit             = true,
                Tags                = new[] { ContentAreaTags.SitePageOnRight },
                AvailableWithoutTag = false,
                Path                = PagePartialPath("SitePageOnRight.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(SitePageData), new TemplateModel
            {
                Name                = "SitePageOnBottom",
                Inherit             = true,
                Tags                = new[] { ContentAreaTags.SitePageOnBottom },
                AvailableWithoutTag = false,
                Path                = PagePartialPath("SitePageOnBottom.cshtml")
            });


            viewTemplateModelRegistrator.Add(typeof(CaseStudyPage), new TemplateModel
            {
                Name                = "CaseStudyPagePartial",
                Inherit             = true,
                AvailableWithoutTag = true,
                Path                = PagePartialPath("CaseStudyPagePartial.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(StandardPage), new TemplateModel
            {
                Name                = "StandardPage",
                Inherit             = true,
                AvailableWithoutTag = true,
                Path                = PagePartialPath("StandardPagePartial.cshtml")
            });
            viewTemplateModelRegistrator.Add(typeof(ClientQuoteItemBlock), new TemplateModel
            {
                Name                = "ClientQuoteItemBlockPartial",
                Inherit             = true,
                AvailableWithoutTag = true,
                Path                = BlockPath("ClientQuoteItemBlock.cshtml")
            });
            viewTemplateModelRegistrator.Add(typeof(HeadingBlock), new TemplateModel
            {
                Name                = "HeadingBlockPartial",
                Inherit             = true,
                AvailableWithoutTag = false,
                Path                = BlockPath("HeadingBlock.cshtml")
            });
            viewTemplateModelRegistrator.Add(typeof(ServicePage), new TemplateModel
            {
                Name                = "SmallServicePage",
                Inherit             = true,
                Tags                = new[] { ContentAreaTags.SmallServicePartial },
                AvailableWithoutTag = false,
                Path                = PagePartialPath("SmallServicePagePartial.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(ServicePage), new TemplateModel
            {
                Name                = "WideServicePage",
                Inherit             = true,
                Tags                = new[] { ContentAreaTags.WideServicePartial },
                AvailableWithoutTag = false,
                Path                = PagePartialPath("WideServicePagePartial.cshtml")
            });
            viewTemplateModelRegistrator.Add(typeof(ServicePage), new TemplateModel
            {
                Name                = "Technologies",
                Inherit             = true,
                Tags                = new[] { ContentAreaTags.TechnologiesPartial },
                AvailableWithoutTag = false,
                Path                = PagePartialPath("TechnologiesPartial.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(ContactUsPage), new TemplateModel
            {
                Name                = "ContactUsPagePartial",
                Inherit             = true,
                AvailableWithoutTag = false,
                Path                = PagePartialPath("ContactUsPage.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(AboutUsPage), new TemplateModel
            {
                Name                = "AboutUsPagePartial",
                Inherit             = true,
                AvailableWithoutTag = true,
                Path                = PagePartialPath("AboutUsPagePartial.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(OfficeBlock), new TemplateModel
            {
                Name                = "OfficeBlockPartial",
                Inherit             = true,
                AvailableWithoutTag = true,
                Path                = BlockPath("OfficeBlock.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(ClientQuoteBlock), new TemplateModel
            {
                Name                = "ClientQuoteBlockPartial",
                Inherit             = true,
                AvailableWithoutTag = true,
                Path                = BlockPath("ClientQuoteBlock.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(OurValuesBlock), new TemplateModel
            {
                Name                = "OurValuesBlockPartial",
                Inherit             = true,
                AvailableWithoutTag = true,
                Path                = BlockPath("OurValuesBlock.cshtml")
            });
            viewTemplateModelRegistrator.Add(typeof(BlogQuoteBlock), new TemplateModel
            {
                Name = "InlineBlogQuoteBlock",
                AvailableWithoutTag = false,
                Tags = new[] { "InlineContent" },
                Path = BlockPath("BlogQuoteBlock.cshtml")
                       //               TemplateTypeCategory = TemplateTypeCategories.MvcPartialController
            });
            viewTemplateModelRegistrator.Add(typeof(AboutUsInfoItemBlock), new TemplateModel
            {
                Name                = "AboutUsInfoItemBlockPartial",
                Inherit             = true,
                AvailableWithoutTag = true,
                Path                = BlockPath("AboutUsInfoItemBlock.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(MissionItemBlock), new TemplateModel
            {
                Name                = "MissionItemBlockPartial",
                Inherit             = true,
                AvailableWithoutTag = true,
                Path                = BlockPath("MissionItemBlock.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(AboutUsOfficeBlock), new TemplateModel
            {
                Name                = "AboutUsOfficeBlockPartial",
                Inherit             = true,
                AvailableWithoutTag = true,
                Path                = BlockPath("AboutUsOfficeBlock.cshtml")
            });
            viewTemplateModelRegistrator.Add(typeof(JobPage), new TemplateModel
            {
                Name                = "JobPagePartial",
                Inherit             = true,
                AvailableWithoutTag = true,
                Path                = PagePartialPath("JobPagePartial.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(CommunityPartnerItemBlock), new TemplateModel
            {
                Name                = "CommunityPartnerItemBlockPartial",
                Inherit             = true,
                AvailableWithoutTag = true,
                Path                = BlockPath("CommunityPartnerItemBlock.cshtml")
            });
            viewTemplateModelRegistrator.Add(typeof(PeopleBlock), new TemplateModel
            {
                Name                = "PeopleBlockPartial",
                Inherit             = true,
                Tags                = new[] { ContentAreaTags.PeopleBlockInfo },
                AvailableWithoutTag = false,
                Path                = PagePartialPath("PeopleBlockPartial.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(CommunityPartnerBlock), new TemplateModel
            {
                Name                = "CommunityPartnerBlockPartial",
                Inherit             = true,
                AvailableWithoutTag = true,
                Path                = BlockPath("CommunityPartnerBlock.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(OfficeStayConnectedBlock), new TemplateModel
            {
                Name                = "OfficeStayConnectedBlockPartial",
                Inherit             = true,
                AvailableWithoutTag = true,
                Path                = BlockPath("OfficeStayConnectedBlock.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(CaseStudyDetailBlock), new TemplateModel
            {
                Name                = "CaseStudyDetailBlockPartial",
                Inherit             = true,
                AvailableWithoutTag = true,
                Path                = BlockPath("CaseStudyDetailBlock.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(VideoDemoBlock), new TemplateModel
            {
                Name                = "VideoDemoBlockPartial",
                Inherit             = true,
                AvailableWithoutTag = true,
                Path                = BlockPath("VideoDemoBlock.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(VideoDemoBlockItem), new TemplateModel
            {
                Name                = "VideoDemoBlockItemPartial",
                Inherit             = true,
                AvailableWithoutTag = true,
                Path                = BlockPath("VideoDemoBlockItem.cshtml")
            });
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Registers renderers/templates which are not automatically discovered,
        /// i.e. partial views whose names does not match a content type's name.
        /// </summary>
        /// <remarks>
        /// Using only partial views instead of controllers for blocks and page partials
        /// has performance benefits as they will only require calls to RenderPartial instead of
        /// RenderAction for controllers.
        /// Registering partial views as templates this way also enables specifying tags and
        /// that a template supports all types inheriting from the content type/model type.
        /// </remarks>
        public void Register(TemplateModelCollection viewTemplateModelRegistrator)
        {
            // We want a special renderer for the HtmlBlock when rendered in full view
            viewTemplateModelRegistrator.Add(typeof(HtmlBlock), new TemplateModel()
            {
                Name    = "Html Block rendered in Full view",
                Inherit = true,
                Tags    = new[] { WebGlobal.ContentAreaTags.FullWidth },
                Path    = BlockPath("HtmlBlock.Full.cshtml"),
                TemplateTypeCategory = TemplateTypeCategories.MvcPartialView,
                AvailableWithoutTag  = false,
                Default = false
            });

            viewTemplateModelRegistrator.Add(typeof(ArticlePage), new TemplateModel()
            {
                Name    = "Article rendered in Full view",
                Inherit = true,
                Tags    = new[] { WebGlobal.ContentAreaTags.FullWidth },
                Path    = BlockPath("ArticlePage.Full.cshtml"),
                TemplateTypeCategory = TemplateTypeCategories.MvcPartialView,
                AvailableWithoutTag  = false,
                Default = false
            });

            viewTemplateModelRegistrator.Add(typeof(ArticleWithSidebarPage), new TemplateModel()
            {
                Name    = "Article with sidebar rendered in Full view",
                Inherit = true,
                Tags    = new[] { WebGlobal.ContentAreaTags.FullWidth },
                Path    = BlockPath("ArticlePage.Full.cshtml"),
                TemplateTypeCategory = TemplateTypeCategories.MvcPartialView,
                AvailableWithoutTag  = false,
                Default = false
            });


            // All Slider blocks are rendered specially
            viewTemplateModelRegistrator.Add(typeof(VariationContent), new TemplateModel()
            {
                Name    = "Product Variation renderer for the Slider block",
                Inherit = true,
                Tags    = new[] { WebGlobal.ContentAreaTags.Slider },
                Path    = BlockPath("Slider.Variation.cshtml"),
                TemplateTypeCategory = TemplateTypeCategories.MvcPartialView,
                AvailableWithoutTag  = false,
                Default = false
            });
            viewTemplateModelRegistrator.Add(typeof(ProductContent), new TemplateModel()
            {
                Name    = "Product Variation renderer for the Slider block",
                Inherit = true,
                Tags    = new[] { WebGlobal.ContentAreaTags.Slider },
                Path    = BlockPath("Slider.Product.cshtml"),
                TemplateTypeCategory = TemplateTypeCategories.MvcPartialView,
                AvailableWithoutTag  = false,
                Default = false
            });

            // Forms
            viewTemplateModelRegistrator.Add(typeof(EPiServer.Forms.Implementation.Elements.SubmitButtonElementBlock), new TemplateModel
            {
                Name                = "SubmitFormElementBlock",
                Inherit             = false,
                Default             = true,
                AvailableWithoutTag = true,
                Path                = FormPath("SubmitButtonElementBlock.ascx")
            });

            viewTemplateModelRegistrator.Add(typeof(EPiServer.Forms.Implementation.Elements.ChoiceElementBlock), new TemplateModel
            {
                Name                = "ChoiceFormElementBlock",
                Inherit             = true,
                Default             = true,
                AvailableWithoutTag = true,
                Path                = FormPath("ChoiceElementBlock.ascx")
            });

            viewTemplateModelRegistrator.Add(typeof(EPiServer.Forms.Implementation.Elements.NumberElementBlock), new TemplateModel
            {
                Name                = "NumberFormElementBlock",
                Inherit             = true,
                Default             = true,
                AvailableWithoutTag = true,
                Path                = FormPath("NumberElementBlock.ascx")
            });

            viewTemplateModelRegistrator.Add(typeof(EPiServer.Forms.Implementation.Elements.SelectionElementBlock), new TemplateModel
            {
                Name                = "SelectionFormElementBlock",
                Inherit             = true,
                Default             = true,
                AvailableWithoutTag = true,
                Path                = FormPath("SelectionElementBlock.ascx")
            });

            viewTemplateModelRegistrator.Add(typeof(EPiServer.Forms.Implementation.Elements.ParagraphTextElementBlock), new TemplateModel
            {
                Name                = "ParagraphTextFormElementBlock",
                Inherit             = true,
                Default             = true,
                AvailableWithoutTag = true,
                Path                = FormPath("ParagraphTextElementBlock.cshtml")
            });


            viewTemplateModelRegistrator.Add(typeof(EPiServer.Forms.Implementation.Elements.TextareaElementBlock), new TemplateModel
            {
                Name                = "TextareaFormElementBlock",
                Inherit             = true,
                Default             = true,
                AvailableWithoutTag = true,
                Path                = FormPath("TextareaElementBlock.ascx")
            });



            viewTemplateModelRegistrator.Add(typeof(EPiServer.Forms.Implementation.Elements.TextboxElementBlock), new TemplateModel
            {
                Name                = "TextBoxFormElementBlock",
                Inherit             = true,
                Default             = true,
                AvailableWithoutTag = true,
                Path                = FormPath("TextBoxElementBlock.ascx")
            });
        }
        /// <summary>
        /// Registers renderers/templates which are not automatically discovered, 
        /// i.e. partial views whose names does not match a content type's name.
        /// </summary>
        /// <remarks>
        /// Using only partial views instead of controllers for blocks and page partials
        /// has performance benefits as they will only require calls to RenderPartial instead of
        /// RenderAction for controllers.
        /// Registering partial views as templates this way also enables specifying tags and 
        /// that a template supports all types inheriting from the content type/model type.
        /// </remarks>
        public void Register(TemplateModelCollection viewTemplateModelRegistrator)
        {
            // We want a special renderer for the HtmlBlock when rendered in full view
            viewTemplateModelRegistrator.Add(typeof (HtmlBlock), new TemplateModel()
            {
                Name = "Html Block rendered in Full view",
                Inherit = true,
                Tags = new[] { WebGlobal.ContentAreaTags.FullWidth },
                Path = BlockPath("HtmlBlock.Full.cshtml"),
                TemplateTypeCategory = TemplateTypeCategories.MvcPartialView,
                AvailableWithoutTag = false,
                Default = false
            });

            viewTemplateModelRegistrator.Add(typeof(StoreLocationPage), new TemplateModel()
            {
                Name = "Store Location rendered in Full view",
                Inherit = true,
                Tags = new[] { WebGlobal.ContentAreaTags.FullWidth },
                Path = BlockPath("StoreLocationPage.Full.cshtml"),
                TemplateTypeCategory = TemplateTypeCategories.MvcPartialView,
                AvailableWithoutTag = false,
                Default = false
            });

            viewTemplateModelRegistrator.Add(typeof(ArticlePage), new TemplateModel()
            {
                Name = "Article rendered in Full view",
                Inherit = true,
                Tags = new[] { WebGlobal.ContentAreaTags.FullWidth },
                Path = BlockPath("ArticlePage.Full.cshtml"),
                TemplateTypeCategory = TemplateTypeCategories.MvcPartialView,
                AvailableWithoutTag = false,
                Default = false
            });

            viewTemplateModelRegistrator.Add(typeof(ArticleWithSidebarPage), new TemplateModel()
            {
                Name = "Article with sidebar rendered in Full view",
                Inherit = true,
                Tags = new[] { WebGlobal.ContentAreaTags.FullWidth },
                Path = BlockPath("ArticlePage.Full.cshtml"),
                TemplateTypeCategory = TemplateTypeCategories.MvcPartialView,
                AvailableWithoutTag = false,
                Default = false
            });

            // All Slider blocks are rendered specially
            viewTemplateModelRegistrator.Add(typeof(VariationContent), new TemplateModel()
            {
                Name = "Product Variation renderer for the Slider block",
                Inherit = true,
                Tags = new[] { WebGlobal.ContentAreaTags.Slider },
                Path = BlockPath("Slider.Variation.cshtml"),
                TemplateTypeCategory = TemplateTypeCategories.MvcPartialView,
                AvailableWithoutTag = false,
                Default = false
            });
            viewTemplateModelRegistrator.Add(typeof(ProductContent), new TemplateModel()
            {
                Name = "Product Variation renderer for the Slider block",
                Inherit = true,
                Tags = new[] { WebGlobal.ContentAreaTags.Slider },
                Path = BlockPath("Slider.Product.cshtml"),
                TemplateTypeCategory = TemplateTypeCategories.MvcPartialView,
                AvailableWithoutTag = false,
                Default = false
            });
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Registers renderers/templates which are not automatically discovered,
        /// i.e. partial views whose names does not match a content type's name.
        /// </summary>
        /// <remarks>
        /// Using only partial views instead of controllers for blocks and page partials
        /// has performance benefits as they will only require calls to RenderPartial instead of
        /// RenderAction for controllers.
        /// Registering partial views as templates this way also enables specifying tags and
        /// that a template supports all types inheriting from the content type/model type.
        /// </remarks>
        public void Register(TemplateModelCollection viewTemplateModelRegistrator)
        {
            viewTemplateModelRegistrator.Add(typeof(JumbotronBlock), new TemplateModel
            {
                Tags = new[] { Global.ContentAreaTags.FullWidth },
                AvailableWithoutTag = false,
                Path = BlockPath("JumbotronBlockWide.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(TeaserBlock), new TemplateModel
            {
                Name = "TeaserBlockWide",
                Tags = new[] { Global.ContentAreaTags.TwoThirdsWidth, Global.ContentAreaTags.FullWidth },
                AvailableWithoutTag = false,
                Path = BlockPath("TeaserBlockWide.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(SitePageData), new TemplateModel
            {
                Name                = "PagePartial",
                Inherit             = true,
                AvailableWithoutTag = true,
                Path                = PagePartialPath("Page.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(SitePageData), new TemplateModel
            {
                Name                = "PagePartialWide",
                Inherit             = true,
                Tags                = new[] { Global.ContentAreaTags.TwoThirdsWidth, Global.ContentAreaTags.FullWidth },
                AvailableWithoutTag = false,
                Path                = PagePartialPath("PageWide.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(ContactPage), new TemplateModel
            {
                Name = "ContactPagePartialWide",
                Tags = new[] { Global.ContentAreaTags.TwoThirdsWidth, Global.ContentAreaTags.FullWidth },
                AvailableWithoutTag = false,
                Path = PagePartialPath("ContactPageWide.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(IContentData), new TemplateModel
            {
                Name                = "NoRendererMessage",
                Inherit             = true,
                Tags                = new[] { Global.ContentAreaTags.NoRenderer },
                AvailableWithoutTag = false,
                Path                = BlockPath("NoRenderer.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(TwitterBlock), new TemplateModel
            {
                Tags = new[] { Global.ContentAreaTags.OneThirdWidth },
                AvailableWithoutTag = false,
                Path = BlockPath("TwitterBlockNarrow.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(FacebookBlock), new TemplateModel
            {
                Tags = new[] { Global.ContentAreaTags.OneThirdWidth },
                AvailableWithoutTag = false,
                Path = BlockPath("FacebookBlockNarrow.cshtml")
            });

            viewTemplateModelRegistrator.Add(typeof(LinkedInCompanyBlock), new TemplateModel
            {
                Tags = new[] { Global.ContentAreaTags.OneThirdWidth },
                AvailableWithoutTag = false,
                Path = BlockPath("LinkedInCompanyBlockNarrow.cshtml"),
            });
        }