Unify feedback and ticket forms
This commit is contained in:
@@ -469,22 +469,9 @@ angular.module('Application').service('Client', ['$http', 'md5', 'Notification',
|
|||||||
}).error(defaultErrorHandler(callback));
|
}).error(defaultErrorHandler(callback));
|
||||||
};
|
};
|
||||||
|
|
||||||
Client.prototype.feedback = function (subject, description, callback) {
|
Client.prototype.feedback = function (type, subject, description, callback) {
|
||||||
var data = {
|
var data = {
|
||||||
type: 'feedback',
|
type: type,
|
||||||
subject: subject,
|
|
||||||
description: description
|
|
||||||
};
|
|
||||||
|
|
||||||
$http.post(client.apiOrigin + '/api/v1/cloudron/feedback', data).success(function (data, status) {
|
|
||||||
if (status !== 201) return callback(new ClientError(status, data));
|
|
||||||
callback(null);
|
|
||||||
}).error(defaultErrorHandler(callback));
|
|
||||||
};
|
|
||||||
|
|
||||||
Client.prototype.ticket = function (subject, description, callback) {
|
|
||||||
var data = {
|
|
||||||
type: 'ticket',
|
|
||||||
subject: subject,
|
subject: subject,
|
||||||
description: description
|
description: description
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -24,15 +24,22 @@
|
|||||||
<div class="row animateMeOpacity">
|
<div class="row animateMeOpacity">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<h3>Feedback</h3>
|
<h3>Feedback</h3>
|
||||||
We would love to hear any ideas, feature requests and overall feedback from your side.
|
We would love to hear any ideas or feature requests from your side.<br/>
|
||||||
|
If you found any issue or bugs, let us know as well, we will resolve that for you as soon as possible.
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
<form name="feedbackForm" ng-submit="submitFeedback()">
|
<form name="feedbackForm" ng-submit="submitFeedback()">
|
||||||
|
<div class="form-group">
|
||||||
|
<select class="form-control" name="type" style="width: 50%;" ng-model="feedback.type" required>
|
||||||
|
<option value="feedback">Enhancement / Idea</option>
|
||||||
|
<option value="ticket">Bug Report</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
<div class="form-group" ng-class="{ 'has-error': (feedbackForm.subject.$dirty && feedbackForm.subject.$invalid) }">
|
<div class="form-group" ng-class="{ 'has-error': (feedbackForm.subject.$dirty && feedbackForm.subject.$invalid) }">
|
||||||
<input type="text" class="form-control" name="subject" placeholder="Enter your idea" ng-model="feedback.subject" ng-maxlength="512" ng-minlength="1" required>
|
<input type="text" class="form-control" name="subject" placeholder="Enter your idea or issue" ng-model="feedback.subject" ng-maxlength="512" ng-minlength="1" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group" ng-class="{ 'has-error': (feedbackForm.description.$dirty && feedbackForm.description.$invalid) }">
|
<div class="form-group" ng-class="{ 'has-error': (feedbackForm.description.$dirty && feedbackForm.description.$invalid) }">
|
||||||
<textarea class="form-control" name="description" rows="3" placeholder="Describe your idea" ng-model="feedback.description" ng-minlength="1" required></textarea>
|
<textarea class="form-control" name="description" rows="3" placeholder="Describe your idea or issue" ng-model="feedback.description" ng-minlength="1" required></textarea>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-primary" ng-disabled="feedbackForm.$invalid || feedback.busy"><i class="fa fa-spinner fa-pulse" ng-show="feedback.busy"></i> Submit</button>
|
<button type="submit" class="btn btn-primary" ng-disabled="feedbackForm.$invalid || feedback.busy"><i class="fa fa-spinner fa-pulse" ng-show="feedback.busy"></i> Submit</button>
|
||||||
<span ng-show="feedback.error" class="text-danger text-bold">{{feedback.error}}</span>
|
<span ng-show="feedback.error" class="text-danger text-bold">{{feedback.error}}</span>
|
||||||
@@ -42,32 +49,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
<div class="card card-large">
|
|
||||||
<div class="grid-item-top">
|
|
||||||
<div class="row animateMeOpacity">
|
|
||||||
<div class="col-lg-12">
|
|
||||||
<h3>Ticket</h3>
|
|
||||||
If you found any issue or bugs, let us know, we will resolve that for you as soon as possible.
|
|
||||||
<br/>
|
|
||||||
<br/>
|
|
||||||
<form name="ticketForm" ng-submit="submitTicket()">
|
|
||||||
<div class="form-group" ng-class="{ 'has-error': (ticketForm.subject.$dirty && ticketForm.subject.$invalid) }">
|
|
||||||
<input type="text" class="form-control" name="subject" placeholder="Enter your issue" ng-model="ticket.subject" ng-maxlength="512" ng-minlength="1" required>
|
|
||||||
</div>
|
|
||||||
<div class="form-group" ng-class="{ 'has-error': (ticketForm.description.$dirty && ticketForm.description.$invalid) }">
|
|
||||||
<textarea class="form-control" name="description" rows="3" placeholder="Describe your issue" ng-model="ticket.description" ng-minlength="1" required></textarea>
|
|
||||||
</div>
|
|
||||||
<button type="submit" class="btn btn-primary" ng-disabled="ticketForm.$invalid || ticket.busy"><i class="fa fa-spinner fa-pulse" ng-show="ticket.busy"></i> Submit</button>
|
|
||||||
<span ng-show="ticket.error" class="text-danger text-bold">{{ticket.error}}</span>
|
|
||||||
<span ng-show="ticket.success" class="text-success text-bold">Thank You!</span>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
|
|||||||
@@ -8,39 +8,25 @@ angular.module('Application').controller('SupportController', ['$scope', '$locat
|
|||||||
success: false,
|
success: false,
|
||||||
busy: false,
|
busy: false,
|
||||||
subject: '',
|
subject: '',
|
||||||
description: ''
|
type: '',
|
||||||
};
|
|
||||||
|
|
||||||
$scope.ticket = {
|
|
||||||
error: null,
|
|
||||||
success: false,
|
|
||||||
busy: false,
|
|
||||||
subject: '',
|
|
||||||
description: ''
|
description: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
function resetFeedback() {
|
function resetFeedback() {
|
||||||
$scope.feedback.subject = '';
|
$scope.feedback.subject = '';
|
||||||
$scope.feedback.description = '';
|
$scope.feedback.description = '';
|
||||||
|
$scope.feedback.type = '';
|
||||||
|
|
||||||
$scope.feedbackForm.$setUntouched();
|
$scope.feedbackForm.$setUntouched();
|
||||||
$scope.feedbackForm.$setPristine();
|
$scope.feedbackForm.$setPristine();
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetTicket() {
|
|
||||||
$scope.ticket.subject = '';
|
|
||||||
$scope.ticket.description = '';
|
|
||||||
|
|
||||||
$scope.ticketForm.$setUntouched();
|
|
||||||
$scope.ticketForm.$setPristine();
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.submitFeedback = function () {
|
$scope.submitFeedback = function () {
|
||||||
$scope.feedback.busy = true;
|
$scope.feedback.busy = true;
|
||||||
$scope.feedback.success = false;
|
$scope.feedback.success = false;
|
||||||
$scope.feedback.error = null;
|
$scope.feedback.error = null;
|
||||||
|
|
||||||
Client.feedback($scope.feedback.subject, $scope.feedback.description, function (error) {
|
Client.feedback($scope.feedback.type, $scope.feedback.subject, $scope.feedback.description, function (error) {
|
||||||
if (error) {
|
if (error) {
|
||||||
$scope.feedback.error = error;
|
$scope.feedback.error = error;
|
||||||
} else {
|
} else {
|
||||||
@@ -51,21 +37,4 @@ angular.module('Application').controller('SupportController', ['$scope', '$locat
|
|||||||
$scope.feedback.busy = false;
|
$scope.feedback.busy = false;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.submitTicket = function () {
|
|
||||||
$scope.ticket.busy = true;
|
|
||||||
$scope.ticket.success = false;
|
|
||||||
$scope.ticket.error = null;
|
|
||||||
|
|
||||||
Client.ticket($scope.ticket.subject, $scope.ticket.description, function (error) {
|
|
||||||
if (error) {
|
|
||||||
$scope.ticket.error = error;
|
|
||||||
} else {
|
|
||||||
$scope.ticket.success = true;
|
|
||||||
resetTicket();
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.ticket.busy = false;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}]);
|
}]);
|
||||||
|
|||||||
Reference in New Issue
Block a user