Created
January 27, 2017 10:01
-
-
Save salami-art/f560b3a2b0938f214b7dc8a5d350128a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Here we manage the action of creating a new question. | |
# | |
angular.module('pazienti_light').controller "QuestionsNewCtrl", ['$scope', '$modal', '$http', 'current_session', ($scope, $modal, $http, current_session)-> | |
$scope.question = | |
description: "" | |
$scope.ask = (question)-> | |
current_session.options.prevent_redirect = true | |
unless current_session.present() | |
$modal.open("login.patient_form") # $('#login_choices_modal').modal('show') | |
current_session.onLogin((user, location, options)-> | |
$modal.closeAll() | |
$scope.ask(question) | |
,0) | |
else | |
$scope.processingQuestion = true | |
data = { question: question } | |
# CREATING A NEW QUESTION | |
$http.post("/api/v1/risposte/", data).success( | |
(send_response)-> | |
window.location.href = "/congratulazioni-domanda-gratis" | |
).error( | |
(r)-> | |
console.error "Error while asking question... LOG: " + r | |
Flashing.setMessage("bad","Si è verificato un problema durante l'invio della domanda. Contatta il team di pazienti se il problema persiste." ) | |
) | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment