Skip to content

Commit

Permalink
Merge branch 'main' into BC-7336-sidebar-expansion
Browse files Browse the repository at this point in the history
  • Loading branch information
muratmerdoglu-dp authored Sep 4, 2024
2 parents b0f37da + bce8c15 commit 3946b4f
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 6 deletions.
5 changes: 5 additions & 0 deletions config/default.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,11 @@
"default": false,
"description": "Enables the new class list view"
},
"FEATURE_SHOW_NEW_ROOMS_VIEW_ENABLED": {
"type": "boolean",
"default": false,
"description": "Enables the new rooms view"
},
"FEATURE_GROUPS_IN_COURSE_ENABLED": {
"type": "boolean",
"default": false,
Expand Down
4 changes: 3 additions & 1 deletion controllers/administration.js
Original file line number Diff line number Diff line change
Expand Up @@ -2398,6 +2398,7 @@ router.all('/courses', (req, res, next) => {
roles: ['student'],
$limit: 1000,
});
const newRoomViewEnabled = Configuration.get('FEATURE_SHOW_NEW_ROOMS_VIEW_ENABLED');

Promise.all([
coursesPromise,
Expand All @@ -2420,7 +2421,8 @@ router.all('/courses', (req, res, next) => {
(item.teacherIds || []).map((item) => `${item.lastName}${item.outdatedSince ? ' ~~' : ''}`).join(', '),
[
{
link: `/courses/${item._id}/edit?redirectUrl=/administration/courses`,
link: newRoomViewEnabled ? `/courses/${item._id}/edit?redirectUrl=/administration/rooms/new`
: `/courses/${item._id}/edit?redirectUrl=/administration/courses`,
icon: 'edit',
title: res.$t('administration.controller.link.editEntry'),
},
Expand Down
10 changes: 10 additions & 0 deletions helpers/handlebars/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ module.exports = (req, res, next) => {

// admin views
const newSchoolAdminPageAsDefault = Configuration.get('FEATURE_NEW_SCHOOL_ADMINISTRATION_PAGE_AS_DEFAULT_ENABLED');
const newRoomsViewEnabled = Configuration.get('FEATURE_SHOW_NEW_ROOMS_VIEW_ENABLED');

const adminChildItems = [
{
name: res.$t('global.link.administrationStudents'),
Expand Down Expand Up @@ -326,6 +328,14 @@ module.exports = (req, res, next) => {
},
];

if (newRoomsViewEnabled) {
adminChildItems.splice(2, 1, {
name: res.$t('global.sidebar.link.administrationCourses'),
testId: 'Kurse',
icon: 'school-outline',
link: '/administration/rooms/new',
});
}
if (newClassViewEnabled) {
adminChildItems.splice(3, 1, {
name: res.$t('global.sidebar.link.administrationClasses'),
Expand Down
22 changes: 17 additions & 5 deletions views/administration/dashboard.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,18 @@
</div>
</div>
{{/userHasPermission}}
{{#userHasPermission 'ADMIN_VIEW'}}
{{#userHasPermission 'COURSE_ADMINISTRATION'}}
{{#if (getConfig "FEATURE_SHOW_NEW_ROOMS_VIEW_ENABLED")}}
<div class="col-md-6 col-sm-6 col-xs-12">
<div class="card h-100 teacher-option locationlink" data-loclink="/administration/rooms/new">
<div class="card-block homework">
<div class="card-text">
<h2 class="h4"><i class="fa fa-graduation-cap"></i> {{$t "administration.dashboard.headline.manageCourses" }}</h2>
</div>
</div>
</div>
</div>
{{else}}
<div class="col-md-6 col-sm-6 col-xs-12">
<div class="card h-100 teacher-option locationlink" data-loclink="/administration/courses">
<div class="card-block homework">
Expand All @@ -45,10 +56,11 @@
</div>
</div>
</div>
</div>
{{/userHasPermission}}
{{#userHasPermission 'CLASS_LIST'}}
<div class="col-md-6 col-sm-6 col-xs-12">
</div>
{{/if}}
{{/userHasPermission}}
{{#userHasPermission 'CLASS_LIST'}}
<div class="col-md-6 col-sm-6 col-xs-12">
{{#if (getConfig "FEATURE_SHOW_NEW_CLASS_VIEW_ENABLED")}}
<div class="card h-100 teacher-option locationlink" data-loclink="/administration/groups/classes" data-testid="administrate_classes">
<div class="card-block homework">
Expand Down

0 comments on commit 3946b4f

Please sign in to comment.