frontend: allow players to respond to issues
This commit is contained in:
parent
73eb3ab1c0
commit
edbac43423
8 changed files with 85 additions and 12 deletions
|
|
@ -75,5 +75,6 @@ func reloadSettings(config settings.FICSettings) {
|
|||
|
||||
enableResolutionRoute = config.EnableResolutionRoute
|
||||
denyNameChange = config.DenyNameChange
|
||||
acceptNewIssues = config.AcceptNewIssue
|
||||
allowRegistration = config.AllowRegistration
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@
|
|||
<a class="nav-link" href="/rank">Classement</a>
|
||||
</li>
|
||||
<li class="nav-item" ng-if="issues.length > 0">
|
||||
<a class="nav-link" href="/issue">
|
||||
<a class="nav-link" href="/issues">
|
||||
Problèmes <span class="badge" ng-class="{'badge-danger': issues_need_info && issues_known_responses != issues_nb_responses,'badge-warning': !issues_need_info && issues_known_responses != issues_nb_responses,'badge-light': issues_known_responses == issues_nb_responses}">{{ issues_nb_responses }}</span>
|
||||
</a>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -57,11 +57,15 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
controller: "MyTeamController",
|
||||
templateUrl: "views/team-edit.html"
|
||||
})
|
||||
.when("/issue", {
|
||||
.when("/issue/:eid", {
|
||||
controller: "IssueController",
|
||||
templateUrl: "views/issue.html"
|
||||
})
|
||||
.when("/issue/:eid", {
|
||||
.when("/issues", {
|
||||
controller: "IssueController",
|
||||
templateUrl: "views/issue.html"
|
||||
})
|
||||
.when("/issues/:iid", {
|
||||
controller: "IssueController",
|
||||
templateUrl: "views/issue.html"
|
||||
})
|
||||
|
|
@ -227,10 +231,12 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
refreshIssuesInterval = $interval(refreshIssues, Math.floor(Math.random() * 24000) + 32000);
|
||||
|
||||
$http.get("issues.json").then(function(response) {
|
||||
$rootScope.issues_idx = {};
|
||||
$rootScope.issues_nb_responses = 0;
|
||||
$rootScope.issues_need_info = 0;
|
||||
$rootScope.issues = response.data;
|
||||
$rootScope.issues.forEach(function(issue) {
|
||||
$rootScope.issues_idx[issue.id] = issue;
|
||||
$rootScope.issues_nb_responses += issue.texts.length;
|
||||
if (issue.state == 'need-info') $rootScope.issues_need_info++;
|
||||
})
|
||||
|
|
@ -468,6 +474,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
}
|
||||
refreshMy();
|
||||
}
|
||||
$rootScope.refreshIssues = refreshIssues;
|
||||
$rootScope.refresh();
|
||||
})
|
||||
.controller("ExerciceController", function($scope, $routeParams, $http, $rootScope, $timeout) {
|
||||
|
|
@ -669,6 +676,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
$rootScope.issues_known_responses = $rootScope.issues_nb_responses;
|
||||
|
||||
$scope.issue = {
|
||||
id: parseInt($routeParams.iid, 10),
|
||||
id_exercice: parseInt($routeParams.eid, 10),
|
||||
subject: "",
|
||||
description: "",
|
||||
|
|
@ -676,9 +684,9 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
|
||||
$scope.isubmit = function() {
|
||||
$rootScope.sberr = "";
|
||||
if ($scope.issue.subject.length < 3) {
|
||||
if (!$scope.issue.id && $scope.issue.subject.length < 3) {
|
||||
$rootScope.messageClass = {"text-danger": true};
|
||||
$rootScope.sberr = "L'object de votre rapport d'anomalie est trop court !";
|
||||
$rootScope.sberr = "L'objet de votre rapport d'anomalie est trop court !";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -691,6 +699,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
$rootScope.message = response.data.errmsg;
|
||||
$scope.issue.subject = "";
|
||||
$scope.issue.description = "";
|
||||
setTimeout($rootScope.refreshIssues, 1750);
|
||||
}, function(response) {
|
||||
$rootScope.messageClass = {"text-danger": true};
|
||||
$rootScope.message = response.data.errmsg;
|
||||
|
|
|
|||
|
|
@ -15,11 +15,14 @@
|
|||
<td>{{ issue.state }} / {{ issue.priority }}</td>
|
||||
<td>{{ issue.assignee }}</td>
|
||||
<td>
|
||||
<div class="row" ng-repeat="text in issue.texts | orderBy:'date':'reverse'">
|
||||
<p ng-repeat="text in issue.texts | orderBy:'date':'reverse'" style="margin-left: 15px; text-indent: -15px">
|
||||
<span ng-if="text.assignee == null || text.assignee == '$team'">Vous</span>
|
||||
<span ng-if="text.assignee != null && text.assignee != '$team'" ng-bind="text.assignee"></span> à {{ text.date | date:"mediumTime" }} :
|
||||
<span ng-if="text.assignee != null && text.assignee != '$team'" ng-bind="text.assignee"></span> à {{ text.date | date:"mediumTime" }} :
|
||||
<span style="white-space: pre-line">{{ text.cnt }}</span>
|
||||
</div>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<a ng-href="/issues/{{ issue.id }}#myIssue" class="btn btn-sm" ng-class="{'btn-danger': issue.state == 'need-info', 'btn-light': issue.state != 'need-info'}"><span class="glyphicon glyphicon-envelope"></span></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
|
@ -33,8 +36,9 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card border-warning mt-3 mb-4" ng-if="settings.acceptNewIssue">
|
||||
<div class="card-header bg-warning text-light">Rapporter une anomalie <span ng-if="issue.id_exercice">sur un exercice</span></div>
|
||||
<div class="card border-warning mt-3 mb-4" ng-if="settings.acceptNewIssue" id="myIssue">
|
||||
<div class="card-header bg-warning text-light" ng-if="!issue.id">Rapporter une anomalie <span ng-if="issue.id_exercice">sur un exercice</span></div>
|
||||
<div class="card-header bg-warning text-light" ng-if="issue.id">Répondre à un rapport d'anomalie</div>
|
||||
<div class="card-body">
|
||||
<p ng-class="messageClass" ng-if="message || sberr"><strong ng-if="!sberr">Votre rapport a bien été envoyé !</strong><strong ng-if="sberr">{{ sberr }}</strong> {{ message }}</p>
|
||||
<form ng-submit="isubmit()">
|
||||
|
|
@ -49,7 +53,14 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="form-group row" ng-if="issue.id && issues_idx[issue.id]">
|
||||
<label for="subject" class="col col-form-label">Objet</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" readonly class="form-control-plaintext" id="subject" value="Re: {{ issues_idx[issue.id].subject }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row" ng-if="!issue.id || !issues_idx[issue.id]">
|
||||
<label for="subject" class="col col-form-label">Objet</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="subject" ng-model="issue.subject" placeholder="Intitulé succinct">
|
||||
|
|
|
|||
Reference in a new issue