Abspielen eines Unterweisungsvideos eingebaut
This commit is contained in:
parent
0041276fb4
commit
2d07991c00
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
tmp
|
||||
test.sql
|
||||
static/test.jpg
|
||||
static/test.mp4
|
||||
|
@ -155,16 +155,12 @@ func (s *Session) HandleParticipant(db *data.DB, p *BriefingParticipant) http.Ha
|
||||
log.Panicln(err)
|
||||
}
|
||||
|
||||
data := questionHTMLData{
|
||||
participantHTMLData: participantHTMLData{
|
||||
SessionID: s.ID,
|
||||
BriefingParticipant: BriefingParticipant{Login: p.Login},
|
||||
},
|
||||
QuestionID: 1,
|
||||
Question: s.Questions[0],
|
||||
data := participantHTMLData{
|
||||
SessionID: s.ID,
|
||||
BriefingParticipant: *p,
|
||||
}
|
||||
|
||||
template.Must(template.ParseFiles("templates/question.html")).ExecuteTemplate(w, "content", data)
|
||||
template.Must(template.ParseFiles("templates/video.html")).ExecuteTemplate(w, "content", data)
|
||||
}
|
||||
}
|
||||
|
||||
@ -272,3 +268,18 @@ func (s *Session) HandleBriefingDone() http.HandlerFunc {
|
||||
template.Must(template.ParseFiles("templates/login.html")).ExecuteTemplate(w, "content", nil)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Session) HandleEndOfVideo(p *BriefingParticipant) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
data := questionHTMLData{
|
||||
participantHTMLData: participantHTMLData{
|
||||
SessionID: s.ID,
|
||||
BriefingParticipant: BriefingParticipant{Login: p.Login},
|
||||
},
|
||||
QuestionID: 1,
|
||||
Question: s.Questions[0],
|
||||
}
|
||||
|
||||
template.Must(template.ParseFiles("templates/question.html")).ExecuteTemplate(w, "content", data)
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ func handleGivenAnswer(p *BriefingParticipant, i int64, r *http.Request) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func makeHTMLQuestions(sq []data.Question, givenAnswers []int) []resultQuestion {
|
||||
func makeResultQuestions(sq []data.Question, givenAnswers []int) []resultQuestion {
|
||||
questions := make([]resultQuestion, len(sq))
|
||||
for i, q := range sq {
|
||||
questions[i].Text = q.Text
|
||||
|
@ -23,6 +23,7 @@ func (mux *Mux) handleParticipants(db *data.DB, cp <-chan *BriefingParticipant,
|
||||
p.GivenAnswers = make([]int, len(s.Questions))
|
||||
|
||||
mux.HandleFunc("/submit-participant/"+fmt.Sprint(s.ID)+"/"+fmt.Sprint(p.Login)+"/", s.HandleParticipant(db, p))
|
||||
mux.HandleFunc("/end-video/"+fmt.Sprint(s.ID)+"/"+fmt.Sprint(p.Login)+"/", s.HandleEndOfVideo(p))
|
||||
var i int
|
||||
for i = range s.Questions {
|
||||
mux.HandleFunc("/submit-answer/"+fmt.Sprint(s.ID)+"/"+fmt.Sprint(p.Login)+"/"+fmt.Sprint(i+1)+"/", s.HandleAnswer(db, p, int64(i+1)))
|
||||
|
6
templates/video.html
Normal file
6
templates/video.html
Normal file
@ -0,0 +1,6 @@
|
||||
{{define "content"}}
|
||||
<video src="/static/test.mp4">Test</video>
|
||||
<button hx-post="/end-video/{{.SessionID}}/{{.Login}}/" hx-target="#content" type="button">
|
||||
Weiter
|
||||
</button>
|
||||
{{end}}
|
Loading…
x
Reference in New Issue
Block a user