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;
}
.referrer-modal h2 {
.referrer-modal h4 {
font-family: 'Montserrat', Verdana, Sans-Serif;
color: coral;
}

View File

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

View File

@ -29,14 +29,18 @@ app.controller('loginCtrl', [
if ($location.hash() !== '') {
var str = $location.hash();
var domain = str.split('=')[1];
vm.referrerAlert.msg = domain + " has been created. What next?"
debugger
vm.referrerAlert.title = domain + " has been created. What's next?";
vm.referrerAlert.msg = "Do this next... Or do this... Or this...";
if (str.indexOf('referrer') === 0) {
vm.hideReferrerNotification = '';
vm.closeReferrerModal = function () {
var popup = document.querySelector('.referrer-pop-up');
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.displaySpinner = '';
vm.deleteAll = '';
vm.referrerSelectedDomain = false;
vm.alertNotification = {
hidden: 'hidden'
};
@ -189,16 +190,26 @@ app.controller('websiteCtrl', [
console.log(vm.record);
};
vm.shareInit = function () {
vm.paramInit = function () {
// Share example -> ?token=fe8386d7ad6273bd9ca29864148c0d2d
if ($rootScope.urlCrumbs[$rootScope.urlCrumbs.length -1].params.token !== undefined) {
vm.Shares.inviteToken = $rootScope.urlCrumbs[$rootScope.urlCrumbs.length -1].params.token;
var result = { data: { info: true } };
var msg = "You have a new share.";
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.record = record;
vm.newRecord = record.sub;
@ -361,7 +372,6 @@ app.controller('websiteCtrl', [
r.newFile = vm.newFile;
}
analyzeFile(r.newFile, r);
debugger;
console.log(r);
};
@ -560,7 +570,7 @@ app.controller('websiteCtrl', [
path = vm.cleanedPath;
}
debugger;
// FIXME: Figure out how to download specific folders
// FIXME: Figure out how to download specific folders
return pkg.archive({
hostname: r.domain
, domain: r.domain
@ -744,8 +754,20 @@ app.controller('websiteCtrl', [
Auth.api('domains.list', {}).then(function (els) {
// console.log('[init] domains.list els:');
// console.log(els);
vm.domains = els;
$scope.domain = vm.domains;
if (vm.referrerSelectedDomain) {
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();

View File

@ -1,11 +1,11 @@
<div class="container" ng-init="vm.shareInit()">
<div class="container" ng-init="vm.paramInit()">
<div class="row">
<notification-bar></notification-bar>
</div>
<div class="row">
<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
</button>

View File

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