Ejemplo n.º 1
0
 public async Task <IHttpActionResult> GetPageFooter()
 {
     return(await HttpActionResultWithErrorHandling(SecurityActions.AllowAll, async() =>
     {
         var privateFooter = _adminRepo.GetFooter().First();
         var defaultFooter = _adminRepo.GetDefaultFooter();
         if (privateFooter == null)
         {
             return Json(defaultFooter);
         }
         else
         {
             var footer = new FooterConfig();
             footer.ContactEmail = string.IsNullOrEmpty(privateFooter.ContactEmail)
                 ? defaultFooter.ContactEmail
                 : privateFooter.ContactEmail;
             footer.CopyRight = string.IsNullOrEmpty(privateFooter.CopyRight)
                 ? defaultFooter.CopyRight
                 : privateFooter.CopyRight;
             footer.FootHeader = string.IsNullOrEmpty(privateFooter.FootHeader)
                 ? defaultFooter.FootHeader
                 : privateFooter.FootHeader;
             footer.TenantInfo = string.IsNullOrEmpty(privateFooter.TenantInfo)
                 ? defaultFooter.TenantInfo
                 : privateFooter.TenantInfo;
             footer.TenantInfoURL = string.IsNullOrEmpty(privateFooter.TenantInfoURL)
                 ? defaultFooter.TenantInfoURL
                 : privateFooter.TenantInfoURL;
             return Json(footer);
         }
     }));
 }
Ejemplo n.º 2
0
 public async Task <IHttpActionResult> UpdateFooterInfo([FromBody] FooterConfig footer)
 {
     return(await HttpActionResultWithErrorHandling(SecurityActions.ConfigureEntityStuff, async() =>
     {
         var returnedFooter = _adminRepo.UpdateFooterInfo(footer);
         return Json(returnedFooter);
     }));
 }
Ejemplo n.º 3
0
        public void Footer()
        {
            FooterBuilder footerBuilder = new FooterBuilder(null);
            FooterBuilder actionBuilder = null;
            FooterConfig  config        = null;

            _builderFactory.FooterBuilder(Arg.Do <FooterConfig>(fc => config = fc)).Returns(footerBuilder);

            TableBuilder <TableEntity> builder = _builder.Footer(fb => actionBuilder = fb);

            this.RenderAndVerify();

            _builderFactory.Received(1).FooterBuilder(Arg.Any <FooterConfig>());
            actionBuilder.Should().BeSameAs(footerBuilder);
            config.Should().BeSameAs(_config.Footer);
            builder.Should().BeSameAs(_builder);
        }
 internal MvcCoreBootstrapTableFooterBuilder(FooterConfig config)
 {
     _config = config;
 }
Ejemplo n.º 5
0
        public void FooterElements(bool text, bool css, bool paging, bool multiplePages, bool pageInfo,
                                   bool directPageAccess)
        {
            FooterConfig config = new FooterConfig
            {
                Text  = text ? "Text" : null,
                State = css ? ContextualState.Danger : ContextualState.Default,
            };

            if (css)
            {
                config.CssClasses.Add("Css1");
                config.CssClasses.Add("Css2");
            }
            _tableConfig.Footer.Returns(config);
            _tableConfig.Paging.Returns(new PagingConfig
            {
                PageSize = paging ? 2 : 0, DirectPageAccess = directPageAccess, PageInfo = pageInfo,
            });

            this.ActAndValidate(multiplePages ? 5 : 2);

            TableNode footer = this.Node("tfoot");

            if (text || (paging && (multiplePages || pageInfo)))
            {
                IEnumerable <string> cssClasses = css
                    ? config.CssClasses.Concat(new [] { "danger" })
                    : Enumerable.Empty <string>();
                List <Action <TableNode> > verifyActions = new List <Action <TableNode> >();

                footer.Should().NotBeNull();
                TableNode footerRow  = this.OnlyInner(footer, "tr");
                TableNode footerCell = this.OnlyInner(footerRow, "td");
                this.VerifyCssClasses(footerCell.Element, cssClasses);
                this.VerifyAttribute(footerCell.Element, "colspan", "3");

                if (pageInfo)
                {
                    verifyActions.Add(this.VerifyFooterPageInfo);
                }
                if (paging && multiplePages)
                {
                    if (directPageAccess)
                    {
                        verifyActions.Add(this.VerifyFooterDirectPageAccess);
                    }
                    verifyActions.Add(this.VerifyFooterNavLast);
                    verifyActions.Add(this.VerifyFooterNavNext);
                    verifyActions.Add(this.VerifyFooterNavPrev);
                    verifyActions.Add(this.VerifyFooterNavFirst);
                }
                if (text)
                {
                    verifyActions.Add(this.VerifyFooterText);
                }
                footerCell.InnerContent.Should().HaveSameCount(verifyActions);
                for (int i = 0; i < verifyActions.Count; i++)
                {
                    verifyActions[i](footerCell.InnerContent[i]);
                }
            }
            else
            {
                footer.Should().BeNull();
            }
        }
 public MvcCoreBootstrapTableFooterBuilder FooterBuilder(FooterConfig config)
 {
     return(new MvcCoreBootstrapTableFooterBuilder(config));
 }
Ejemplo n.º 7
0
 public FooterBuilder FooterBuilder(FooterConfig config)
 {
     return(new FooterBuilder(config));
 }
Ejemplo n.º 8
0
 internal FooterBuilder(FooterConfig config)
 {
     _config = config;
 }