Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Package registry
Container registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
videoag
frontend
Commits
821eeca2
Commit
821eeca2
authored
3 months ago
by
Simon Künzel
Browse files
Options
Downloads
Patches
Plain Diff
Fix show_chapters_on_course and search results course handle
parent
c7999ce4
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/api/api_v1_types.ts
+8
-30
8 additions, 30 deletions
src/api/api_v1_types.ts
src/components/CourseListing.tsx
+7
-4
7 additions, 4 deletions
src/components/CourseListing.tsx
src/pages/search.tsx
+5
-0
5 additions, 0 deletions
src/pages/search.tsx
with
20 additions
and
34 deletions
src/api/api_v1_types.ts
+
8
−
30
View file @
821eeca2
...
...
@@ -18,12 +18,13 @@ export type status_value = "available" | "readonly" | "unavailable";
export
type
changelog_entry_type
=
"
modification
"
|
"
deletion_change
"
|
"
creation
"
|
"
unknown
"
;
export
type
object_type
=
|
"
announcement
"
|
"
featured
"
|
"
chapter
"
|
"
course
"
|
"
featured
"
|
"
lecture
"
|
"
permission
"
|
"
chapter
"
|
"
publish_medium
"
;
|
"
media_process_template
"
|
"
publish_medium
"
|
"
sorter_file
"
;
// Complex Types
export
interface
announcement
{
...
...
@@ -36,13 +37,6 @@ export interface announcement {
expiration_time
?:
datetime
;
}
export
interface
homepage
{
featured
:
featured
[];
upcoming_lectures
:
lecture
[];
latest_lectures
:
lecture
[];
course_context
:
{
[
key
:
int
]:
course
};
}
export
interface
featured
{
display_priority
?:
int
;
id
?:
int
;
...
...
@@ -73,7 +67,6 @@ export interface course {
organizer
:
string
;
semester
?:
semester_string
;
short_name
:
string
;
// TODO not used?
show_chapters_on_course
:
boolean
;
topic
:
string
;
visible
?:
boolean
;
...
...
@@ -360,16 +353,8 @@ export interface PutFeedbackNewRequest {
/// GET /object_management/{object_type}/{object_id}/configuration
// Request Interface
// TODO: fix?
export
interface
GetConfigurationRequest
{
object_type
:
|
"
announcement
"
|
"
featured
"
|
"
course
"
|
"
lecture
"
|
"
permission
"
|
"
chapter
"
|
"
publish_medium
"
;
object_type
:
object_type
;
object_id
:
int
;
}
// Response Interface
...
...
@@ -381,14 +366,7 @@ export interface GetConfigurationResponse {
/// GET /object_management/{object_type}/new/configuration
// Request Interface
export
interface
GetNewConfigurationRequest
{
object_type
:
|
"
announcement
"
|
"
featured
"
|
"
course
"
|
"
lecture
"
|
"
permission
"
|
"
chapter
"
|
"
publish_medium
"
;
object_type
:
object_type
;
}
// Response Interface
export
interface
GetNewConfigurationResponse
{
...
...
@@ -471,7 +449,7 @@ export interface SearchRequest {
export
interface
SearchResponse
{
courses
:
int
[];
lectures
:
lecture
[];
course_context
:
{
[
key
:
in
t
]:
course
};
course_context
:
{
[
key
:
str
in
g
]:
course
};
}
/// POST /object_management/{object_type}/{object_id}/resurrect
...
...
This diff is collapsed.
Click to expand it.
src/components/CourseListing.tsx
+
7
−
4
View file @
821eeca2
...
...
@@ -154,10 +154,12 @@ function ListingHeader({ course }: { course: GetCourseResponse }) {
export
function
LectureListItem
({
lecture
,
course_handle
,
show_chapters
,
...
props
}:
{
lecture
:
lecture
;
course_handle
?:
string
;
course_handle
:
string
;
show_chapters
:
boolean
;
[
key
:
string
]:
any
;
})
{
const
{
editMode
}
=
useEditMode
();
...
...
@@ -184,7 +186,7 @@ export function LectureListItem({
}
}
className
=
"col-sm-2 col-12 thumbnailimg"
>
<
Link
href
=
{
`/
${
course_handle
??
lecture
.
course_id
}
/
${
lecture
.
id
}
`
}
>
<
Link
href
=
{
`/
${
course_handle
}
/
${
lecture
.
id
}
`
}
>
<
span
aria-hidden
=
"true"
className
=
{
"
playpreviewbtn bi bi-play-circle
"
}
...
...
@@ -262,7 +264,7 @@ export function LectureListItem({
allowMarkdown
=
{
true
}
/>
</
li
>
{
lecture
.
chapters
?.
map
((
chapter
)
=>
(
{
show_chapters
&&
lecture
.
chapters
?.
map
((
chapter
)
=>
(
<
li
key
=
{
chapter
.
name
}
className
=
{
...
...
@@ -273,7 +275,7 @@ export function LectureListItem({
<
span
className
=
"bi bi-play"
/>
<
Link
href
=
{
`/
${
course_handle
??
lecture
.
course_id
}
/
${
lecture
.
id
}
?t=`
+
`/
${
course_handle
}
/
${
lecture
.
id
}
?t=`
+
chapter
.
start_time
}
>
...
...
@@ -388,6 +390,7 @@ function ListingBody({ course }: { course: GetCourseResponse }) {
key
=
{
lecture
.
id
}
lecture
=
{
lecture
}
course_handle
=
{
course
.
handle
}
show_chapters
=
{
course
.
show_chapters_on_course
}
/>
))
}
</
ul
>
...
...
This diff is collapsed.
Click to expand it.
src/pages/search.tsx
+
5
−
0
View file @
821eeca2
...
...
@@ -27,9 +27,11 @@ function CourseResults({ courses }: { courses: course[] }) {
function
LectureResults
({
lectures
,
course_context
,
tabIndexBegin
,
}:
{
lectures
:
lecture
[];
course_context
:
{
[
key
:
string
]:
course
};
tabIndexBegin
:
number
;
})
{
return
(
...
...
@@ -40,6 +42,8 @@ function LectureResults({
<
LectureListItem
key
=
{
lecture
.
id
}
lecture
=
{
lecture
}
course_handle
=
{
course_context
[
lecture
.
course_id
.
toString
()].
handle
}
show_chapters
=
{
course_context
[
lecture
.
course_id
.
toString
()].
show_chapters_on_course
}
tabIndex
=
{
tabIndexBegin
+
ind
}
/>
))
}
...
...
@@ -97,6 +101,7 @@ export function SearchResults({ query }: { query: string }) {
{
searchResults
.
lectures
.
length
>
0
&&
(
<
LectureResults
lectures
=
{
searchResults
.
lectures
}
course_context
=
{
searchResults
.
course_context
}
tabIndexBegin
=
{
searchResults
.
courses
.
length
+
1
}
/>
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment