Skip to content

Commit

Permalink
Improved single page app functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
mac committed Apr 18, 2019
1 parent 7df3989 commit a50ea5f
Show file tree
Hide file tree
Showing 22 changed files with 51 additions and 54 deletions.
2 changes: 2 additions & 0 deletions FrameworkLibrary/DataMappers/MediaDetailsMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1378,6 +1378,8 @@ public static string ParseSpecialTags(IMediaDetail mediaDetail, string propertyN
fileContent = ParserHelper.ParseData(fileContent, razorFieldParams);

customCode = customCode.Replace(item.ToString().ToString(), fileContent);

customCode = ParseSpecialTags(mediaDetail, customCode);
}
}
}
Expand Down
Binary file modified WebApplication/App_Data/DB/FlexDotnetCMS.mdf
Binary file not shown.
Binary file modified WebApplication/App_Data/DB/FlexDotnetCMS_log.ldf
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
var Response = HttpContext.Current.Response;
var Server = HttpContext.Current.Server;

if(Request.Url.AbsolutePath != "/" && !BasePage.IsAjaxRequest)
/*if(Request.Url.AbsolutePath != "/" && !BasePage.IsAjaxRequest)
{
Response.Redirect("/#"+Request.Url.PathAndQuery);
<meta http-equiv="refresh" content="0;URL='/#@Request.Url.PathAndQuery'">
}
}*/

if (!AppSettings.IsRunningOnProd)
{
Expand Down
4 changes: 3 additions & 1 deletion WebApplication/Frontend/layouts/includes/header-home.cshtml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
Header Home
Header Home

{IncludeFile:'/Frontend/layouts/includes/nav-interior.cshtml'}
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
Header Interior
Header Interior

{IncludeFile:'/Frontend/layouts/includes/nav-interior.cshtml'}
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
<!-- Header -->
{IncludeFile:'/Frontend/layouts/includes/header-home.cshtml'}


{Field:MainContent}
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
{Field:MainContent}
<!-- Header -->
{IncludeFile:'/Frontend/layouts/includes/header-interior.cshtml'}

{Field:MainContent}
26 changes: 1 addition & 25 deletions WebApplication/Frontend/layouts/page-layouts/index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var ajaxOptions = {
preloadLinks: false,
animateIn: function (selector, html) {
$(selector).each(function (index, el) {
//$(el).html(html);
//$(el).html(html);
$(el).toggle("fade", 250, function () {
window.scrollTo(0, 0);
$(el).html(html);
Expand All @@ -21,28 +21,4 @@ var ajaxOptions = {
initAjaxOptions(ajaxOptions);
</script>

<nav class="navbar navbar-expand-xl navbar--home" id="mainNav">
<a class="navbar-brand img-container" href="/home/">
<img src="/media/uploads/images/logo-horizontal.svg" alt="Logo" />
</a>
<div class="navbar__toggles">
<a href="javascript:void(0)" class="search__toggle">
<i class="fa fa-search" aria-hidden="true"></i>
</button>
<a href="javascript:void(0)" class="menu__toggle">
<i class="fa fa-bars" aria-hidden="true"></i>
</a>
</div>
<div class="navbar__search">
<i class="fa fa-times" aria-hidden="true"></i>
<div class="navbar-search">
<i class="fa fa-search" aria-hidden="true"></i>
<input type="text" class="searchList" placeholder="Search for practice area or lawyer" />
</div>
</div>
<div class="navbar__menu">
<i class="fa fa-times" aria-hidden="true"></i>
{{Load:8}.Field:MainMenu}
</div>
</nav>
<div id="DynamicContent"></div>
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@

<Site:LoggedInHeader runat="server" />

<!-- Header -->
{IncludeFile:'/Frontend/layouts/includes/header-home.cshtml'}

<!-- PageContent -->
{PageContent}
<div id="DynamicContent">
<!-- PageContent -->
{PageContent}
</div>

<!-- Footer -->
{{Load:9}.UseMainLayout}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
{Settings:GlobalCodeInBody}
<Site:LoggedInHeader runat="server" />

<!-- Header -->
{IncludeFile:'/Frontend/layouts/includes/header-interior.cshtml'}

<!-- PageContent -->
{PageContent}
<div id="DynamicContent">
<!-- PageContent -->
{PageContent}
</div>

<!-- Footer -->
{{Load:9}.UseMainLayout}
Expand Down
24 changes: 17 additions & 7 deletions WebApplication/Frontend/scripts/jquery-ajax-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ var ajaxOptions = {
homePagePath: "/home/",
targetElement: "#DynamicContent",
preloadLinks: false,
animateIn: function (selector, html) {
animateIn: function (selector, html) {
$(selector).each(function (index, el) {
//$(el).html(html);
$(el).toggle("fade", 250, function () {

$(el).toggle("fade", 250, function () {
$(el).html(html);
//$(el).css("height", "100%");
// $("#mainNav").effect("fade");
Expand All @@ -23,6 +24,7 @@ function initAjaxOptions(options) {
function loadeData(selector, html) {
$(".nav-link").parent().removeClass("current");
$(".searchList").val("");

ajaxOptions.animateIn(selector, html);
}

Expand All @@ -46,13 +48,13 @@ $(document).ready(function () {
preloadLinks();
}

if (window.location.hash != "") {
/*if (window.location.hash != "") {
var url = window.location.hash.replace("#", "");
ajaxLoadUrl(url, ajaxOptions.targetElement);
}
else {
ajaxLoadUrl(ajaxOptions.homePagePath + window.location.search, ajaxOptions.targetElement);
}
}*/

window.onpopstate = function (event) {

Expand Down Expand Up @@ -124,6 +126,14 @@ function pushHistory(href, bodyHtml) {

function _loadData(href, el, bodyHtml, callBackFunction) {

if ($("#DynamicContent").length > 0 && bodyHtml.indexOf("DynamicContent") != -1) {
var doc = $('<output>').append($.parseHTML(bodyHtml, document, true));
var dynamicContent = doc.find("#DynamicContent").html();

bodyHtml = dynamicContent;
}


if (callBackFunction != undefined && callBackFunction != "" && callBackFunction != null) {
callBackFunction($(el), bodyHtml);
}
Expand Down Expand Up @@ -240,9 +250,9 @@ function ajaxLoadUrl(href, targetElement, callBackFunction) {
querySeperator = "&";
}

if (href.indexOf("homePagePath") == -1) {
href = href + querySeperator + "homePagePath=" + ajaxOptions.homePagePath;
}
//if (href.indexOf("homePagePath") == -1) {
// href = href + querySeperator + "homePagePath=" + ajaxOptions.homePagePath;
//}

var urlSegment = href.split("?")[0];

Expand Down
2 changes: 1 addition & 1 deletion WebApplication/Global.asax.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private void RegisterRoutes(RouteCollection routes)
routes.Ignore("{*allsvc}", new { allsvc = @".*\.svc(/.*)?" });
routes.Ignore("{*allasmx}", new { allasmx = @".*\.asmx(/.*)?" });

routes.Ignore("{*staticfile}", new { staticfile = @".*\.(jpg|gif|jpeg|png|js|css|htc|ico)$" });
routes.Ignore("{*staticfile}", new { staticfile = @".*\.(jpg|gif|jpeg|png|js|css|htc|ico|svg)$" });

routes.Add("CatchAll", new Route("{*virtualPath}", new Handlers.CustomRouteHandler()));
}
Expand Down
8 changes: 4 additions & 4 deletions WebApplication/Handlers/CustomRouteHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ private void AttemptToLoadFromCache()
URIHelper.ForceSSL();
}

if (Request.Url.AbsolutePath != "/" && !BasePage.IsAjaxRequest)
{
Response.Redirect("/#" + Request.Url.PathAndQuery, true);
}
//if (Request.Url.AbsolutePath != "/" && !BasePage.IsAjaxRequest)
//{
// Response.Redirect("/#" + Request.Url.PathAndQuery, true);
//}

if (Request.QueryString.Count == 0 || (Request.QueryString.Count == 1 && Request.QueryString[BasePage.HomePagePath] != null))
{
Expand Down
2 changes: 1 addition & 1 deletion WebApplication/Web.config
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<add key="MinifyOutput" value="False" />
<add key="AttemptCompression" value="False" />
<add key="CombineCssAndJsIncludes" value="False" />
<add key="EnableOutputCaching" value="True" />
<add key="EnableOutputCaching" value="False" />
<add key="EnableLevel1MemoryCaching" value="False" />
<add key="EnableLevel2FileCaching" value="True" />
<add key="FileSystemCacheDirPath" value="~/App_Data/Cache/" />
Expand Down
Binary file modified WebApplication/bin/FrameworkLibrary.dll
Binary file not shown.
Binary file modified WebApplication/bin/FrameworkLibrary.pdb
Binary file not shown.
Binary file modified WebApplication/bin/TinyFileManager.dll
Binary file not shown.
Binary file modified WebApplication/bin/TinyFileManager.pdb
Binary file not shown.
Binary file modified WebApplication/bin/WebApplication.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion WebApplication/bin/WebApplication.dll.config
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<add key="MinifyOutput" value="False" />
<add key="AttemptCompression" value="False" />
<add key="CombineCssAndJsIncludes" value="False" />
<add key="EnableOutputCaching" value="True" />
<add key="EnableOutputCaching" value="False" />
<add key="EnableLevel1MemoryCaching" value="False" />
<add key="EnableLevel2FileCaching" value="True" />
<add key="FileSystemCacheDirPath" value="~/App_Data/Cache/" />
Expand Down
Binary file modified WebApplication/bin/WebApplication.pdb
Binary file not shown.

0 comments on commit a50ea5f

Please sign in to comment.