-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #274 from linuxmuster/add-schoolmanager-to-navbar
Schoolswitcher for Multi-School-Setups
- Loading branch information
Showing
10 changed files
with
218 additions
and
9 deletions.
There are no files selected for viewing
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
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
40 changes: 40 additions & 0 deletions
40
usr/lib/linuxmuster-webui/plugins/lmn_common/resources/build/all.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
37 changes: 37 additions & 0 deletions
37
...inuxmuster-webui/plugins/lmn_common/resources/js/controllers/schoolswitcher.controller.es
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,37 @@ | ||
angular.module('lmn.common').config(($routeProvider) => { | ||
$routeProvider.when('/view/lmn/change-school', { | ||
templateUrl: '/lmn_common:resources/partial/schoolswitcher.html', | ||
controller: 'LMNSchoolSwitcherController', | ||
}); | ||
}) | ||
|
||
angular.module('lmn.common').controller('LMNSchoolSwitcherController', function ($scope, $http, pageTitle, gettext, notify, $uibModal, $window) { | ||
pageTitle.set(gettext('Schoolswitcher')); | ||
|
||
$scope.load = () => { | ||
$http.get('/api/lmn/activeschool').then((resp) => { | ||
$scope.identity.profile.activeSchool = resp.data; | ||
$http.post('/api/lmn/get-schoolname', {school: $scope.identity.profile.activeSchool}).then((resp) => { | ||
$scope.identity.profile.schoolname = resp.data; | ||
}); | ||
}); | ||
|
||
$http.get('/api/lmn/list-schools').then((resp) => { | ||
$scope.schools = resp.data; | ||
}); | ||
} | ||
|
||
$scope.switchSchool = (school) => { | ||
$http.post('/api/lmn/change-school', { school: school }).then((resp) => { | ||
if(resp.data) { | ||
notify.success("School changed successfully"); | ||
} | ||
else { | ||
notify.error("Failed to change school!"); | ||
} | ||
$scope.load(); | ||
}); | ||
} | ||
|
||
$scope.load(); | ||
}) |
26 changes: 26 additions & 0 deletions
26
usr/lib/linuxmuster-webui/plugins/lmn_common/resources/partial/schoolswitcher.html
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,26 @@ | ||
<progress-spinner ng:show="identity.user == null"></progress-spinner> | ||
|
||
<div ng:show="!identity.profile.school_show" class="alert alert-info" style="margin-top:15px;"> | ||
<i class="fa fa-info-circle"></i> <span translate>This is not a multi-school setup or you are not allowed to see another school!</span> | ||
</div> | ||
|
||
<div ng:show="identity.user && identity.profile.school_show" style="margin-top:10px;" class="flex-container info-cards"> | ||
<div class="panel panel-info" style="width:100%"> | ||
<div class="panel-heading" style="padding:10px;height:50px;"> | ||
<span style="font-size:18px;line-height:28px;" translate>Schoolswitcher</span> | ||
</div> | ||
<div class="panel-body"> | ||
<ul class="list-group"> | ||
<li class="list-group-item" style="background-color: lightgreen;"><span style="font-weight: bold;" translate>Current</span>: {{identity.profile.activeSchool}} - {{identity.profile.schoolname}}</li> | ||
</ul> | ||
<hr> | ||
<ul class="list-group"> | ||
<input ng:model="query" type="search" autofocus class="form-control" placeholder="Filter" typeahead-min-length="1" /> | ||
<li ng:click="switchSchool(school.school)" class="list-group-item school-item" ng:repeat="school in schools | filter:query" style="margin-top: 20px;"> | ||
{{school.school}} - {{school.schoolname}} | ||
<span class="pull-right"><i class="fa-solid fa-right-left"></i></span> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> |
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