fic: Can overwrite authors for each exercice
This commit is contained in:
parent
1a8ebcb8bf
commit
28ad0fa791
5 changed files with 23 additions and 11 deletions
|
|
@ -613,7 +613,7 @@ func createExercice(c *gin.Context) {
|
|||
}
|
||||
}
|
||||
|
||||
exercice, err := theme.AddExercice(ue.Title, ue.Image, ue.WIP, ue.URLId, ue.Path, ue.Statement, ue.Overview, ue.Headline, depend, ue.Gain, ue.VideoURI, ue.Resolution, ue.SeeAlso, ue.Finished)
|
||||
exercice, err := theme.AddExercice(ue.Title, ue.Authors, ue.Image, ue.WIP, ue.URLId, ue.Path, ue.Statement, ue.Overview, ue.Headline, depend, ue.Gain, ue.VideoURI, ue.Resolution, ue.SeeAlso, ue.Finished)
|
||||
if err != nil {
|
||||
log.Println("Unable to createExercice:", err.Error())
|
||||
c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"errmsg": "An error occurs during exercice creation."})
|
||||
|
|
|
|||
|
|
@ -1717,7 +1717,7 @@ angular.module("FICApp")
|
|||
}
|
||||
});
|
||||
$scope.exercices = Exercice.query();
|
||||
$scope.fields = ["title", "urlid", "disabled", "statement", "headline", "overview", "finished", "depend", "gain", "coefficient", "videoURI", "image", "resolution", "issue", "issuekind", "wip"];
|
||||
$scope.fields = ["title", "urlid", "authors", "disabled", "statement", "headline", "overview", "finished", "depend", "gain", "coefficient", "videoURI", "image", "resolution", "issue", "issuekind", "wip"];
|
||||
|
||||
$scope.inSync = false;
|
||||
$scope.syncExo = function() {
|
||||
|
|
|
|||
|
|
@ -139,6 +139,15 @@ func BuildExercice(i Importer, theme *fic.Theme, epath string, dmap *map[int64]*
|
|||
e.URLId = fic.ToURLid(e.Title)
|
||||
e.Title = fixnbsp(e.Title)
|
||||
|
||||
if i.Exists(path.Join(epath, "AUTHORS.txt")) {
|
||||
if authors, err := getAuthors(i, epath); err != nil {
|
||||
errs = append(errs, NewExerciceError(e, fmt.Errorf("unable to get AUTHORS.txt: %w", err)))
|
||||
} else {
|
||||
// Format authors
|
||||
e.Authors = strings.Join(authors, ", ")
|
||||
}
|
||||
}
|
||||
|
||||
// Texts to format using Markdown
|
||||
if i.Exists(path.Join(epath, "overview.txt")) {
|
||||
e.Overview, err = GetFileContent(i, path.Join(epath, "overview.txt"))
|
||||
|
|
|
|||
Reference in a new issue