Skip to content

Commit

Permalink
N21-2075 redirect + Feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
mrikallab committed Aug 15, 2024
1 parent c35d7b7 commit a6824fb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
6 changes: 4 additions & 2 deletions controllers/administration.js
Original file line number Diff line number Diff line change
Expand Up @@ -2393,6 +2393,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 @@ -2415,12 +2416,13 @@ router.all('/courses', (req, res, next) => {
(item.teacherIds || []).map((item) => `${item.lastName}${item.outdatedSince ? ' ~~' : ''}`).join(', '),
[
{
link: Configuration.get('FEATURE_SHOW_NEW_ROOMS_VIEW_ENABLED') ? `/courses/${item._id}/edit?redirectUrl=/administration/rooms/new` : `/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'),
},
{
link: Configuration.get('FEATURE_SHOW_NEW_ROOMS_VIEW_ENABLED') ? `/courses/${item._id}/edit?redirectUrl=/administration/rooms/new` : `/administration/courses/${item._id}`,
link: `/administration/courses/${item._id}`,
class: 'btn-delete',
icon: 'trash-o',
method: 'delete',
Expand Down
10 changes: 9 additions & 1 deletion helpers/handlebars/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ module.exports = (req, res, next) => {
name: res.$t('global.sidebar.link.administrationCourses'),
testId: 'Kurse',
icon: 'school-outline',
link: newRoomsViewEnabled ? '/administration/rooms/new':'/administration/courses/',
link: '/administration/courses/',
},
{
name: res.$t('global.sidebar.link.administrationClasses'),
Expand Down Expand Up @@ -317,6 +317,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
4 changes: 2 additions & 2 deletions views/administration/dashboard.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</div>
</div>
{{/userHasPermission}}
{{#userHasPermission 'ADMIN_VIEW'}}
{{#userHasPermission 'COURSE_LIST'}}
{{#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">
Expand All @@ -58,7 +58,7 @@
</div>
</div>
{{/if}}
{{/userHasPermission}}
{{/userHasPermission}}
{{#userHasPermission 'CLASS_LIST'}}
<div class="col-md-6 col-sm-6 col-xs-12">
{{#if (getConfig "FEATURE_SHOW_NEW_CLASS_VIEW_ENABLED")}}
Expand Down

0 comments on commit a6824fb

Please sign in to comment.