1234567891011121314151617181920212223242526272829303132333435363738 |
- /**
- * Created by robin on 11/1/15.
- */
-
- angular.module('app')
- .controller('SideBarController', ['$scope', '$state', 'DataShareBusiness', 'GroupsBusiness', '$location',
- function($scope, $state, DataShareBusiness, GroupsBusiness, $location) {
-
- $scope.DataShareBusiness = DataShareBusiness;
-
- $scope.getCurrentGroups = function()
- {
- if (DataShareBusiness.CurrentGroups.length != 0) {
- var e = DataShareBusiness.CurrentGroups[DataShareBusiness.CurrentGroups.length - 1];
- if (e.Groups == null || e.Groups.length == 0) {
- return e.Parent.Groups;
- }
- return e.Groups;
- }
- return DataShareBusiness.Groups;
- };
-
- $scope.$watch(function(){ return Object.keys($location.search())[0] }, function(){
- if (DataShareBusiness.Groups != null) {
- DataShareBusiness.setFromSearchString(Object.keys($location.search())[0]);
- }
- });
-
- var promiseLoadGroups = {
- id: "promiseLoadGroups",
- loaderGroups: ["sidebar", "toolbar"]
- };
- GroupsBusiness.loadAll(promiseLoadGroups).then(function(data)
- {
- $scope.groups = data;
- DataShareBusiness.setFromSearchString(Object.keys($location.search())[0]);
- });
- }]);
|