Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

Commit

Permalink
Create controller and service to dynamically show and hide content fo…
Browse files Browse the repository at this point in the history
…r specific audience group
  • Loading branch information
nogalpaulina committed Apr 8, 2021
1 parent 8ee9708 commit e41a75c
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 4 deletions.
41 changes: 41 additions & 0 deletions web/src/main/webapp/my-app/learningAnalytics/controllers.js
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;
});
}]);
});
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@
app-title="Learning Analytics for Instructors"
page-title="Learning Analytics for Instructors"
white-background="true">
<div ng-controller="LearningAnalyticsController as learningAnalyticsCtrl" class="portlet-details-page">
<md-content class="learningAnalytics__content md-uwMadison-theme">
<div data-role='content'>
<h2>Learning Analytics Tools</h2>
<h2>Tools</h2>
<ul data-role='listview'>
<li>Learner Engagement Analytics Dashboard (LEAD)
<ul style="padding-left:1.2em" data-role='listview'>
<li ng-if="content.groups.name ==='All DoIT Employees'">I'm a DoIT emplyee</li>
<!-- Leaving for test purpose only -->
<li ng-if="forInstructorsOnly">this is for instructors only</li>
<li ng-if="!forInstructorsOnly">this is for everybody</li>
<li><a href="" target="_blank" rel="noopener noreferer">Current semester (S21)</a></li>
<li><a href="" target="_blank" rel="noopener noreferer">Fall 2020</a></li>
</ul>
Expand All @@ -39,7 +42,7 @@ <h2>Learning Analytics Tools</h2>
<li><a href="" target="_blank" rel="noopener noreferer">Kaltura Analytics</a></li>
</ul>

<h2>Learning Analytics Resources</h2>
<h2>Resources</h2>
<ul data-role='listview'>
<li><a href="" target="_blank" rel="noopener noreferer">Learning Analytics at UW-Madison</a></li>
<li><a href="" target="_blank" rel="noopener noreferer">Learning Analytics Guiding Principles</a></li>
Expand All @@ -48,12 +51,14 @@ <h2>Learning Analytics Resources</h2>
<li><a href="" target="_blank" rel="noopener noreferer">Learning Analytics KnowledgeBase</a></li>
</ul>

<h2>Learning Analytics Events</h2>
<h2>Events</h2>
<ul data-role='listview'>
<li><a href="" target="_blank" rel="noopener noreferer">Learning Analytics Community of Practice</a></li>
<li><a href="" target="_blank" rel="noopener noreferer">Learning Analytics Speaker Series</a></li>
<li><a href="" target="_blank" rel="noopener noreferer">Learning Analytics Events</a></li>
</ul>
</div>
</md-content>
</div>
</frame-page>
<!-- </div> -->
42 changes: 42 additions & 0 deletions web/src/main/webapp/my-app/learningAnalytics/services.js
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,
}
}
])
});
4 changes: 4 additions & 0 deletions web/src/main/webapp/my-app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ define([
'./search/controllers',
'./search/directives',
'./search/services',
'./learningAnalytics/controllers',
'./learningAnalytics/services',
], function(angular, require, marketplaceRoutes, learningAnalyticsRoute, listRoute, messagesRoutes,
portalSettingsRoutes, aboutRoute, helpRoutes, layoutRoute, staticRoutes,
widgetRoutes, searchRoutes) {
Expand All @@ -64,6 +66,8 @@ define([
'my-app.marketplace.controllers',
'my-app.marketplace.directives',
'my-app.marketplace.services',
'my-app.learningAnalytics.controllers',
'my-app.learningAnalytics.services',
'my-app.menu.controllers',
'my-app.rating.components',
'my-app.rating.controllers',
Expand Down

0 comments on commit e41a75c

Please sign in to comment.