Skip to content
Snippets Groups Projects
Commit 30bd05e7 authored by Fredrik Jonsson's avatar Fredrik Jonsson
Browse files

Added help text and help links to the application form copy script.

parent ce9ff5ef
No related branches found
No related tags found
No related merge requests found
......@@ -15,8 +15,6 @@
$('.application-form').find('.form__group, .rich-text').each(function () {
var question_text = '';
var label_text = $(this).find('.form__question').html();
var input_text = $(this).find('input').val();
var rich_text = $(this).find('.tinymce4-editor').val();
if (label_text) {
// Get the label, i.e. question.
label_text = strip(label_text);
......@@ -24,8 +22,34 @@
label_text = label_text.replace(/[ ]+/g, ' ');
question_text = '### ' + label_text;
var help_text = $(this).find('.form__help').html();
var $help_link = $(this).find('.form__help-link');
var $input_list = $(this).find('.form__item > ul > li');
var input_text = $(this).find('input').val();
var rich_text = $(this).find('.tinymce4-editor').val();
// Get help text and link if any.
if (help_text) {
question_text = question_text + '\n\n' + strip(help_text);
}
if ($help_link.length !== 0) {
question_text = question_text + '\n\n' + strip($help_link.html()) + ' <' + $help_link.find('a').attr('href') + '>';
}
// Get the user input if any.
if (input_text) {
if ($input_list.length !== 0) {
var input_list = [];
var input_item = '';
$input_list.each(function () {
input_item = strip($(this).html());
if ($(this).find('input').is(':checked')) {
input_item = input_item + '*';
}
input_list.push(input_item);
});
question_text = question_text + '\n\n' + input_list.join('\n');
}
else if (input_text) {
question_text = question_text + '\n\n' + strip(input_text);
}
else if (rich_text) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment