Add option to subscribe to mailinglist
This commit is contained in:
parent
47c546b880
commit
d4650db056
10 changed files with 40 additions and 20 deletions
|
@ -25,16 +25,17 @@ type maskData struct {
|
|||
Hour int
|
||||
Minute int
|
||||
}
|
||||
SelectedCourse int
|
||||
SelectedRoom int
|
||||
Date models.Date
|
||||
Duration int
|
||||
Roomname string
|
||||
Name string
|
||||
Email string
|
||||
Info string
|
||||
Errors []string
|
||||
Config config.Config
|
||||
SelectedCourse int
|
||||
SelectedRoom int
|
||||
Date models.Date
|
||||
Duration int
|
||||
Roomname string
|
||||
Name string
|
||||
Email string
|
||||
SubscribeToMailinglist bool
|
||||
Info string
|
||||
Errors []string
|
||||
Config config.Config
|
||||
}
|
||||
|
||||
// Offer a form to add office hours and validate its input on receiving.
|
||||
|
@ -129,6 +130,9 @@ func (b *BaseHandler) AddOfficeHourHandler(w http.ResponseWriter, req *http.Requ
|
|||
} else if !(b.config.Tutor.MailSuffix == "" || strings.HasSuffix(email.Address, "@"+b.config.Tutor.MailSuffix) || strings.HasSuffix(email.Address, "."+b.config.Tutor.MailSuffix)) {
|
||||
errors = append(errors, fmt.Sprintf("Mailaddresse muss auf „%s“ enden.", b.config.Tutor.MailSuffix))
|
||||
}
|
||||
|
||||
subscribeToMailinglist := req.FormValue("subscribeToMailinglist") == "subscribe"
|
||||
|
||||
info := req.FormValue("info")
|
||||
|
||||
allowed, err := b.officeHourRepo.AllowedAt(date, duration, room, true)
|
||||
|
@ -155,6 +159,7 @@ func (b *BaseHandler) AddOfficeHourHandler(w http.ResponseWriter, req *http.Requ
|
|||
roomname,
|
||||
name,
|
||||
email.Address,
|
||||
subscribeToMailinglist,
|
||||
info,
|
||||
errors,
|
||||
b.config,
|
||||
|
@ -164,7 +169,7 @@ func (b *BaseHandler) AddOfficeHourHandler(w http.ResponseWriter, req *http.Requ
|
|||
// if the data for a new office hour was sent correctly, save it.
|
||||
|
||||
officeHour := models.OfficeHour{Id: 0,
|
||||
Tutor: models.Tutor{Id: 0, Name: name, Email: email.Address},
|
||||
Tutor: models.Tutor{Id: 0, Name: name, Email: email.Address, SubscribeToMailinglist: subscribeToMailinglist},
|
||||
Date: date,
|
||||
Room: room,
|
||||
RoomName: roomname,
|
||||
|
|
|
@ -37,7 +37,7 @@ func (b *BaseHandler) GetTimetable(officeHours []models.OfficeHour) (map[models.
|
|||
}
|
||||
}
|
||||
slots := []int{1, 1, 1, 1, 1}
|
||||
for date, _ := range timetable {
|
||||
for date := range timetable {
|
||||
if slots[date.Day] < len(timetable[date]) {
|
||||
slots[date.Day] = len(timetable[date])
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue