added directive for referral

This commit is contained in:
Jon Lambson 2017-11-03 16:44:09 -06:00
parent 4e0545036d
commit 574857233d
6 changed files with 43 additions and 18 deletions

View File

@ -784,7 +784,7 @@ multiselect .dropdown-menu > li > a {
z-index: -1; z-index: -1;
} }
.referrer-modal h2 { .referrer-modal h4 {
font-family: 'Montserrat', Verdana, Sans-Serif; font-family: 'Montserrat', Verdana, Sans-Serif;
color: coral; color: coral;
} }

View File

@ -168,7 +168,6 @@ app.run(['$rootScope', '$state', 'Auth', '$location', function($rootScope, $stat
fromPath: fromState.url fromPath: fromState.url
}; };
$rootScope.urlCrumbs.push(Crumbs); $rootScope.urlCrumbs.push(Crumbs);
console.log($rootScope.urlCrumbs);
if (requiresLogin && !Auth.isLoggedIn()) { if (requiresLogin && !Auth.isLoggedIn()) {
event.preventDefault(); event.preventDefault();
$state.go('splash-page', { 'toState': toState.name }); $state.go('splash-page', { 'toState': toState.name });

View File

@ -29,14 +29,18 @@ app.controller('loginCtrl', [
if ($location.hash() !== '') { if ($location.hash() !== '') {
var str = $location.hash(); var str = $location.hash();
var domain = str.split('=')[1]; var domain = str.split('=')[1];
vm.referrerAlert.msg = domain + " has been created. What next?" vm.referrerAlert.title = domain + " has been created. What's next?";
debugger vm.referrerAlert.msg = "Do this next... Or do this... Or this...";
if (str.indexOf('referrer') === 0) { if (str.indexOf('referrer') === 0) {
vm.hideReferrerNotification = ''; vm.hideReferrerNotification = '';
vm.closeReferrerModal = function () { vm.closeReferrerModal = function () {
var popup = document.querySelector('.referrer-pop-up'); var popup = document.querySelector('.referrer-pop-up');
popup.style.display = 'none'; popup.style.display = 'none';
$location.url($location.path());
};
vm.sendToShares = function (){
$location.path('/website');
vm.hideReferrerNotification = 'hidden';
}; };
} }
} }

View File

@ -75,6 +75,7 @@ app.controller('websiteCtrl', [
vm.copyUploadPath = ''; vm.copyUploadPath = '';
vm.displaySpinner = ''; vm.displaySpinner = '';
vm.deleteAll = ''; vm.deleteAll = '';
vm.referrerSelectedDomain = false;
vm.alertNotification = { vm.alertNotification = {
hidden: 'hidden' hidden: 'hidden'
}; };
@ -189,16 +190,26 @@ app.controller('websiteCtrl', [
console.log(vm.record); console.log(vm.record);
}; };
vm.shareInit = function () { vm.paramInit = function () {
// Share example -> ?token=fe8386d7ad6273bd9ca29864148c0d2d
if ($rootScope.urlCrumbs[$rootScope.urlCrumbs.length -1].params.token !== undefined) { if ($rootScope.urlCrumbs[$rootScope.urlCrumbs.length -1].params.token !== undefined) {
vm.Shares.inviteToken = $rootScope.urlCrumbs[$rootScope.urlCrumbs.length -1].params.token; vm.Shares.inviteToken = $rootScope.urlCrumbs[$rootScope.urlCrumbs.length -1].params.token;
var result = { data: { info: true } }; var result = { data: { info: true } };
var msg = "You have a new share."; var msg = "You have a new share.";
vm.buildNotification(result, msg); vm.buildNotification(result, msg);
} }
console.log($rootScope,$location);
// Referrer example -> #referrer=daplieeleven.daplie.me
vm.referrerSelectedDomainName = $location.url().split('=')[1];
if ($location.url().includes('referrer')) {
$timeout(function() {
var el = document.querySelector('.create-share-btn');
el.click();
vm.referrerSelectedDomain = true;
}, 0);
}
}; };
vm.selectRecord = function (record) { vm.selectRecord = function (record) {
vm.record = record; vm.record = record;
vm.newRecord = record.sub; vm.newRecord = record.sub;
@ -361,7 +372,6 @@ app.controller('websiteCtrl', [
r.newFile = vm.newFile; r.newFile = vm.newFile;
} }
analyzeFile(r.newFile, r); analyzeFile(r.newFile, r);
debugger;
console.log(r); console.log(r);
}; };
@ -744,8 +754,20 @@ app.controller('websiteCtrl', [
Auth.api('domains.list', {}).then(function (els) { Auth.api('domains.list', {}).then(function (els) {
// console.log('[init] domains.list els:'); // console.log('[init] domains.list els:');
// console.log(els); // console.log(els);
vm.domains = els; if (vm.referrerSelectedDomain) {
$scope.domain = vm.domains; Object.keys(els).forEach(function (key) {
console.log(key);
console.log(els[key])
if (els[key]['domain'] === vm.referrerSelectedDomainName) {
// vm.domains = els[key];
vm.domains = [];
$scope.domain = vm.domains;
}
})
} else {
vm.domains = els;
$scope.domain = vm.domains;
}
}); });
vm.listSites(); vm.listSites();

View File

@ -1,11 +1,11 @@
<div class="container" ng-init="vm.shareInit()"> <div class="container" ng-init="vm.paramInit()">
<div class="row"> <div class="row">
<notification-bar></notification-bar> <notification-bar></notification-bar>
</div> </div>
<div class="row"> <div class="row">
<h1>Create Share</h1> <h1>Create Share</h1>
<button class="btn btn-primary btn-lg" title="..." data-toggle="modal" data-target=".create-website-modal"> <button class="btn btn-primary btn-lg create-share-btn" title="..." data-toggle="modal" data-target=".create-website-modal">
Create Share Create Share
</button> </button>

View File

@ -1,9 +1,9 @@
<div class="referrer-modal"> <div class="referrer-modal {{ vm.hideReferrerNotification }}">
<div class="referrer-pop-up"> <div class="referrer-pop-up">
<h2>{{ vm.referrerAlert.msg }}</h2> <h4>{{ vm.referrerAlert.title }}</h4>
<p>asdf</p> <p>{{ vm.referrerAlert.msg }}</p>
<a class="btn btn-danger close-referrer-pop-up" ng-click="vm.closeReferrerModal()">Close</a> <a class="btn btn-danger close-referrer-pop-up" ng-click="vm.closeReferrerModal()">Close</a>
<a class="btn btn-default">Maybe later</a> <a class="btn btn-default" ng-click="vm.closeReferrerModal()">Maybe later</a>
<a class="btn btn-success">Do it now</a> <a class="btn btn-success" ng-click="vm.sendToShares()">Do it now</a>
</div> </div>
</div> </div>