-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* New editor cursus * archive and restore actions * Creation types for trainings * hidden archived session and event * PR review * pr review 2
- Loading branch information
Showing
49 changed files
with
1,316 additions
and
138 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
30 changes: 30 additions & 0 deletions
30
src/plugin/cursus/Installation/Migrations/Version20240821130015.php
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,30 @@ | ||
<?php | ||
|
||
namespace Claroline\CursusBundle\Installation\Migrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
/** | ||
* Auto-generated migration based on mapping information: modify it with caution. | ||
* | ||
* Generation date: 2024/08/21 01:00:17 | ||
*/ | ||
final class Version20240821130015 extends AbstractMigration | ||
{ | ||
public function up(Schema $schema): void | ||
{ | ||
$this->addSql(' | ||
ALTER TABLE claro_cursusbundle_course | ||
ADD archived TINYINT(1) NOT NULL | ||
'); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
$this->addSql(' | ||
ALTER TABLE claro_cursusbundle_course | ||
DROP archived | ||
'); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
src/plugin/cursus/Resources/modules/actions/course/archive.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,53 @@ | ||
import {createElement} from 'react' | ||
import get from 'lodash/get' | ||
|
||
import {url} from '#/main/app/api' | ||
import {ASYNC_BUTTON} from '#/main/app/buttons' | ||
import {hasPermission} from '#/main/app/security' | ||
import {trans, transChoice} from '#/main/app/intl/translation' | ||
|
||
import {CourseCard} from '#/plugin/cursus/course/components/card' | ||
|
||
/** | ||
* Archive action. | ||
*/ | ||
export default (courses, refresher) => { | ||
const processable = courses.filter(course => hasPermission('administrate', course) && !get(course, 'meta.archived')) | ||
|
||
return { | ||
name: 'archive', | ||
type: ASYNC_BUTTON, | ||
icon: 'fa fa-fw fa-box', | ||
label: trans('archive', {}, 'actions'), | ||
displayed: 0 !== processable.length, | ||
dangerous: true, | ||
confirm: { | ||
title: transChoice('archive_training_confirm_title', processable.length, {}, 'actions'), | ||
message: transChoice('archive_training_confirm_message', processable.length, {count: processable.length}, 'actions'), | ||
additional: [ | ||
createElement('div', { | ||
key: 'additional', | ||
className: 'modal-body' | ||
}, processable.map(course => createElement(CourseCard, { | ||
key: course.id, | ||
orientation: 'row', | ||
className: 'mb-2', | ||
size: 'xs', | ||
data: course | ||
}))) | ||
] | ||
}, | ||
request: { | ||
url: url(['apiv2_cursus_course_archive']), | ||
request: { | ||
method: 'POST', | ||
body: JSON.stringify({ | ||
ids: processable.map(course => course.id) | ||
}) | ||
}, | ||
success: (response) => refresher.update(response) | ||
}, | ||
group: trans('management'), | ||
scope: ['object', 'collection'] | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/plugin/cursus/Resources/modules/actions/course/restore.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,34 @@ | ||
import get from 'lodash/get' | ||
|
||
import {url} from '#/main/app/api' | ||
import {ASYNC_BUTTON} from '#/main/app/buttons' | ||
import {trans} from '#/main/app/intl/translation' | ||
import {hasPermission} from '#/main/app/security' | ||
|
||
/** | ||
* Restore action. | ||
*/ | ||
export default (courses, refresher) => { | ||
const processable = courses.filter(course => hasPermission('administrate', course) && get(course, 'meta.archived')) | ||
|
||
return { | ||
name: 'restore', | ||
type: ASYNC_BUTTON, | ||
icon: 'fa fa-fw fa-box-open', | ||
label: trans('restore', {}, 'actions'), | ||
displayed: 0 !== processable.length, | ||
request: { | ||
url: url(['apiv2_cursus_course_restore']), | ||
request: { | ||
method: 'POST', | ||
body: JSON.stringify({ | ||
ids: processable.map(course => course.id) | ||
}) | ||
}, | ||
success: (response) => refresher.update(response) | ||
}, | ||
group: trans('management'), | ||
scope: ['object', 'collection'], | ||
dangerous: true | ||
} | ||
} |
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
50 changes: 0 additions & 50 deletions
50
src/plugin/cursus/Resources/modules/course/components/edit.jsx
This file was deleted.
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
Oops, something went wrong.