Beispiel #1
0
        public AdminLteTheme(string?title, IHandlerBuilder?logo, Func <IRequest, IHandler, ValueTask <UserProfile?> >?userProfile,
                             Func <IRequest, IHandler, ValueTask <string?> >?footerLeft, Func <IRequest, IHandler, ValueTask <string?> >?footerRight,
                             Func <IRequest, IHandler, ValueTask <string?> >?sidebar, Func <IRequest, IHandler, ValueTask <SearchBox?> >?searchBox,
                             Func <IRequest, IHandler, ValueTask <string?> >?notifications, IMenuProvider?headerMenu)
        {
            _Title = title;

            var resources = Layout.Create()
                            .Fallback(Modules.IO.Resources.From(ResourceTree.FromAssembly("AdminLTE.resources")));

            HasLogo = (logo != null);

            if (logo != null)
            {
                resources.Add("logo.png", logo);
            }

            _UserProfile = userProfile;

            _FooterLeft  = footerLeft;
            _FooterRight = footerRight;

            _Sidebar   = sidebar;
            _SearchBox = searchBox;

            _HeaderMenu    = headerMenu;
            _Notifications = notifications;

            Resources = resources;

            ErrorHandler = ModScriban.Template <ErrorModel>(Resource.FromAssembly("Error.html")).Build();

            Renderer = ModScriban.Template <WebsiteModel>(Resource.FromAssembly("Template.html")).Build();
        }
Beispiel #2
0
        public FortuneHandler(IHandler parent)
        {
            Parent = parent;

            Page = ModScriban.Page(Data.FromResource("Fortunes.html"), (r, h) => GetFortunes(r, h))
                   .Title("Fortunes")
                   .Build(this);

            Template = ModScriban.Template <TemplateModel>(Data.FromResource("Template.html")).Build();
        }
        public ScribanPageProvider(IHandler parent, IResourceProvider templateProvider, ModelProvider <T> modelProvider, ContentInfo pageInfo)
        {
            Parent = parent;

            TemplateProvider = templateProvider;
            ModelProvider    = modelProvider;

            PageInfo = pageInfo;

            Renderer = ModScriban.Template <T>(templateProvider).Build();
        }
        public ArcanaTheme(string?title, string?copyright, Func <IRequest, IHandler, ValueTask <string?> >?footer)
        {
            _Title     = title;
            _Copyright = copyright;

            _Footer = footer;

            Resources = Modules.IO.Resources.From(ResourceTree.FromAssembly("Arcana.resources"));

            ErrorHandler = ModScriban.Template <ErrorModel>(Resource.FromAssembly("Error.html")).Build();

            Renderer = ModScriban.Template <WebsiteModel>(Resource.FromAssembly("Template.html")).Build();
        }
Beispiel #5
0
        public ArcanaTheme(string?title, string?copyright, string?footer1Title, IMenuProvider?footerMenu1, string?footer2Title, IMenuProvider?footerMenu2)
        {
            _Title     = title;
            _Copyright = copyright;

            _FooterMenu1  = footerMenu1;
            _Footer1Title = footer1Title;

            _FooterMenu2  = footerMenu2;
            _Footer2Title = footer2Title;

            Resources = Static.Resources("Arcana.resources");

            ErrorHandler = ModScriban.Template <ErrorModel>(Data.FromResource("Error.html")).Build();

            Renderer = ModScriban.Template <WebsiteModel>(Data.FromResource("Template.html")).Build();
        }
Beispiel #6
0
        private static ITheme GetAdminLTE()
        {
            var menu = Menu.Empty()
                       .Add("{website}/", "Home")
                       .Add("/reports/", "Reports");

            var notifications = ModScriban.Template <IBaseModel>(Resource.FromAssembly("Notifications.html"))
                                .Build();


            return(new AdminLteBuilder().Title("Dracon Interactive")
                   .Logo(Download.From(Resource.FromAssembly("logo.png")))
                   .UserProfile((r, h) => new UserProfile("User Page", "/avatar.png", "/user"))
                   .FooterLeft((r, h) => Helpers.Version)
                   .FooterRight((r, h) => "Peter M Carey (2021)")
                   .Sidebar((r, h) => SideBarConstructor())
                   .Search((r, h) => new SearchBox(""))
                   .Header(menu)
                   .Notifications((r, h) => notifications.RenderAsync(new ViewModel(r, h)).Result)
                   .Build());
        }
        public LorahostTheme(IResourceProvider?header, string?copyright, string?title, string?subtitle, string?action, string?actionTitle)
        {
            _Copyright   = copyright;
            _Title       = title;
            _Subtitle    = subtitle;
            _Action      = action;
            _ActionTitle = actionTitle;

            var resources = Layout.Create()
                            .Fallback(Static.Resources("Lorahost.resources"));

            if (header != null)
            {
                resources.Add("header.jpg", Download.From(header).Type(ContentType.ImageJpg));
            }

            Resources = resources;

            ErrorHandler = ModScriban.Template <ErrorModel>(Data.FromResource("Error.html")).Build();

            Renderer = ModScriban.Template <WebsiteModel>(Data.FromResource("Template.html")).Build();
        }