Details
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/index.ftl b/forms/common-themes/src/main/resources/theme/base/admin/index.ftl
index 20e21b7..3883361 100755
--- a/forms/common-themes/src/main/resources/theme/base/admin/index.ftl
+++ b/forms/common-themes/src/main/resources/theme/base/admin/index.ftl
@@ -64,7 +64,7 @@
<div data-ng-include data-src="resourceUrl + '/partials/menu.html'"></div>
</header>
-<div class="container" data-ng-show="auth.hasAnyAccess">
+<div class="container">
<div data-ng-view id="view"></div>
<div id="loading" class="loading-backdrop">
<div class="loading">
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/app.js b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/app.js
index f45453c..1fe3440 100755
--- a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/app.js
+++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/app.js
@@ -908,8 +908,6 @@ module.config([ '$routeProvider', function($routeProvider) {
},
controller : 'ProtocolListCtrl'
})
-
-
.when('/server-info', {
templateUrl : resourceUrl + '/partials/server-info.html'
})
@@ -917,8 +915,14 @@ module.config([ '$routeProvider', function($routeProvider) {
templateUrl : resourceUrl + '/partials/home.html',
controller : 'LogoutCtrl'
})
- .otherwise({
+ .when('/notfound', {
templateUrl : resourceUrl + '/partials/notfound.html'
+ })
+ .when('/forbidden', {
+ templateUrl : resourceUrl + '/partials/forbidden.html'
+ })
+ .otherwise({
+ templateUrl : resourceUrl + '/partials/pagenotfound.html'
});
} ]);
@@ -942,29 +946,6 @@ module.config(function($httpProvider) {
});
-module.factory('errorInterceptor', function($q, $window, $rootScope, $location, Notifications, Auth) {
- return function(promise) {
- return promise.then(function(response) {
- return response;
- }, function(response) {
- if (response.status == 401) {
- Auth.authz.logout();
- } else if (response.status == 403) {
- Notifications.error("Forbidden");
- } else if (response.status == 404) {
- Notifications.error("Not found");
- } else if (response.status) {
- if (response.data && response.data.errorMessage) {
- Notifications.error(response.data.errorMessage);
- } else {
- Notifications.error("An unexpected server error has occurred");
- }
- }
- return $q.reject(response);
- });
- };
-});
-
module.factory('spinnerInterceptor', function($q, $window, $rootScope, $location) {
return function(promise) {
return promise.then(function(response) {
@@ -992,6 +973,29 @@ module.factory('spinnerInterceptor', function($q, $window, $rootScope, $location
};
});
+module.factory('errorInterceptor', function($q, $window, $rootScope, $location, Notifications, Auth) {
+ return function(promise) {
+ return promise.then(function(response) {
+ return response;
+ }, function(response) {
+ if (response.status == 401) {
+ Auth.authz.logout();
+ } else if (response.status == 403) {
+ $location.path('/forbidden');
+ } else if (response.status == 404) {
+ $location.path('/notfound');
+ } else if (response.status) {
+ if (response.data && response.data.errorMessage) {
+ Notifications.error(response.data.errorMessage);
+ } else {
+ Notifications.error("An unexpected server error has occurred");
+ }
+ }
+ return $q.reject(response);
+ });
+ };
+});
+
// collapsable form fieldsets
module.directive('collapsable', function() {
return function(scope, element, attrs) {
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js
index 97c1bda..387aa53 100755
--- a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js
+++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js
@@ -121,12 +121,8 @@ module.controller('RealmDropdownCtrl', function($scope, Realm, Current, Auth, $l
$scope.changeRealm = function(selectedRealm) {
$location.url("/realms/" + selectedRealm);
- };
-
- $scope.showNav = function() {
- var show = Current.realms.length > 0;
- return Auth.loggedIn && show;
}
+
$scope.refresh = function() {
Current.refresh();
}
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/forbidden.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/forbidden.html
new file mode 100755
index 0000000..6a0d5bf
--- /dev/null
+++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/forbidden.html
@@ -0,0 +1,7 @@
+<div id="content-area" class="col-sm-12" role="main">
+ <div class="error-container">
+ <h2>Forbidden</h2>
+ <p class="instruction">You don't have access to the requested resource.</p>
+ <a href="#" class="link-right">Go to the home page »</a>
+ </div>
+</div>
\ No newline at end of file
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/menu.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/menu.html
index 76ace6b..66f58c9 100755
--- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/menu.html
+++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/menu.html
@@ -26,8 +26,8 @@
</li>
</ul>
<ul class="nav navbar-nav navbar-primary persistent-secondary" data-ng-controller="RealmDropdownCtrl">
- <li class="dropdown context" data-ng-show="showNav()">
- <a href="#" class="dropdown-toggle" data-toggle="dropdown">
+ <li class="dropdown context" data-ng-show="current.realm.realm">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">
{{current.realm.realm}}
<b class="caret" data-ng-show="current.realms.length > 1"></b>
</a>
@@ -37,6 +37,17 @@
</li>
</ul>
</li>
+ <li class="dropdown context" data-ng-show="!current.realm.realm">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">
+ Select realm...
+ <b class="caret"></b>
+ </a>
+ <ul class="dropdown-menu">
+ <li data-ng-repeat="realm in current.realms">
+ <a href="" ng-click="changeRealm(realm.realm)">{{realm.realm}}</a>
+ </li>
+ </ul>
+ </li>
<li class="active pull-right" data-ng-show="auth.user && access.createRealm">
<a class="button primary" href="#/create/realm" data-ng-class="path[0] == 'create' && path[1] == 'realm' && 'active'"
data-ng-show="auth.user">Add Realm</a>
@@ -45,6 +56,7 @@
</div>
</div>
</nav>
+
<!-- TODO remove once this page is properly styled -->
<style type="text/css">
.icon-spinner6 {
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/notfound.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/notfound.html
index bdbb997..05652f0 100755
--- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/notfound.html
+++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/notfound.html
@@ -1,14 +1,7 @@
-<div id="wrapper" class="container">
- <div class="row">
- <div class="bs-sidebar col-md-3 clearfix"></div>
- <div id="content-area" class="col-md-9" role="main">
- <div class="error-container">
- <h2>Page <strong>not found</strong>...</h2>
- <p class="instruction">We could not find the page you are looking for. Please make sure the URL you entered is correct.</p>
- <a href="#" class="link-right">Go to the home page »</a>
- <!-- <a href="#" class="link-right">Go to the realm page »</a> -->
- </div>
- </div>
- <div id="container-right-bg"></div>
+<div id="content-area" class="col-sm-12" role="main">
+ <div class="error-container">
+ <h2>Resource <strong>not found</strong>...</h2>
+ <p class="instruction">We could not find the resource you are looking for. Please make sure the URL you entered is correct.</p>
+ <a href="#" class="link-right">Go to the home page »</a>
</div>
</div>
\ No newline at end of file
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/pagenotfound.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/pagenotfound.html
new file mode 100755
index 0000000..769d71e
--- /dev/null
+++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/pagenotfound.html
@@ -0,0 +1,7 @@
+<div id="content-area" class="col-sm-12" role="main">
+ <div class="error-container">
+ <h2>Page <strong>not found</strong>...</h2>
+ <p class="instruction">We could not find the page you are looking for. Please make sure the URL you entered is correct.</p>
+ <a href="#" class="link-right">Go to the home page »</a>
+ </div>
+</div>
\ No newline at end of file