Add button to go to the student's repository
This commit is contained in:
parent
3397b9f123
commit
cd500afbd5
@ -130,13 +130,21 @@
|
|||||||
<a
|
<a
|
||||||
href="/api/users/{grade.id_user}/works/{w.id}/grades/{grade.id}/traces"
|
href="/api/users/{grade.id_user}/works/{w.id}/grades/{grade.id}/traces"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
class="btn btn-sm btn-outline-info mx-1"
|
class="btn btn-sm btn-outline-info mr-1"
|
||||||
title="Voir le détail de la notation"
|
title="Voir le détail de la notation"
|
||||||
>
|
>
|
||||||
<i class="bi bi-list-check"></i>
|
<i class="bi bi-list-check"></i>
|
||||||
</a>
|
</a>
|
||||||
|
<a
|
||||||
|
href="/api/users/{grade.id_user}/works/{w.id}/grades/{grade.id}/forge"
|
||||||
|
target="_blank"
|
||||||
|
class="btn btn-sm btn-outline-primary mr-1"
|
||||||
|
title="Voir le contenu du dépôt lié"
|
||||||
|
>
|
||||||
|
<i class="bi bi-git"></i>
|
||||||
|
</a>
|
||||||
<button
|
<button
|
||||||
class="btn btn-sm btn-danger mx-1"
|
class="btn btn-sm btn-success mr-1"
|
||||||
title="Supprimer la note"
|
title="Supprimer la note"
|
||||||
on:click={() => { grade.delete().then(() => refresh_grades(w)); }}
|
on:click={() => { grade.delete().then(() => refresh_grades(w)); }}
|
||||||
>
|
>
|
||||||
|
19
works.go
19
works.go
@ -275,6 +275,25 @@ func declareAPIAdminWorksRoutes(router *gin.RouterGroup) {
|
|||||||
|
|
||||||
c.Redirect(http.StatusFound, fmt.Sprintf("%s/%s", droneEndpoint, repo.TestsRef))
|
c.Redirect(http.StatusFound, fmt.Sprintf("%s/%s", droneEndpoint, repo.TestsRef))
|
||||||
})
|
})
|
||||||
|
gradesRoutes.GET("/forge", func(c *gin.Context) {
|
||||||
|
g := c.MustGet("grade").(*WorkGrade)
|
||||||
|
|
||||||
|
var u *User
|
||||||
|
if user, ok := c.Get("user"); ok {
|
||||||
|
u = user.(*User)
|
||||||
|
} else {
|
||||||
|
u = c.MustGet("LoggedUser").(*User)
|
||||||
|
}
|
||||||
|
|
||||||
|
repo, err := u.getRepositoryByWork(g.IdWork)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Unable to getRepositoryByWork(uid=%d, wid=%d): %s", u.Id, g.IdWork, err.Error())
|
||||||
|
c.AbortWithStatusJSON(http.StatusNotFound, gin.H{"errmsg": "Unable to find a corresponding repository."})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c.Redirect(http.StatusFound, strings.Replace(strings.Replace(repo.URI, ":", "/", 1), "git@", "https://", 1))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func declareAPIAuthWorksRoutes(router *gin.RouterGroup) {
|
func declareAPIAuthWorksRoutes(router *gin.RouterGroup) {
|
||||||
|
Reference in New Issue
Block a user