1
0
Fork 0

fixing trailing slashes ui.router

Esse commit está contido em:
Jon Lambson 2017-10-30 15:45:58 -06:00
commit b1e29b8d8d
4 arquivos alterados com 44 adições e 16 exclusões

Ver arquivo

@ -20,15 +20,19 @@ app.directive('daplieFileChange', function () {
};
});
app.config(['$stateProvider', '$urlRouterProvider', 'localStorageServiceProvider',
function ($stateProvider, $urlRouterProvider, localStorageServiceProvider) {
app.config([
'$stateProvider', '$urlRouterProvider', 'localStorageServiceProvider', '$urlMatcherFactoryProvider',
function ($stateProvider, $urlRouterProvider, localStorageServiceProvider, $urlMatcherFactoryProvider) {
$urlMatcherFactoryProvider.strictMode(false);
localStorageServiceProvider.setPrefix('launchpad').setStorageType('sessionStorage');
$urlRouterProvider.otherwise('/splash-page');
$stateProvider
.state('splash-page', {
data: { requiresLogin: false, session: null },
data: { requiresLogin: false, session: null },
url: '/splash-page',
templateUrl: '/templates/splash-page.html',
controller: 'loginCtrl as vm'
@ -152,12 +156,18 @@ app.config(['$stateProvider', '$urlRouterProvider', 'localStorageServiceProvider
app.run(['$rootScope', '$state', 'Auth', '$location', function($rootScope, $state, Auth, $location) {
$rootScope.urlArray = [];
$rootScope.urlInfo = {
url: $location.$$url,
path: $location.$$path,
params: $location.$$search
};
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
var requiresLogin = toState.data.requiresLogin;
toState.data.session = $location.search();
// toState.data.session = $location.search();
$rootScope.redirectedURL = toState.url;
var query = $location.search();
$rootScope.urlArray.push($rootScope.redirectedURL);
if (requiresLogin && !Auth.isLoggedIn()) {
event.preventDefault();
if (!angular.equals(toState.data.session, {})) {
@ -169,6 +179,7 @@ app.run(['$rootScope', '$state', 'Auth', '$location', function($rootScope, $stat
$state.go('splash-page', { 'toState': toState.name });
}
}
});
}]);
}());

Ver arquivo

@ -106,8 +106,10 @@ app.controller('loginCtrl', [
session.issuer = issuer;
Auth.add(session);
if ($rootScope.redirectedURL === '/splash-page') {
debugger;
$location.path('/home');
} else {
debugger;
$location.path('/' + $rootScope.redirectedURL);
}
}, function (err) {

Ver arquivo

@ -66,8 +66,8 @@ app.directive('notificationBar', [function () {
}]);
app.controller('websiteCtrl', [
'$scope', '$q', 'Auth', 'azp@oauth3.org', '$timeout', '$sce',
function ($scope, $q, Auth, Oauth3, $timeout, $sce) {
'$scope', '$q', 'Auth', 'azp@oauth3.org', '$timeout', '$sce', '$rootScope',
function ($scope, $q, Auth, Oauth3, $timeout, $sce, $rootScope) {
var vm = this;
var angular = window.angular;
@ -186,6 +186,17 @@ app.controller('websiteCtrl', [
console.log(vm.record);
};
vm.shareInit = function () {
if ($rootScope.urlInfo.params.token !== undefined) {
console.log('FISH STICKS', $rootScope.urlInfo);
var result = { data: { info: true } };
var msg = "You can only view inside the ";
vm.buildNotification(result, msg);
// debugger;
}
};
vm.selectRecord = function (record) {
vm.record = record;
vm.newRecord = record.sub;
@ -206,7 +217,6 @@ app.controller('websiteCtrl', [
vm._uploadFile = function (pkg, opts) {
vm.newFileUploaded = opts.newFile.name;
opts.progress = opts.progress || opts;
debugger;
return pkg.add({
hostname: opts.domain
, domain: opts.domain
@ -232,12 +242,13 @@ app.controller('websiteCtrl', [
vm.uploadFolderContainer = false;
vm.uploadFileContainer = false;
}
opts.progress.uploadTotal = 0;
vm.buildNotification(result, msg);
vm.cleanArrays();
var path = vm.breadcrumbsPath.join('/');
cleanPathQuery(path);
vm.Sites.contents(vm.copyR, vm.cleanedPath);
}, function (err) {
console.log(err);
});
};
@ -360,7 +371,6 @@ app.controller('websiteCtrl', [
vm.Sites.allContents = function (r) {
vm.copyR = r;
var pkg = Auth.oauth3.pkg('www@daplie.com');
debugger;
return pkg.contents({
hostname: r.domain
, domain: r.domain
@ -370,7 +380,6 @@ app.controller('websiteCtrl', [
, path: r.shareAccess.path
}).then(function (result) {
vm.cleanArrays();
debugger;
vm.folderStructure = result;
result.data.forEach(function(data){
if (data.file) {
@ -404,7 +413,6 @@ app.controller('websiteCtrl', [
vm.previousSearchQuery = dir;
vm.displaySpinner = '';
var pkg = Auth.oauth3.pkg('www@daplie.com');
debugger;
return pkg.contents({
hostname: r.domain,
domain: r.domain,
@ -514,7 +522,6 @@ app.controller('websiteCtrl', [
};
vm.Sites.remove = function (r, opts) {
debugger;
if (!window.confirm("Delete files for this site?")) {
return;
}
@ -831,8 +838,14 @@ app.controller('websiteCtrl', [
hidden: '',
message: msg
};
}
else {
} else if (result.data.info) {
vm.alertNotification = {
className: 'info',
title: 'Info',
hidden: '',
message: msg
};
} else {
vm.alertNotification = {
className: 'success',
title: 'Success',

Ver arquivo

@ -1,4 +1,7 @@
<div class="container">
<div class="container" ng-init="vm.shareInit()">
<div class="row">
<notification-bar></notification-bar>
</div>
<div class="row">
<h1>Create Share</h1>
@ -89,7 +92,6 @@
</div>
</div>
<div class="invite-card-container">
<div class="invite-option">
<h1>Enter Invite Code</h1>