admin: add a page to view resolution video

This commit is contained in:
nemunaire 2019-01-19 01:02:10 +01:00
parent 4ee70a8781
commit 2ac205bf83
4 changed files with 24 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import (
"strings"
"srs.epita.fr/fic-server/admin/api"
"srs.epita.fr/fic-server/admin/sync"
"srs.epita.fr/fic-server/libfic"
"github.com/julienschmidt/httprouter"
@ -62,6 +63,13 @@ func init() {
api.Router().GET("/files/*_", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
http.ServeFile(w, r, path.Join(fic.FilesDir, strings.TrimPrefix(r.URL.Path, "/files")))
})
api.Router().GET("/vids/*_", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
if importer, ok := sync.GlobalImporter.(sync.LocalImporter); ok {
http.ServeFile(w, r, path.Join(importer.Base, strings.TrimPrefix(r.URL.Path, "/vids")))
} else {
http.Error(w, "Only available with local importer.", 400)
}
})
api.Router().GET("/check_import.html", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
http.ServeFile(w, r, path.Join(StaticDir, "check_import.html"))

View File

@ -29,6 +29,10 @@ angular.module("FICApp", ["ngRoute", "ngResource", "ngSanitize"])
controller: "ExerciceController",
templateUrl: "views/exercice.html"
})
.when("/exercices/:exerciceId/resolution", {
controller: "ExerciceController",
templateUrl: "views/exercice-resolution.html"
})
.when("/teams", {
controller: "TeamsListController",
templateUrl: "views/team-list.html"

View File

@ -0,0 +1,11 @@
<h2>
<a href="exercices/{{exercice.id}}">{{exercice.title}}</a> <small class="text-muted">Vidéo de résolution</small>
<div class="btn-group" role="group" ng-if="themes[exercice.id_theme].exercices[exercice.id]">
<a href="exercices/{{ themes[exercice.id_theme].exercices[exercice.id].previous }}/resolution" title="Exercice précédent" ng-class="{'disabled': !themes[exercice.id_theme].exercices[exercice.id].previous}" class="btn btn-sm btn-light"><span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span></a>
<a href="exercices/{{ themes[exercice.id_theme].exercices[exercice.id].next }}/resolution" title="Exercice suivant" ng-class="{'disabled': !themes[exercice.id_theme].exercices[exercice.id].next}" class="btn btn-sm btn-light"><span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span></a>
</div>
</h2>
<div class="text-center">
<video src="vids/{{exercice.videoURI}}" controls style="height: 80vh; margin: auto;"></video>
</div>

View File

@ -5,6 +5,7 @@
<a href="exercices/{{ themes[exercice.id_theme].exercices[exercice.id].previous }}" title="Exercice précédent" ng-class="{'disabled': !themes[exercice.id_theme].exercices[exercice.id].previous}" class="btn btn-sm btn-light"><span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span></a>
<a href="exercices/{{ themes[exercice.id_theme].exercices[exercice.id].next }}" title="Exercice suivant" ng-class="{'disabled': !themes[exercice.id_theme].exercices[exercice.id].next}" class="btn btn-sm btn-light"><span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span></a>
</div>
<a href="exercices/{{exercice.id}}/resolution" ng-disabled="!exercice.videoURI" class="float-right btn btn-sm btn-info"><span class="glyphicon glyphicon-facetime-video" aria-hidden="true"></span> Vidéo</a>
<button type="button" ng-click="syncExo()" ng-class="{'disabled': inSync}" class="float-right btn btn-sm btn-light"><span class="glyphicon glyphicon-refresh" aria-hidden="true"></span> Synchroniser</button>
</h2>