{:uriI"»file://app/assets/javascripts/components/surveys/SurveyQuestionsController.js?type=application/javascript&pipeline=self&id=3db1e71859b7d947c52788f58e7a593a798585bb837cdc86a6c6abe9a6668791:ET:load_pathI"app/assets/javascripts;T: filenameI"Kapp/assets/javascripts/components/surveys/SurveyQuestionsController.js;T: nameI"1components/surveys/SurveyQuestionsController;T:logical_pathI"9components/surveys/SurveyQuestionsController.self.js;T:content_typeI"application/javascript;T: sourceI"€ function SurveyQuestionsController($scope, $rootScope, $state, $location, $modal, $stateParams, ApiAdapter, Survey, Question) { $scope.headers = { 'Accept-Language': 'fr' }; $scope.survey = null; Survey.get({ surveyId: $stateParams.surveyId }, {}).then( function(result) { $scope.survey = result; $scope.$apply() } ); $scope.questions = null; Question.index({ surveyId: $stateParams.surveyId }, {}, { headers: $scope.headers }).then( function(result) { $scope.questions = result; $scope.$apply() } ); $scope.question_delete = function(self_href) { ApiAdapter.execute("delete_question", self_href, {}, true ).then( function(response) { $state.go($state.current, {}, {reload: true}); } ); }; $scope.question_edit = function(question_id) { $modal.open({ size: 'lg', resolve: { question: [function($stateParams, Api) { return Question.get({questionId: question_id}); }] }, controller: function($scope, $modalInstance, question) { console.log(question); $scope.model = { id: question.data.id, question: { attributes: question.data.attributes } }; $scope.onSubmit = function(data) { return ApiAdapter.execute("update_question", { questionId: question_id }, JSON.stringify(data), { no_cache: true, headers: { 'Accept-Language': data.language } }).then( function(response) { $state.go($state.current, {}, {reload: true}); $modalInstance.close(); return response; } ); }; $scope.cancel = function() { $modalInstance.close(); }; }, templateUrl: "/assets/components/surveys/QuestionModal.html" }); }; $scope.question_new = function() { $modal.open({ size: 'lg', controller: function($scope, $modalInstance) { $scope.model = { question: { attributes: { text: "" } } }; $scope.onSubmit = function(data) { return ApiAdapter.execute("create_question", { surveyId: $stateParams.surveyId }, JSON.stringify(data), true ).then( function(response) { $state.go($state.current, {}, {reload: true}); $modalInstance.close(); return response; } ); }; $scope.cancel = function() { $modalInstance.close(); }; }, templateUrl: "/assets/components/surveys/QuestionModal.html" }); }; }; ;T: metadata{ :dependencieso:Set: @hash{ I"environment-version;TTI"environment-paths;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI"Yfile-digest://app/assets/javascripts/components/surveys/SurveyQuestionsController.js;TT: requiredo;;{: stubbedo;;{: linkso;;{: charsetI" utf-8;F: digest"%ëçËTú&sWyLHÂL­†{΃lÙiïþ”’]‡ <: lengthi€ :dependencies_digest"%Ðègšáì9d}¥0ÂÌ_<±D©…ƾW\¾tÝ:idI"E3db1e71859b7d947c52788f58e7a593a798585bb837cdc86a6c6abe9a6668791;F: mtimel+×UIV