Able to sync and export standalone exercices
This commit is contained in:
parent
76f830b332
commit
adb0e36dd4
15 changed files with 159 additions and 31 deletions
|
@ -1840,11 +1840,18 @@ angular.module("FICApp")
|
|||
url: "api/themes.json",
|
||||
method: "GET"
|
||||
}).then(function(response) {
|
||||
$scope.themes = response.data
|
||||
for (var k in $scope.themes[$scope.exercice.id_theme].exercices) {
|
||||
var exercice = $scope.themes[$scope.exercice.id_theme].exercices[k];
|
||||
$scope.my_ex_num[exercice.id] = k;
|
||||
}
|
||||
$scope.themes = response.data;
|
||||
if ($scope.exercice.id_theme) {
|
||||
for (var k in $scope.themes[$scope.exercice.id_theme].exercices) {
|
||||
var exercice = $scope.themes[$scope.exercice.id_theme].exercices[k];
|
||||
$scope.my_ex_num[exercice.id] = k;
|
||||
}
|
||||
} else {
|
||||
for (var k in $scope.themes["0"].exercices) {
|
||||
var exercice = $scope.themes["0"].exercices[k];
|
||||
$scope.my_ex_num[exercice.id] = k;
|
||||
}
|
||||
}
|
||||
});
|
||||
$scope.exercices = Exercice.query();
|
||||
$scope.fields = ["title", "urlid", "authors", "disabled", "statement", "headline", "overview", "finished", "depend", "gain", "coefficient", "videoURI", "image", "resolution", "issue", "issuekind", "wip"];
|
||||
|
@ -1853,7 +1860,7 @@ angular.module("FICApp")
|
|||
$scope.syncExo = function() {
|
||||
$scope.inSync = true;
|
||||
$http({
|
||||
url: "api/sync/themes/" + $scope.exercice.id_theme + "/exercices/" + $routeParams.exerciceId,
|
||||
url: $scope.exercice.id_theme?("api/sync/themes/" + $scope.exercice.id_theme + "/exercices/" + $routeParams.exerciceId):("api/sync/exercices/" + $routeParams.exerciceId),
|
||||
method: "POST"
|
||||
}).then(function(response) {
|
||||
$scope.inSync = false;
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
{{exercice.title}}
|
||||
<small ng-if="themes && themes[exercice.id_theme]"><a href="themes/{{ exercice.id_theme }}" title="{{themes[exercice.id_theme].authors | stripHTML}}">{{themes[exercice.id_theme].name}}</a></small>
|
||||
</h2>
|
||||
<div class="btn-group" role="group" ng-if="themes[exercice.id_theme].exercices">
|
||||
<a href="exercices/{{ themes[exercice.id_theme].exercices[my_ex_num[exercice.id]-1].id }}" title="Exercice précédent" ng-class="{'disabled': !themes[exercice.id_theme].exercices[my_ex_num[exercice.id]-1]}" 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[my_ex_num[exercice.id]-1+2].id }}" title="Exercice suivant" ng-class="{'disabled': !themes[exercice.id_theme].exercices[my_ex_num[exercice.id]-1+2]}" class="btn btn-sm btn-light"><span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span></a>
|
||||
<div class="btn-group" role="group" ng-if="themes[exercice.id_theme?exercice.id_theme:'0'].exercices">
|
||||
<a href="exercices/{{ themes[exercice.id_theme?exercice.id_theme:'0'].exercices[my_ex_num[exercice.id]-1].id }}" title="Exercice précédent" ng-class="{'disabled': !themes[exercice.id_theme?exercice.id_theme:'0'].exercices[my_ex_num[exercice.id]-1]}" class="btn btn-sm btn-light"><span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span></a>
|
||||
<a href="exercices/{{ themes[exercice.id_theme?exercice.id_theme:'0'].exercices[my_ex_num[exercice.id]-1+2].id }}" title="Exercice suivant" ng-class="{'disabled': !themes[exercice.id_theme?exercice.id_theme:'0'].exercices[my_ex_num[exercice.id]-1+2]}" class="btn btn-sm btn-light"><span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span></a>
|
||||
</div>
|
||||
<div class="ml-auto d-flex flex-row-reverse text-nowrap">
|
||||
<a href="exercices/{{exercice.id}}/resolution" ng-disabled="!exercice.videoURI" class="ml-2 btn btn-sm btn-info"><span class="glyphicon glyphicon-facetime-video" aria-hidden="true"></span> Vidéo</a>
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
</button>
|
||||
<div class="dropdown-menu" ng-controller="ThemesListController" style="max-height: 45vh; overflow: auto">
|
||||
<a class="dropdown-item" ng-click="deepSync(theme)" ng-repeat="theme in themes" ng-bind="theme.name"></a>
|
||||
<a class="dropdown-item" ng-click="deepSync({name: 'Exercices indépendants', id: 0})">Exercices indépendants</a>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="btn btn-secondary" ng-click="speedyDeepSync()" ng-disabled="deepSyncInProgress"><span class="glyphicon glyphicon-import" aria-hidden="true"></span> Synchronisation sans fichiers</button>
|
||||
|
|
Reference in a new issue