{:uriI"»file://app/assets/javascripts/components/surveys/SurveyQuestionsController.js?type=application/javascript&pipeline=self&id=fbeec09d20b8e18dc00428eda1b466e8582ae73a49488673359ddbeb3b576510: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.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: { 'Accept-Language': $scope.language } }).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"%F4ò'jíŽö×0Ž™L‰²)Õö˜OÃViÈUð:œ¾: lengthi„ :dependencies_digest"%BiO{˜¨ñ;BãÐÞ]~ÎŒÃP7ì±h,‡Þ#òÆ]øH:idI"Efbeec09d20b8e18dc00428eda1b466e8582ae73a49488673359ddbeb3b576510;F: mtimel+UIV