app
.config(function ($stateProvider) {
if (!angular.isFunction($stateProvider.extendState)) {
var extendedStates = {};
$stateProvider.extendState = function (name, newState) {
extendedStates[name] = extendedStates[name] || {};
angular.merge(extendedStates[name], newState);
return $stateProvider;
};
$stateProvider.decorator('state',
function (state) {
if (angular.isDefined(extendedStates[state.self.name])) {
angular.merge(state, extendedStates[state.self.name]);
}
}
);
}
$stateProvider
.state('home', {
abstract: true,
views: {
"headerView": {
templateUrl: '/_module/admin/views/breadcrumb.html',
controller: function ($scope, $rootScope, $state) {
$rootScope.$on('$stateChangeSuccess', function (event, toState) {
$scope.statePath = [];
var j = $state.$current.path.length;
for (var i = 1; i < j; i++) {
if (angular.isDefined($state.$current.path[i]) &&
angular.isDefined($state.$current.path[i].data) &&
$state.$current.path[i].data.name) {
$scope.statePath.push({
label: $state.$current.path[i].data.name,
name: $state.$current.path[i].self.name
});
}
}
if (angular.isDefined($state.$current.data) && angular.isDefined($state.$current.data.name)) {
$scope.stateName = $state.$current.data.name;
}
});
$scope.statePath = [];
var j = $state.$current.path.length;
for (var i = 1; i < j; i++) {
if (angular.isDefined($state.$current.path[i]) &&
angular.isDefined($state.$current.path[i].data) &&
$state.$current.path[i].data.name) {
$scope.statePath.push({
label: $state.$current.path[i].data.name,
name: $state.$current.path[i].self.name
});
}
}
if (angular.isDefined($state.$current.data) && angular.isDefined($state.$current.data.name)) {
$scope.stateName = $state.$current.data.name;
}
}
},
"mainView": {
template: ''
}
}
})
.state('home.dashboard', {
data: {
name: 'Pulpit'
},
url: '/',
views: {
'plugins@home.dashboard': {
template: ''
},
'affiliation@home.dashboard': {
template: ''
},
'': {
controller: Controllers.Dashboard,
templateUrl: '/_module/admin/views/dashboard/dashboard.html'
}
}
})
/* ADMIN */
.state('home.admin', {
data: {
permissions: {
only: ['Admin'],
redirectTo: 'home.dashboard'
},
name: 'Administratorzy'
},
url: "/admins",
template: ''
})
.state('home.admin.list', {
data: {
permissions: {
only: ['Admin'],
redirectTo: 'home.dashboard'
},
name: 'Lista'
},
url: "/list",
controller: Controllers.Admin.List,
templateUrl: '_plugin/admin/frontend/views/admin/admin.list.html'
})
.state('home.admin.edit', {
data: {
permissions: {
only: ['Admin'],
redirectTo: 'home.dashboard'
},
name: 'Edycja'
},
url: "/edit-:id",
controller: Controllers.Admin.Edit,
templateUrl: '_plugin/admin/frontend/views/admin/admin.form.html'
})
.state('home.admin.add', {
data: {
permissions: {
only: ['Admin'],
redirectTo: 'home.dashboard'
},
name: 'Dodawanie'
},
url: "/add",
controller: Controllers.Admin.Add,
templateUrl: '_plugin/admin/frontend/views/admin/admin.form.html'
})
;
});