You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sidebar.controller.js 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /**
  2. * Created by robin on 11/1/15.
  3. */
  4. angular.module('app')
  5. .controller('SideBarController', ['$scope', '$state', 'DataShareBusiness',
  6. function($scope, $state, DataShareBusiness) {
  7. $scope.DataShareBusiness = DataShareBusiness;
  8. $scope.Search = {
  9. value: "",
  10. selected: null
  11. };
  12. $scope.getCurrentGroups = function()
  13. {
  14. if (DataShareBusiness.CurrentGroups.length != 0) {
  15. var e = DataShareBusiness.CurrentGroups[DataShareBusiness.CurrentGroups.length - 1];
  16. if (e.Groups == null || e.Groups.length == 0) {
  17. return e.Parent.Groups;
  18. }
  19. return e.Groups;
  20. }
  21. return DataShareBusiness.Groups;
  22. };
  23. $scope.search = function()
  24. {
  25. var groups = [];
  26. function searchRec(group)
  27. {
  28. if (group.Name.toLowerCase().indexOf($scope.Search.value.toLowerCase()) > -1) {
  29. groups.push(group);
  30. }
  31. if (group.Groups != null) {
  32. group.Groups.forEach(searchRec);
  33. }
  34. }
  35. DataShareBusiness.Groups.forEach(searchRec);
  36. return groups;
  37. };
  38. $scope.goTo = function(group)
  39. {
  40. if (group != null) {
  41. DataShareBusiness.setCurrentGroup(group);
  42. }
  43. };
  44. $scope.findFreeRoom = function()
  45. {
  46. };
  47. }]);