diff --git a/admin/api/exercice.go b/admin/api/exercice.go index 2c196153..c2554269 100644 --- a/admin/api/exercice.go +++ b/admin/api/exercice.go @@ -20,7 +20,6 @@ import ( func declareGlobalExercicesRoutes(router *gin.RouterGroup) { router.GET("/resolutions.json", exportResolutionMovies) router.GET("/exercices_stats.json", getExercicesStats) - router.GET("/exercices_forge_bindings.json", getExercicesForgeLinks) router.GET("/tags", listTags) } @@ -488,71 +487,6 @@ func getExercicesStats(c *gin.Context) { c.JSON(http.StatusOK, ret) } -type themeForgeBinding struct { - ThemeName string `json:"name"` - ThemePath string `json:"path"` - ForgeLink string `json:"forge_link"` - Exercices []exerciceForgeBinding `json:"exercices"` -} - -type exerciceForgeBinding struct { - ExerciceName string `json:"name"` - ExercicePath string `json:"path"` - ForgeLink string `json:"forge_link"` -} - -func getExercicesForgeLinks(c *gin.Context) { - themes, err := fic.GetThemesExtended() - if err != nil { - log.Println("Unable to listThemes:", err.Error()) - c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"errmsg": "An error occurs during themes listing."}) - return - } - - fli, ok := sync.GlobalImporter.(sync.ForgeLinkedImporter) - if !ok { - c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"errmsg": "Current importer is not compatible with ForgeLinkedImporter"}) - return - } - - ret := []themeForgeBinding{} - for _, theme := range themes { - exercices, err := theme.GetExercices() - if err != nil { - log.Println("Unable to listExercices:", err.Error()) - c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"errmsg": "An error occurs during exercice listing."}) - return - } - - var exlinks []exerciceForgeBinding - for _, exercice := range exercices { - var forgelink string - if u, _ := fli.GetExerciceLink(exercice); u != nil { - forgelink = u.String() - } - - exlinks = append(exlinks, exerciceForgeBinding{ - ExerciceName: exercice.Title, - ExercicePath: exercice.Path, - ForgeLink: forgelink, - }) - } - - var forgelink string - if u, _ := fli.GetThemeLink(theme); u != nil { - forgelink = u.String() - } - ret = append(ret, themeForgeBinding{ - ThemeName: theme.Name, - ThemePath: theme.Path, - ForgeLink: forgelink, - Exercices: exlinks, - }) - } - - c.JSON(http.StatusOK, ret) -} - func AssigneeCookieHandler(c *gin.Context) { myassignee, err := c.Cookie("myassignee") if err != nil { diff --git a/admin/static.go b/admin/static.go index 23ad6da6..82772993 100644 --- a/admin/static.go +++ b/admin/static.go @@ -80,9 +80,6 @@ func declareStaticRoutes(router *gin.RouterGroup, cfg *settings.Settings, baseUR router.GET("/files", func(c *gin.Context) { serveIndex(c) }) - router.GET("/forge-links", func(c *gin.Context) { - serveIndex(c) - }) router.GET("/public/*_", func(c *gin.Context) { serveIndex(c) }) diff --git a/admin/static/js/app.js b/admin/static/js/app.js index 9b6fc13b..915de87d 100644 --- a/admin/static/js/app.js +++ b/admin/static/js/app.js @@ -49,10 +49,6 @@ angular.module("FICApp", ["ngRoute", "ngResource", "ngSanitize"]) controller: "ExerciceController", templateUrl: "views/exercice-resolution.html" }) - .when("/forge-links", { - controller: "ForgeLinksController", - templateUrl: "views/exercices-forgelink.html" - }) .when("/tags", { controller: "TagsListController", templateUrl: "views/tags.html" @@ -2193,16 +2189,6 @@ angular.module("FICApp") }; }) - .controller("ForgeLinksController", function ($scope, $http) { - $http({ - url: "api/exercices_forge_bindings.json", - }).then(function (response) { - $scope.forge_links = response.data; - }, function (response) { - $scope.addToast('danger', 'An error occurs when generating exercice forge links: ', response.data.errmsg); - }); - }) - .controller("ExerciceTagsController", function ($scope, ExerciceTags, $routeParams, $rootScope) { $scope.tags = ExerciceTags.query({ exerciceId: $routeParams.exerciceId }); diff --git a/admin/static/views/exercices-forgelink.html b/admin/static/views/exercices-forgelink.html deleted file mode 100644 index 2588ebc4..00000000 --- a/admin/static/views/exercices-forgelink.html +++ /dev/null @@ -1,12 +0,0 @@ -