Пример #1
0
        protected internal void SetIncludes(AppConf conf, LayoutModel layoutModel)
        {
            Args.ThrowIfNull(conf, "AppConf");
            Args.ThrowIfNull(conf.BamConf, "BamConf");
            Args.ThrowIfNull(conf.BamConf.ContentRoot, "ContentRoot");
            ApplicationServiceRegistry reg = ApplicationServiceRegistry.ForApplication(conf.Name);
            IIncludesResolver          includesResolver = reg.Get <IIncludesResolver>();
            Includes commonIncludes = new Includes();

            if (IncludeCommon)
            {
                commonIncludes = includesResolver.ResolveCommonIncludes(conf.BamConf.ContentRoot);
            }
            Includes      appIncludes        = includesResolver.ResolveApplicationIncludes(conf.Name, conf.BamConf.ContentRoot);
            Includes      combined           = commonIncludes.Combine(appIncludes);
            StringBuilder styleSheetLinkTags = new StringBuilder();

            foreach (string css in combined.Css)
            {
                styleSheetLinkTags.AppendLine(StyleSheetLinkTag.For(css).Render());
            }

            layoutModel.StyleSheetLinkTags = styleSheetLinkTags.ToString();

            StringBuilder scriptLinkTags = new StringBuilder();

            foreach (string script in combined.Scripts)
            {
                scriptLinkTags.Append(ScriptTag.For(script).Render());
            }

            layoutModel.ScriptTags = scriptLinkTags.ToString();
        }
Пример #2
0
        protected internal void SetIncludes(AppConf conf, LayoutModel layoutModel)
        {
            Includes includes = AppContentResponder.GetAppIncludes(conf);

            if (IncludeCommon)
            {
                Includes commonIncludes = ContentResponder.GetCommonIncludes(ContentRoot);
                includes = commonIncludes.Combine(includes);
            }
            layoutModel.ScriptTags         = includes.GetScriptTags().ToHtmlString();
            layoutModel.StyleSheetLinkTags = includes.GetStyleSheetLinkTags().ToHtmlString();
        }