Example #1
0
        public void ProcessRequest(HttpContext context)
        {
            HttpRequest request = context.Request;

            string hash = request["hash"];

            if (!string.IsNullOrEmpty(hash))
            {
                ICache cache         = CacheFactory.CreateStyleCache();
                string keyName       = PageHelpers.GetCacheKey(hash);
                byte[] responseBytes = cache.Get <byte[]>(keyName);
                if (responseBytes != null)
                {
                    HttpResponse response = context.Response;

                    response.AppendHeader("Content-Length", responseBytes.Length.ToString(CultureInfo.InvariantCulture));
                    response.ContentType = "text/css";
                    response.Cache.SetCacheability(HttpCacheability.Public);
                    response.Cache.SetExpires(DateTime.Now.Add(TimeSpan.FromDays(30)));
                    response.Cache.SetMaxAge(TimeSpan.FromDays(30));
                    response.Cache.AppendCacheExtension("must-revalidate, proxy-revalidate");

                    response.OutputStream.Write(responseBytes, 0, responseBytes.Length);
                }
            }
        }
        public PartialViewResult LoadSkills()
        {
            var model = new SkillsViewModel()
            {
                Header = PageHelpers.GetChildPage("SkillsList", CurrentPage).Name,
                Skills = ConvertSkillsToListItem()
            };

            return(PartialView("_Skills", model));
        }
 public static void WaitUntilNoPendingAjaxRequests()
 {
     if (PageHelpers.IsAlertPresent())
     {
         return;
     }
     WaitForDocumentReadyState();
     WaitUntilAngularIsReady();
     WaitUntilJqueryIsReady();
     ExplicitWait();
 }
 public bool IsBookingDisplayed(string name, int roomId)
 {
     PageHelpers.ScrollDownToView(1000);
     try
     {
         Browser.WebDriver.FindElement(By.XPath($"//*[contains(text(), '{name} - Room: {roomId}')]"));
         return(true);
     }
     catch (NoSuchElementException)
     {
         return(false);
     }
 }
        public List <SkillsItem> ConvertSkillsToListItem()
        {
            List <SkillsItem> skills = new List <SkillsItem>();

            var skillsListDocumentType = PageHelpers.GetChildPage("SkillsList", CurrentPage);

            foreach (var item in skillsListDocumentType.Children)
            {
                skills.Add(new SkillsItem
                {
                    Name        = item.Name,
                    ImageUrl    = item.GetProperty("image").HasValue ? item.GetPropertyValue <IPublishedContent>("image").Url : string.Empty,
                    Description = item.GetProperty("image").HasValue ? item.GetPropertyValue("description").ToString() : string.Empty,
                });
            }

            return(skills);
        }
Example #6
0
        public async Task <IActionResult> Add(PageView result)
        {
            if (await _pageService.CheckIfSlugExist(result.Slug))
            {
                ModelState.AddModelError("", "Strona o podanym linku istnieje");
            }

            if (!ModelState.IsValid)
            {
                return(View(result));
            }

            var seoSettings = await _seoService.GetSeoSettings();

            await _pageService.Create(PageHelpers.ConvertToModel(result, seoSettings.MainUrl));

            // d. Zapis fullUrl do bazki edycja helpery itp TODO

            return(RedirectToAction("List", "Page"));
        }
Example #7
0
        public async Task <IActionResult> Edit(PageView result)
        {
            var page = await _pageService.Get(result.Id);

            if (page.Slug != result.Slug)
            {
                if (await _pageService.CheckIfSlugExist(result.Slug))
                {
                    ModelState.AddModelError("", "Strona o podanym linku istnieje");
                }
            }

            if (!ModelState.IsValid)
            {
                return(View(result));
            }

            var seoSettings = await _seoService.GetSeoSettings();

            await _pageService.Update(PageHelpers.MergeViewWithModel(page, result, seoSettings.MainUrl));

            return(RedirectToAction("List", "Page"));
        }
Example #8
0
        public async Task <IActionResult> Edit(int Id)
        {
            var page = await _pageService.Get(Id);

            return(View(PageHelpers.ConvertToView(page)));
        }
Example #9
0
 public bool IsFeatureTogglePermanent()
 {
     WaitHelpers.ExplicitWait();
     _filterByACriteria.ActionSendKeys(Constants.FeatureToggleName);
     return(PageHelpers.IsElementPresent(_isPermanentFlag));
 }
Example #10
0
 public void FilterAcceptedByUserColumn(string status)
 {
     _statusesDropdown.WaitForElementToBeClickable();
     PageHelpers.SelectOptionFromDropdown(_statusesDropdown, status);
 }