Skip to content

Commit

Permalink
allow moving lectures as well
Browse files Browse the repository at this point in the history
  • Loading branch information
joschahenningsen committed Jul 12, 2023
1 parent f71e783 commit a72fd4e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions api/courses.go
Original file line number Diff line number Diff line change
Expand Up @@ -1520,6 +1520,7 @@ type copyCourseRequest struct {
func (r coursesRoutes) copyStream(c *gin.Context) {
type req struct {
TargetCourse uint `json:"targetCourse"`
Move bool `json:"move"`
}
var request req
err := c.BindJSON(&request)
Expand Down Expand Up @@ -1564,6 +1565,9 @@ func (r coursesRoutes) copyStream(c *gin.Context) {
Err: err,
})
}
if request.Move {
r.StreamsDao.DeleteStream(strconv.Itoa(int(tlctx.Stream.ID)))
}
}

func (r coursesRoutes) copyCourse(c *gin.Context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@
<template x-if="lecture.isCopying">
<form class="p-4" x-data="{move: false, selected: -1, success: undefined}"
@submit.prevent="fetch(`/api/course/${lecture.courseId}/stream/${lecture.lectureId}/copy`,
{method: 'POST', body: JSON.stringify({targetCourse: selected})}).then(r=>{success=r.ok})">
{method: 'POST', body: JSON.stringify({targetCourse: selected, move: move})}).then(r=>{success=r.ok})">
<div x-show="success===undefined">
<div class="w-full grid grid-cols-2">
<button @click="move=false" class="w-full py-2 mt-2 rounded" :class="!move && 'bg-indigo-500/70'" type="button">
Expand Down

0 comments on commit a72fd4e

Please sign in to comment.