Implement and display headlines in interface

This commit is contained in:
nemunaire 2018-12-02 11:43:24 +01:00
commit 8c95782eff
13 changed files with 85 additions and 58 deletions

View file

@ -144,6 +144,10 @@ func partUpdateExercice(exercice fic.Exercice, body []byte) (interface{}, error)
exercice.Statement = ue.Statement
}
if len(ue.Headline) > 0 {
exercice.Headline = ue.Headline
}
if len(ue.Overview) > 0 {
exercice.Overview = ue.Overview
}
@ -199,7 +203,7 @@ func createExercice(theme fic.Theme, body []byte) (interface{}, error) {
}
}
return theme.AddExercice(ue.Title, ue.URLId, ue.Path, ue.Statement, ue.Overview, depend, ue.Gain, ue.VideoURI)
return theme.AddExercice(ue.Title, ue.URLId, ue.Path, ue.Statement, ue.Overview, ue.Headline, depend, ue.Gain, ue.VideoURI)
}
type uploadedHint struct {

View file

@ -146,15 +146,8 @@ func showThemedExercice(theme fic.Theme, exercice fic.Exercice, body []byte) (in
return exercice, nil
}
type uploadedTheme struct {
Name string
URLId string
Authors string
Intro string
}
func createTheme(_ httprouter.Params, body []byte) (interface{}, error) {
var ut uploadedTheme
var ut fic.Theme
if err := json.Unmarshal(body, &ut); err != nil {
return nil, err
}
@ -163,7 +156,7 @@ func createTheme(_ httprouter.Params, body []byte) (interface{}, error) {
return nil, errors.New("Theme's name not filled")
}
return fic.CreateTheme(ut.Name, ut.URLId, "", ut.Authors, ut.Intro, "")
return fic.CreateTheme(ut.Name, ut.URLId, "", ut.Authors, ut.Intro, ut.Headline, ut.Image)
}
func updateTheme(theme fic.Theme, body []byte) (interface{}, error) {