{:uriI"file://app/assets/javascripts/components/surveys/SurveyQuestionsController.js?type=application/javascript&pipeline=self&id=005d7fc001c9c95fff302434a9a9ccc1f094d64c652b0795e7a268c7e3d0ea4b: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': 'en' }; $scope.question_answers = function(questionId) { alert(0); $state.go('surveys.questions.answers', { surveyId: $stateParams.surveyId, questionId: questionId }); }; $scope.survey = null; Survey.get({ surveyId: $stateParams.surveyId }, {}).then( function(result) { $scope.survey = result; $scope.$apply() } ); $scope.questions = {}; $scope.$watch("headers['Accept-Language']", function(newValue, oldValue) { Question.index({ surveyId: $stateParams.surveyId }, {}, { no_cache: true, headers: $scope.headers }).then( function(result) { $scope.questions = result; if(!$scope.$$phase) { $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) { $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), { 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" }); }; }; ;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"%# CiP/ ;-r F/: lengthi :dependencies_digest"%WQ{/Թtru޿HE'io wG:idI"E005d7fc001c9c95fff302434a9a9ccc1f094d64c652b0795e7a268c7e3d0ea4b;F: mtimel+IJV