Do the feedback and ticket form plumbing
This commit is contained in:
@@ -469,6 +469,32 @@ angular.module('Application').service('Client', ['$http', 'md5', 'Notification',
|
||||
}).error(defaultErrorHandler(callback));
|
||||
};
|
||||
|
||||
Client.prototype.feedback = function (subject, description, callback) {
|
||||
var data = {
|
||||
type: 'feedback',
|
||||
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,
|
||||
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.createUser = function (username, email, callback) {
|
||||
var data = {
|
||||
username: username,
|
||||
|
||||
@@ -27,14 +27,14 @@
|
||||
We would love to hear any ideas, feature requests and overall feedback from your side.
|
||||
<br/>
|
||||
<br/>
|
||||
<form>
|
||||
<form ng-submit="submitFeedback()">
|
||||
<div class="form-group">
|
||||
<!-- <label for="feedbackSubject">Feedback</label> -->
|
||||
<input type="email" class="form-control" id="feedbackSubject" placeholder="Enter your idea">
|
||||
<input type="text" class="form-control" id="feedbackSubject" ng-model="feedback.subject" placeholder="Enter your idea">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<!-- <label for="feedbackDescription">Your Idea</label> -->
|
||||
<textarea class="form-control" id="feedbackDescription" rows="3" placeholder="Describe your idea"></textarea>
|
||||
<textarea class="form-control" id="feedbackDescription" rows="3" ng-model="feedback.description" placeholder="Describe your idea"></textarea>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</form>
|
||||
@@ -53,14 +53,14 @@
|
||||
If you found any issue or bugs, let us know, we will resolve that for you as soon as possible.
|
||||
<br/>
|
||||
<br/>
|
||||
<form>
|
||||
<form ng-submit="submitTicket()">
|
||||
<div class="form-group">
|
||||
<!-- <label for="feedbackSubject">Feedback</label> -->
|
||||
<input type="email" class="form-control" id="feedbackSubject" placeholder="Enter your issue">
|
||||
<input type="text" class="form-control" id="feedbackSubject" ng-model="ticket.subject" placeholder="Enter your issue">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<!-- <label for="feedbackDescription">Your Idea</label> -->
|
||||
<textarea class="form-control" id="feedbackDescription" rows="3" placeholder="Describe your issue"></textarea>
|
||||
<textarea class="form-control" id="feedbackDescription" rows="3" ng-model="ticket.description" placeholder="Describe your issue"></textarea>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</form>
|
||||
|
||||
@@ -2,4 +2,51 @@
|
||||
|
||||
angular.module('Application').controller('SupportController', ['$scope', '$location', 'Client', function ($scope, $location, Client) {
|
||||
|
||||
$scope.busy = false;
|
||||
|
||||
$scope.feedback = {
|
||||
error: null,
|
||||
success: false,
|
||||
subject: '',
|
||||
description: ''
|
||||
};
|
||||
|
||||
$scope.ticket = {
|
||||
error: null,
|
||||
success: false,
|
||||
subject: '',
|
||||
description: ''
|
||||
};
|
||||
|
||||
$scope.submitFeedback = function () {
|
||||
$scope.busy = true;
|
||||
$scope.feedback.success = false;
|
||||
$scope.feedback.error = null;
|
||||
|
||||
Client.feedback($scope.feedback.subject, $scope.feedback.description, function (error) {
|
||||
if (error) {
|
||||
$scope.feedback.error = error;
|
||||
} else {
|
||||
$scope.feedback.success = true;
|
||||
}
|
||||
|
||||
$scope.busy = false;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.submitTicket = function () {
|
||||
$scope.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;
|
||||
}
|
||||
|
||||
$scope.busy = false;
|
||||
});
|
||||
};
|
||||
}]);
|
||||
|
||||
Reference in New Issue
Block a user