Skip to content
This repository has been archived by the owner on Feb 13, 2022. It is now read-only.

Change "Skip Logic" block label to "Choice" for "checkboxes" #61

Merged
merged 1 commit into from
Nov 24, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion molo/surveys/static/js/blocks/skiplogic_stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@
question.questionSelectors = () => question.find('[id$="-question_1"]');
question.questionSelectors = () => question.find('[id$="-question_1"]');
question.answerHelpText = () => question.choices().find('.help');
question.addBlockLabel = () => question.find('.action-add-block-skip_logic').children('span');
question.filterSelectors = sortOrder => question.questionSelectors().find(`option[value=${sortOrder}]`);
question.hasSelected = sortOrder => {
return question.questionSelectors().filter(':visible').is( function(index, element) {
return $(element).val() == sortOrder;
} );
};
question.setAddBlockLabel = newLabel => question.addBlockLabel().text(newLabel);
return question;
};


window.question = function(id) {
this.fieldID = id;
return addHelperMethods(questionSelector(this.fieldID));
Expand Down Expand Up @@ -50,11 +53,20 @@
} else {
showChoices(duration);
};
if (thisQuestion.fieldSelect().val() == 'checkbox') {
// Set the help text for "checkbox"
if (thisQuestion.fieldSelect().val() === 'checkbox') {
thisQuestion.answerHelpText().show();
} else {
thisQuestion.answerHelpText().hide();
}
// Set the label for the stream field add block for "checkboxes".
// Set it to "choice" since there's no skip logic setting and
// calling it skip logic has a little sense.
if (thisQuestion.fieldSelect().val() === 'checkboxes') {
thisQuestion.setAddBlockLabel('Choice')
} else {
thisQuestion.setAddBlockLabel('Skip Logic')
}
};

var shouldHide = function () {
Expand Down