/**
* Created by cklimkowsky on 3/16/15.
*/
angular
.module('coopEval')
.directive('ceSubmittedForm', submittedForm);
function submittedForm() {
return {
restrict: 'E',
scope: {
formType: '@',
evaluation: '='
},
link: function (scope, element, attr, controller) {
/**
* Determines whether a question of the given question type exists in the given question group.
* @param questionGroup
* @param questionType
* @returns {boolean} True if questionGroup contains a question of type questionType, false otherwise.
*/
scope.questionGroupContainsQuestionType = function (questionGroup, questionType) {
if (questionGroup) {
for (var i = 0; i < questionGroup.questions.length; i++) {
if (questionGroup.questions[i].questionType == questionType) {
return true;
}
}
}
return false;
};
/**
* Filters the questions in a question group so that non-tabular question answers
* are displayed outside of a table on the View Submitted Form page.
* @param questionAnswer
* @returns {boolean}
*/
scope.tabularQuestionAnswerFilter = function (question) {
return question.questionType !== 'Paragraph' && question.questionType !== 'Text'
};
},
templateUrl: 'partials/form/submitted-form.html'
}
} |