diff --git a/assets/_src/js/_sessionstate.js b/assets/_src/js/_sessionstate.js new file mode 100644 index 0000000..afc7f14 --- /dev/null +++ b/assets/_src/js/_sessionstate.js @@ -0,0 +1,57 @@ + +var SessionState = (function(w, d, $) { + + 'use strict' + + var app, _private, _config + + _config = { + url: 'https://www.ascribe.io/api/users/', + appLinksDefault: $('.app-links--default'), + appLinksActive: $('.app-links--active') + } + + _private = { + getCookie: function(name) { + var parts = document.cookie.split(';'); + + for(var i = 0; i < parts.length; i++) { + if(parts[i].indexOf(name + '=') > -1) { + return parts[i].split('=').pop(); + } + } + }, + checkSession: function() { + $.ajax({ + method: 'GET', + url: _config.url, + headers: { + 'csrf-token': _private.getCookie('csrftoken2') // be sure to NOT forget the `2` here!!! + } + }).done(function() { + + _config.appLinksDefault.addClass('hide'); + _config.appLinksActive.removeClass('hide'); + + console.log('active and valid session'); + + }).fail(function() { + + _config.appLinksDefault.addClass('hide'); + _config.appLinksActive.removeClass('hide'); + + console.log('no session active'); + + }); + } + } + + app = { + init: function() { + _private.checkSession() + } + } + + return app + +})(window, document, jQuery) diff --git a/assets/_src/js/ascribe.js b/assets/_src/js/ascribe.js index 0d2ca34..74ba3dc 100644 --- a/assets/_src/js/ascribe.js +++ b/assets/_src/js/ascribe.js @@ -1,6 +1,10 @@ +//=include _sessionstate.js + $(document).ready(function(){ + SessionState.init(); + slider(); featuredFAQ(); marketplaces(); diff --git a/assets/_src/less/ascribe/_header.less b/assets/_src/less/ascribe/_header.less index edef98a..4777845 100644 --- a/assets/_src/less/ascribe/_header.less +++ b/assets/_src/less/ascribe/_header.less @@ -176,6 +176,8 @@ color: @pink; } } + + nav { display: inline-block; } } .mobile-nav { diff --git a/assets/_src/less/ascribe/_helpers.less b/assets/_src/less/ascribe/_helpers.less index eecc241..d2d0cf6 100644 --- a/assets/_src/less/ascribe/_helpers.less +++ b/assets/_src/less/ascribe/_helpers.less @@ -1,3 +1,14 @@ + + +.hide { + display: none !important; +} + +.show { + display: block !important; +} + + // CLEARFIX // Apply .clearfix to a non-floated container element with floated elements in it // to ensure the container has a height. Use .no-clearfix to reset a clearfix diff --git a/assets/_src/less/ascribe/_hero.less b/assets/_src/less/ascribe/_hero.less index df137ab..8ae963f 100644 --- a/assets/_src/less/ascribe/_hero.less +++ b/assets/_src/less/ascribe/_hero.less @@ -29,68 +29,6 @@ } } } - nav { - float: left; - margin-top: 9px; - .tourNavText; - - ul { - &:extend(.list-unstyled all); - padding: 0 35px; - position: absolute; - - &.active { - li { - display: block; - &.current-menu-item { - a { - &:after { - transform: rotate(180deg); - } - } - } - } - } - - li { - display: none; - text-align: right; - - &.current-menu-item { - display: block; - - a { - position: relative; - font-size: 25px; - - &:before { - content: 'for '; - display: inline-block; - margin-right: 6px; - } - &:after { - content: ''; - background-image: url(../../img/arrow.png); - background-repeat: no-repeat; - width: 10px; - height: 8px; - display: inline-block; - position: absolute; - top: 10px; - right: -25px; - font-size: 15px; - } - } - } - a { - width: 100%; - font-size: 20px; - } - } - - - } - } .description { clear: both; width: 80%; @@ -157,3 +95,67 @@ } } } + + +.tour-switcher { + float: left; + margin-top: 9px; + .tourNavText; + + ul { + &:extend(.list-unstyled all); + padding: 0 35px; + position: absolute; + + &.active { + li { + display: block; + &.current-menu-item { + a { + &:after { + transform: rotate(180deg); + } + } + } + } + } + + li { + display: none; + text-align: right; + + &.current-menu-item { + display: block; + + a { + position: relative; + font-size: 25px; + + &:before { + content: 'for '; + display: inline-block; + margin-right: 6px; + } + &:after { + content: ''; + background-image: url(../../img/arrow.png); + background-repeat: no-repeat; + width: 10px; + height: 8px; + display: inline-block; + position: absolute; + top: 10px; + right: -25px; + font-size: 15px; + } + } + } + a { + width: 100%; + font-size: 20px; + } + } + + + } +} diff --git a/template-blogheader.php b/template-blogheader.php index 69063da..31cf1bd 100644 --- a/template-blogheader.php +++ b/template-blogheader.php @@ -14,7 +14,9 @@ require 'controller/init.php';