fixing trailing slashes ui.router
This commit is contained in:
parent
9344675546
commit
b1e29b8d8d
19
js/app.js
19
js/app.js
|
@ -20,15 +20,19 @@ app.directive('daplieFileChange', function () {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
app.config(['$stateProvider', '$urlRouterProvider', 'localStorageServiceProvider',
|
app.config([
|
||||||
function ($stateProvider, $urlRouterProvider, localStorageServiceProvider) {
|
'$stateProvider', '$urlRouterProvider', 'localStorageServiceProvider', '$urlMatcherFactoryProvider',
|
||||||
|
function ($stateProvider, $urlRouterProvider, localStorageServiceProvider, $urlMatcherFactoryProvider) {
|
||||||
|
|
||||||
|
$urlMatcherFactoryProvider.strictMode(false);
|
||||||
|
|
||||||
localStorageServiceProvider.setPrefix('launchpad').setStorageType('sessionStorage');
|
localStorageServiceProvider.setPrefix('launchpad').setStorageType('sessionStorage');
|
||||||
|
|
||||||
$urlRouterProvider.otherwise('/splash-page');
|
$urlRouterProvider.otherwise('/splash-page');
|
||||||
|
|
||||||
$stateProvider
|
$stateProvider
|
||||||
.state('splash-page', {
|
.state('splash-page', {
|
||||||
data: { requiresLogin: false, session: null },
|
data: { requiresLogin: false, session: null },
|
||||||
url: '/splash-page',
|
url: '/splash-page',
|
||||||
templateUrl: '/templates/splash-page.html',
|
templateUrl: '/templates/splash-page.html',
|
||||||
controller: 'loginCtrl as vm'
|
controller: 'loginCtrl as vm'
|
||||||
|
@ -152,12 +156,18 @@ app.config(['$stateProvider', '$urlRouterProvider', 'localStorageServiceProvider
|
||||||
|
|
||||||
app.run(['$rootScope', '$state', 'Auth', '$location', function($rootScope, $state, Auth, $location) {
|
app.run(['$rootScope', '$state', 'Auth', '$location', function($rootScope, $state, Auth, $location) {
|
||||||
$rootScope.urlArray = [];
|
$rootScope.urlArray = [];
|
||||||
|
$rootScope.urlInfo = {
|
||||||
|
url: $location.$$url,
|
||||||
|
path: $location.$$path,
|
||||||
|
params: $location.$$search
|
||||||
|
};
|
||||||
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
|
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
|
||||||
var requiresLogin = toState.data.requiresLogin;
|
var requiresLogin = toState.data.requiresLogin;
|
||||||
toState.data.session = $location.search();
|
// toState.data.session = $location.search();
|
||||||
$rootScope.redirectedURL = toState.url;
|
$rootScope.redirectedURL = toState.url;
|
||||||
var query = $location.search();
|
var query = $location.search();
|
||||||
$rootScope.urlArray.push($rootScope.redirectedURL);
|
$rootScope.urlArray.push($rootScope.redirectedURL);
|
||||||
|
|
||||||
if (requiresLogin && !Auth.isLoggedIn()) {
|
if (requiresLogin && !Auth.isLoggedIn()) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if (!angular.equals(toState.data.session, {})) {
|
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 });
|
$state.go('splash-page', { 'toState': toState.name });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}]);
|
}]);
|
||||||
}());
|
}());
|
||||||
|
|
|
@ -106,8 +106,10 @@ app.controller('loginCtrl', [
|
||||||
session.issuer = issuer;
|
session.issuer = issuer;
|
||||||
Auth.add(session);
|
Auth.add(session);
|
||||||
if ($rootScope.redirectedURL === '/splash-page') {
|
if ($rootScope.redirectedURL === '/splash-page') {
|
||||||
|
debugger;
|
||||||
$location.path('/home');
|
$location.path('/home');
|
||||||
} else {
|
} else {
|
||||||
|
debugger;
|
||||||
$location.path('/' + $rootScope.redirectedURL);
|
$location.path('/' + $rootScope.redirectedURL);
|
||||||
}
|
}
|
||||||
}, function (err) {
|
}, function (err) {
|
||||||
|
|
|
@ -66,8 +66,8 @@ app.directive('notificationBar', [function () {
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
app.controller('websiteCtrl', [
|
app.controller('websiteCtrl', [
|
||||||
'$scope', '$q', 'Auth', 'azp@oauth3.org', '$timeout', '$sce',
|
'$scope', '$q', 'Auth', 'azp@oauth3.org', '$timeout', '$sce', '$rootScope',
|
||||||
function ($scope, $q, Auth, Oauth3, $timeout, $sce) {
|
function ($scope, $q, Auth, Oauth3, $timeout, $sce, $rootScope) {
|
||||||
|
|
||||||
var vm = this;
|
var vm = this;
|
||||||
var angular = window.angular;
|
var angular = window.angular;
|
||||||
|
@ -186,6 +186,17 @@ app.controller('websiteCtrl', [
|
||||||
console.log(vm.record);
|
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.selectRecord = function (record) {
|
||||||
vm.record = record;
|
vm.record = record;
|
||||||
vm.newRecord = record.sub;
|
vm.newRecord = record.sub;
|
||||||
|
@ -206,7 +217,6 @@ app.controller('websiteCtrl', [
|
||||||
vm._uploadFile = function (pkg, opts) {
|
vm._uploadFile = function (pkg, opts) {
|
||||||
vm.newFileUploaded = opts.newFile.name;
|
vm.newFileUploaded = opts.newFile.name;
|
||||||
opts.progress = opts.progress || opts;
|
opts.progress = opts.progress || opts;
|
||||||
debugger;
|
|
||||||
return pkg.add({
|
return pkg.add({
|
||||||
hostname: opts.domain
|
hostname: opts.domain
|
||||||
, domain: opts.domain
|
, domain: opts.domain
|
||||||
|
@ -232,12 +242,13 @@ app.controller('websiteCtrl', [
|
||||||
vm.uploadFolderContainer = false;
|
vm.uploadFolderContainer = false;
|
||||||
vm.uploadFileContainer = false;
|
vm.uploadFileContainer = false;
|
||||||
}
|
}
|
||||||
opts.progress.uploadTotal = 0;
|
|
||||||
vm.buildNotification(result, msg);
|
vm.buildNotification(result, msg);
|
||||||
vm.cleanArrays();
|
vm.cleanArrays();
|
||||||
var path = vm.breadcrumbsPath.join('/');
|
var path = vm.breadcrumbsPath.join('/');
|
||||||
cleanPathQuery(path);
|
cleanPathQuery(path);
|
||||||
vm.Sites.contents(vm.copyR, vm.cleanedPath);
|
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.Sites.allContents = function (r) {
|
||||||
vm.copyR = r;
|
vm.copyR = r;
|
||||||
var pkg = Auth.oauth3.pkg('www@daplie.com');
|
var pkg = Auth.oauth3.pkg('www@daplie.com');
|
||||||
debugger;
|
|
||||||
return pkg.contents({
|
return pkg.contents({
|
||||||
hostname: r.domain
|
hostname: r.domain
|
||||||
, domain: r.domain
|
, domain: r.domain
|
||||||
|
@ -370,7 +380,6 @@ app.controller('websiteCtrl', [
|
||||||
, path: r.shareAccess.path
|
, path: r.shareAccess.path
|
||||||
}).then(function (result) {
|
}).then(function (result) {
|
||||||
vm.cleanArrays();
|
vm.cleanArrays();
|
||||||
debugger;
|
|
||||||
vm.folderStructure = result;
|
vm.folderStructure = result;
|
||||||
result.data.forEach(function(data){
|
result.data.forEach(function(data){
|
||||||
if (data.file) {
|
if (data.file) {
|
||||||
|
@ -404,7 +413,6 @@ app.controller('websiteCtrl', [
|
||||||
vm.previousSearchQuery = dir;
|
vm.previousSearchQuery = dir;
|
||||||
vm.displaySpinner = '';
|
vm.displaySpinner = '';
|
||||||
var pkg = Auth.oauth3.pkg('www@daplie.com');
|
var pkg = Auth.oauth3.pkg('www@daplie.com');
|
||||||
debugger;
|
|
||||||
return pkg.contents({
|
return pkg.contents({
|
||||||
hostname: r.domain,
|
hostname: r.domain,
|
||||||
domain: r.domain,
|
domain: r.domain,
|
||||||
|
@ -514,7 +522,6 @@ app.controller('websiteCtrl', [
|
||||||
};
|
};
|
||||||
|
|
||||||
vm.Sites.remove = function (r, opts) {
|
vm.Sites.remove = function (r, opts) {
|
||||||
debugger;
|
|
||||||
if (!window.confirm("Delete files for this site?")) {
|
if (!window.confirm("Delete files for this site?")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -831,8 +838,14 @@ app.controller('websiteCtrl', [
|
||||||
hidden: '',
|
hidden: '',
|
||||||
message: msg
|
message: msg
|
||||||
};
|
};
|
||||||
}
|
} else if (result.data.info) {
|
||||||
else {
|
vm.alertNotification = {
|
||||||
|
className: 'info',
|
||||||
|
title: 'Info',
|
||||||
|
hidden: '',
|
||||||
|
message: msg
|
||||||
|
};
|
||||||
|
} else {
|
||||||
vm.alertNotification = {
|
vm.alertNotification = {
|
||||||
className: 'success',
|
className: 'success',
|
||||||
title: 'Success',
|
title: 'Success',
|
||||||
|
|
|
@ -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">
|
<div class="row">
|
||||||
|
|
||||||
<h1>Create Share</h1>
|
<h1>Create Share</h1>
|
||||||
|
@ -89,7 +92,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="invite-card-container">
|
<div class="invite-card-container">
|
||||||
<div class="invite-option">
|
<div class="invite-option">
|
||||||
<h1>Enter Invite Code</h1>
|
<h1>Enter Invite Code</h1>
|
||||||
|
|
Loading…
Reference in New Issue