"use strict";

angular.module('wuw.controllers')

.controller('SetupCtrl', function($scope, Groups) {
    console.log("setup says hello");
    Groups.loadAllGroupsWithLectures().then(function(groups) {
        $scope.groups = groups;
    }, function() {

    });

    $scope.toggleGroup = function(group) {
        console.log(group);
        if ($scope.isGroupShown(group)) {
            $scope.shownGroup = null;
        } else {
            $scope.shownGroup = group;
        }
    };

    $scope.isGroupShown = function(group) {
        return $scope.shownGroup === group;
    };

});

@@ -344,74 +344,54 @@
 if (
-$scope.isGroupShown(group)) %7B%0A            $scope.shownGroup = null
+group.shown) %7B%0A            group.shown = false
 ;%0A  
@@ -421,33 +421,26 @@
     
-$scope.shownGroup = group
+group.shown = true
 ;%0A  

allow multiple item to be expanded