From 0b4256a99204a28e0830bae771489f4e5239305a Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Tue, 4 Aug 2015 23:30:53 +0200 Subject: [PATCH] Unify feedback and ticket forms --- webadmin/src/js/client.js | 17 ++------------ webadmin/src/views/support.html | 39 +++++++++------------------------ webadmin/src/views/support.js | 37 +++---------------------------- 3 files changed, 15 insertions(+), 78 deletions(-) diff --git a/webadmin/src/js/client.js b/webadmin/src/js/client.js index 1ce905813..cbdcd39c7 100644 --- a/webadmin/src/js/client.js +++ b/webadmin/src/js/client.js @@ -469,22 +469,9 @@ angular.module('Application').service('Client', ['$http', 'md5', 'Notification', }).error(defaultErrorHandler(callback)); }; - Client.prototype.feedback = function (subject, description, callback) { + Client.prototype.feedback = function (type, 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', + type: type, subject: subject, description: description }; diff --git a/webadmin/src/views/support.html b/webadmin/src/views/support.html index 558176563..e374df34f 100644 --- a/webadmin/src/views/support.html +++ b/webadmin/src/views/support.html @@ -24,15 +24,22 @@

Feedback

- 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.
+ If you found any issue or bugs, let us know as well, we will resolve that for you as soon as possible.

+
+ +
- +
- +
{{feedback.error}} @@ -42,32 +49,6 @@
- -
- -
-
-
-
-

Ticket

- If you found any issue or bugs, let us know, we will resolve that for you as soon as possible. -
-
- -
- -
-
- -
- - {{ticket.error}} - Thank You! - -
-
-
-

diff --git a/webadmin/src/views/support.js b/webadmin/src/views/support.js index a3940e727..aa63c7b4c 100644 --- a/webadmin/src/views/support.js +++ b/webadmin/src/views/support.js @@ -8,39 +8,25 @@ angular.module('Application').controller('SupportController', ['$scope', '$locat success: false, busy: false, subject: '', - description: '' - }; - - $scope.ticket = { - error: null, - success: false, - busy: false, - subject: '', + type: '', description: '' }; function resetFeedback() { $scope.feedback.subject = ''; $scope.feedback.description = ''; + $scope.feedback.type = ''; $scope.feedbackForm.$setUntouched(); $scope.feedbackForm.$setPristine(); } - function resetTicket() { - $scope.ticket.subject = ''; - $scope.ticket.description = ''; - - $scope.ticketForm.$setUntouched(); - $scope.ticketForm.$setPristine(); - } - $scope.submitFeedback = function () { $scope.feedback.busy = true; $scope.feedback.success = false; $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) { $scope.feedback.error = error; } else { @@ -51,21 +37,4 @@ angular.module('Application').controller('SupportController', ['$scope', '$locat $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; - }); - }; }]);