This repository has been archived by the owner on May 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create controller and service to dynamically show and hide content fo…
…r specific audience group
- Loading branch information
1 parent
8ee9708
commit e41a75c
Showing
4 changed files
with
96 additions
and
4 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
web/src/main/webapp/my-app/learningAnalytics/controllers.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Licensed to Apereo under one or more contributor license | ||
* agreements. See the NOTICE file distributed with this work | ||
* for additional information regarding copyright ownership. | ||
* Apereo licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file | ||
* except in compliance with the License. You may obtain a | ||
* copy of the License at the following location: | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
'use strict'; | ||
|
||
define(['angular'], function(angular) { | ||
return angular.module('my-app.learningAnalytics.controllers', []) | ||
|
||
.controller('LearningAnalyticsController', | ||
['$scope', 'learningAnalyticsService', | ||
function($scope, learningAnalyticsService) { | ||
|
||
// Promise to resolve group memberships | ||
learningAnalyticsService.getGroups().then(function(data) { | ||
$scope.groups = data.groups; | ||
|
||
for (var i = 0; i > $scope.groups.length; i++) { | ||
if ($scope.groups[i].name === 'Users - Service Activation Required') { // This Group name will be updated | ||
$scope.forInstructorsOnly = true; | ||
return; | ||
} | ||
} | ||
$scope.forInstructorsOnly = false; | ||
}); | ||
}]); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Licensed to Apereo under one or more contributor license | ||
* agreements. See the NOTICE file distributed with this work | ||
* for additional information regarding copyright ownership. | ||
* Apereo licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file | ||
* except in compliance with the License. You may obtain a | ||
* copy of the License at the following location: | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
'use strict'; | ||
|
||
define(['angular', 'jquery'], function(angular, $) { | ||
|
||
return angular.module('my-app.learningAnalytics.services', []) | ||
|
||
.factory('learningAnalyticsService', | ||
['portalGroupService', | ||
function(portalGroupService) { | ||
|
||
var getGroups = function(groups) { | ||
return portalGroupService.getGroups() | ||
.then(function(groups) { | ||
return { | ||
groups: groups, | ||
} | ||
}); | ||
} | ||
return { | ||
getGroups: getGroups, | ||
} | ||
} | ||
]) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters