diff --git a/app/femr/business/services/system/UserService.java b/app/femr/business/services/system/UserService.java index def5c8949..ad5558d5e 100644 --- a/app/femr/business/services/system/UserService.java +++ b/app/femr/business/services/system/UserService.java @@ -72,7 +72,11 @@ public ServiceResponse createFeedback(String feedback) { newFeedback.setDate(dateUtils.getCurrentDateTime()); newFeedback.setFeedback(feedback); - feedbackRepository.create(newFeedback); + if (feedbackRepository.create(newFeedback) != null){ + response.setResponseObject(true); + }else{ + response.setResponseObject(false); + } return response; } diff --git a/app/femr/data/models/core/IFeedback.java b/app/femr/data/models/core/IFeedback.java index bad20e752..0e7483dbf 100644 --- a/app/femr/data/models/core/IFeedback.java +++ b/app/femr/data/models/core/IFeedback.java @@ -16,7 +16,7 @@ public interface IFeedback { void setDate (DateTime theDate); void setFeedback (String theFeedback); - String getLanguageCode(); - void setLanguageCode(String languageCode); +// String getLanguageCode(); +// void setLanguageCode(String languageCode); } diff --git a/app/femr/data/models/mysql/Feedback.java b/app/femr/data/models/mysql/Feedback.java index b12e837ff..425f5c2da 100644 --- a/app/femr/data/models/mysql/Feedback.java +++ b/app/femr/data/models/mysql/Feedback.java @@ -23,8 +23,8 @@ public class Feedback implements IFeedback { @Column(name = "feedback", nullable = false) private String feedback; - @Column(name="language_code", nullable=true, length=5) - private String languageCode; +// @Column(name="language_code", nullable=true, length=5) +// private String languageCode; @@ -55,14 +55,14 @@ public void setFeedback (String theFeedback) { feedback = theFeedback; } - @Override - public String getLanguageCode() { - return this.languageCode; - } - - @Override - public void setLanguageCode(String languageCode) { - this.languageCode = languageCode; - } +// @Override +// public String getLanguageCode() { +// return this.languageCode; +// } +// +// @Override +// public void setLanguageCode(String languageCode) { +// this.languageCode = languageCode; +// } } diff --git a/app/femr/ui/controllers/FeedbackController.java b/app/femr/ui/controllers/FeedbackController.java index 04d204a91..8b926bb0f 100644 --- a/app/femr/ui/controllers/FeedbackController.java +++ b/app/femr/ui/controllers/FeedbackController.java @@ -6,6 +6,7 @@ import femr.business.services.core.ISessionService; import femr.business.services.core.IUserService; import femr.common.dtos.CurrentUser; +import femr.common.dtos.ServiceResponse; import femr.data.models.mysql.Roles; import femr.ui.helpers.security.AllowedRoles; import femr.ui.helpers.security.FEMRAuthenticated; @@ -28,6 +29,7 @@ public class FeedbackController extends Controller { private final ISessionService sessionService; private final FormFactory formFactory; private final IUserService userService; + private String SuccessMessage = ""; @Inject @@ -47,7 +49,7 @@ public FeedbackController( AssetsFinder assetsFinder, // GET public Result indexGet() { CurrentUser currentUser = sessionService.retrieveCurrentUserSession(); - return ok(feedback.render(currentUser, assetsFinder)); + return ok(feedback.render(currentUser, assetsFinder, SuccessMessage)); } // POST @@ -57,11 +59,14 @@ public Result indexPost() { CurrentUser currentUser = sessionService.retrieveCurrentUserSession(); if(!viewModel.getFeedbackMsg().equals("")){ - userService.createFeedback(viewModel.getFeedbackMsg()); - return redirect("/"); + ServiceResponse success = userService.createFeedback(viewModel.getFeedbackMsg()); + if (success.getResponseObject()){ + SuccessMessage = "Successfully sent feedback!"; + return ok(feedback.render(currentUser, assetsFinder, SuccessMessage)); + } } - - return redirect("/feedback"); + SuccessMessage = "Failed to send feedback. Please try again or contact a nerd!"; + return ok(feedback.render(currentUser, assetsFinder, SuccessMessage)); } diff --git a/app/femr/ui/views/feedback/feedback.scala.html b/app/femr/ui/views/feedback/feedback.scala.html index afff4f964..cb7c8d867 100644 --- a/app/femr/ui/views/feedback/feedback.scala.html +++ b/app/femr/ui/views/feedback/feedback.scala.html @@ -1,4 +1,4 @@ -@(currentUser: femr.common.dtos.CurrentUser, assets: AssetsFinder) +@(currentUser: femr.common.dtos.CurrentUser, assets: AssetsFinder, successMessage: java.lang.String) @import femr.ui.views.html.layouts.main @import femr.ui.controllers.routes.FeedbackController @@ -53,7 +53,7 @@

Give Feedback

} - + @successMessage

Your feedback is completely anonymous and will only be used to produce a better fEMR product.

} diff --git a/public/css/feedback.css b/public/css/feedback.css index bbae2e2a6..2819f47f9 100644 --- a/public/css/feedback.css +++ b/public/css/feedback.css @@ -21,3 +21,6 @@ button#feedbackSubmit { margin: 10px 0; } +span{ + font-weight: bold; +} \ No newline at end of file