Loading plugins/survey/survey.cpp +39 −31 Changes for plugins/survey/survey.cpp: 39 added lines, 31 removed lines. Original line number Diff line number Diff line Loading @@ -1518,44 +1518,16 @@ namespace blogi { html << "</div>"; html << "<form class=\"surveyForm\">"; // Step 0: Participant info (always required) html << "<div class=\"wizard-step active\" data-step=\"0\" data-required=\"true\">" << "<div class=\"step-counter\">" << tr(_lang, "Step") << " 1 / " << totalSteps << "</div>" << "<div class=\"question\">" << "<div class=\"question-text required\">" << tr(_lang, "Your Information") << "</div>" << "<div style=\"margin-bottom:12px;\"><label style=\"display:block;margin-bottom:4px;font-weight:600;\">" << tr(_lang, "First Name") << " *</label>" << "<input type=\"text\" name=\"_firstname\" required placeholder=\"" << tr(_lang, "First Name") << "\" " << "style=\"width:100%;padding:10px;border:1px solid var(--blogi-border,#ddd);border-radius:6px;font-size:1em;\"/></div>" << "<div style=\"margin-bottom:12px;\"><label style=\"display:block;margin-bottom:4px;font-weight:600;\">" << tr(_lang, "Last Name") << " *</label>" << "<input type=\"text\" name=\"_lastname\" required placeholder=\"" << tr(_lang, "Last Name") << "\" " << "style=\"width:100%;padding:10px;border:1px solid var(--blogi-border,#ddd);border-radius:6px;font-size:1em;\"/></div>"; if (_companyRequired) { html << "<div style=\"margin-bottom:12px;\"><label style=\"display:block;margin-bottom:4px;font-weight:600;\">" << tr(_lang, "Company") << " *</label>" << "<input type=\"text\" name=\"_company\" required placeholder=\"" << tr(_lang, "Company") << "\" " << "style=\"width:100%;padding:10px;border:1px solid var(--blogi-border,#ddd);border-radius:6px;font-size:1em;\"/></div>"; } else { html << "<div style=\"margin-bottom:12px;\"><label style=\"display:block;margin-bottom:4px;font-weight:600;\">" << tr(_lang, "Company (optional)") << "</label>" << "<input type=\"text\" name=\"_company\" placeholder=\"" << tr(_lang, "Company (optional)") << "\" " << "style=\"width:100%;padding:10px;border:1px solid var(--blogi-border,#ddd);border-radius:6px;font-size:1em;\"/></div>"; } html << "<div style=\"margin-bottom:12px;\"><label style=\"display:block;margin-bottom:4px;font-weight:600;\">Email *</label>" << "<input type=\"email\" name=\"_email\" required placeholder=\"your@email.com\" " << "style=\"width:100%;padding:10px;border:1px solid var(--blogi-border,#ddd);border-radius:6px;font-size:1em;\"/></div>" << "</div>" // .question << "<div class=\"step-error\">" << tr(_lang, "Please fill in all fields.") << "</div>" << "<div class=\"wizard-nav\"><span></span>" << "<button type=\"button\" class=\"wizard-btn btn-next\">" << tr(_lang, "Next") << "</button>" << "</div></div>"; // Sort questions by order for rendering std::vector<SurveyQuestion> sortedQuestions = tpl.questions; std::sort(sortedQuestions.begin(), sortedQuestions.end(), [](const SurveyQuestion &a, const SurveyQuestion &b){ return a.order < b.order; }); // Question steps (step 1 .. N) int stepIdx = 1; // Question steps (step 0 .. N-1); participant info step is rendered last int stepIdx = 0; for (const auto &q : sortedQuestions) { html << "<div class=\"wizard-step\" data-step=\"" << stepIdx html << "<div class=\"wizard-step" << (stepIdx == 0 ? " active" : "") << "\" data-step=\"" << stepIdx << "\" data-question-id=\"" << q.id << "\" data-required=\"" << (q.required ? "true" : "false") << "\">" << "<div class=\"step-counter\">" << tr(_lang, "Step") << " " << (stepIdx + 1) << " / " << totalSteps << "</div>" Loading Loading @@ -1630,6 +1602,9 @@ namespace blogi { html << "</div>"; // .question html << "<div class=\"step-error\">" << tr(_lang, "Please answer this question.") << "</div>"; html << "<div class=\"wizard-nav\">"; if (stepIdx == 0) html << "<span></span>"; else html << "<button type=\"button\" class=\"wizard-btn btn-prev\">" << tr(_lang, "Back") << "</button>"; if (stepIdx < (int)totalSteps - 1) html << "<button type=\"button\" class=\"wizard-btn btn-next\">" << tr(_lang, "Next") << "</button>"; Loading @@ -1640,6 +1615,39 @@ namespace blogi { ++stepIdx; } // Final step: Participant info (always required), asked last html << "<div class=\"wizard-step" << (stepIdx == 0 ? " active" : "") << "\" data-step=\"" << stepIdx << "\" data-required=\"true\">" << "<div class=\"step-counter\">" << tr(_lang, "Step") << " " << (stepIdx + 1) << " / " << totalSteps << "</div>" << "<div class=\"question\">" << "<div class=\"question-text required\">" << tr(_lang, "Your Information") << "</div>" << "<div style=\"margin-bottom:12px;\"><label style=\"display:block;margin-bottom:4px;font-weight:600;\">" << tr(_lang, "First Name") << " *</label>" << "<input type=\"text\" name=\"_firstname\" required placeholder=\"" << tr(_lang, "First Name") << "\" " << "style=\"width:100%;padding:10px;border:1px solid var(--blogi-border,#ddd);border-radius:6px;font-size:1em;\"/></div>" << "<div style=\"margin-bottom:12px;\"><label style=\"display:block;margin-bottom:4px;font-weight:600;\">" << tr(_lang, "Last Name") << " *</label>" << "<input type=\"text\" name=\"_lastname\" required placeholder=\"" << tr(_lang, "Last Name") << "\" " << "style=\"width:100%;padding:10px;border:1px solid var(--blogi-border,#ddd);border-radius:6px;font-size:1em;\"/></div>"; if (_companyRequired) { html << "<div style=\"margin-bottom:12px;\"><label style=\"display:block;margin-bottom:4px;font-weight:600;\">" << tr(_lang, "Company") << " *</label>" << "<input type=\"text\" name=\"_company\" required placeholder=\"" << tr(_lang, "Company") << "\" " << "style=\"width:100%;padding:10px;border:1px solid var(--blogi-border,#ddd);border-radius:6px;font-size:1em;\"/></div>"; } else { html << "<div style=\"margin-bottom:12px;\"><label style=\"display:block;margin-bottom:4px;font-weight:600;\">" << tr(_lang, "Company (optional)") << "</label>" << "<input type=\"text\" name=\"_company\" placeholder=\"" << tr(_lang, "Company (optional)") << "\" " << "style=\"width:100%;padding:10px;border:1px solid var(--blogi-border,#ddd);border-radius:6px;font-size:1em;\"/></div>"; } html << "<div style=\"margin-bottom:12px;\"><label style=\"display:block;margin-bottom:4px;font-weight:600;\">Email *</label>" << "<input type=\"email\" name=\"_email\" required placeholder=\"your@email.com\" " << "style=\"width:100%;padding:10px;border:1px solid var(--blogi-border,#ddd);border-radius:6px;font-size:1em;\"/></div>" << "</div>" // .question << "<div class=\"step-error\">" << tr(_lang, "Please fill in all fields.") << "</div>" << "<div class=\"wizard-nav\">"; if (stepIdx == 0) html << "<span></span>"; else html << "<button type=\"button\" class=\"wizard-btn btn-prev\">" << tr(_lang, "Back") << "</button>"; html << "<button type=\"button\" class=\"wizard-btn btn-submit\">" << tr(_lang, "Submit") << "</button>" << "</div></div>"; html << "</form>" << "<div class=\"survey-loading\"><div class=\"survey-spinner\"></div>" << "<div class=\"survey-loading-text\">" << tr(_lang, "Sending...") << "</div></div>" Loading Loading
plugins/survey/survey.cpp +39 −31 Changes for plugins/survey/survey.cpp: 39 added lines, 31 removed lines. Original line number Diff line number Diff line Loading @@ -1518,44 +1518,16 @@ namespace blogi { html << "</div>"; html << "<form class=\"surveyForm\">"; // Step 0: Participant info (always required) html << "<div class=\"wizard-step active\" data-step=\"0\" data-required=\"true\">" << "<div class=\"step-counter\">" << tr(_lang, "Step") << " 1 / " << totalSteps << "</div>" << "<div class=\"question\">" << "<div class=\"question-text required\">" << tr(_lang, "Your Information") << "</div>" << "<div style=\"margin-bottom:12px;\"><label style=\"display:block;margin-bottom:4px;font-weight:600;\">" << tr(_lang, "First Name") << " *</label>" << "<input type=\"text\" name=\"_firstname\" required placeholder=\"" << tr(_lang, "First Name") << "\" " << "style=\"width:100%;padding:10px;border:1px solid var(--blogi-border,#ddd);border-radius:6px;font-size:1em;\"/></div>" << "<div style=\"margin-bottom:12px;\"><label style=\"display:block;margin-bottom:4px;font-weight:600;\">" << tr(_lang, "Last Name") << " *</label>" << "<input type=\"text\" name=\"_lastname\" required placeholder=\"" << tr(_lang, "Last Name") << "\" " << "style=\"width:100%;padding:10px;border:1px solid var(--blogi-border,#ddd);border-radius:6px;font-size:1em;\"/></div>"; if (_companyRequired) { html << "<div style=\"margin-bottom:12px;\"><label style=\"display:block;margin-bottom:4px;font-weight:600;\">" << tr(_lang, "Company") << " *</label>" << "<input type=\"text\" name=\"_company\" required placeholder=\"" << tr(_lang, "Company") << "\" " << "style=\"width:100%;padding:10px;border:1px solid var(--blogi-border,#ddd);border-radius:6px;font-size:1em;\"/></div>"; } else { html << "<div style=\"margin-bottom:12px;\"><label style=\"display:block;margin-bottom:4px;font-weight:600;\">" << tr(_lang, "Company (optional)") << "</label>" << "<input type=\"text\" name=\"_company\" placeholder=\"" << tr(_lang, "Company (optional)") << "\" " << "style=\"width:100%;padding:10px;border:1px solid var(--blogi-border,#ddd);border-radius:6px;font-size:1em;\"/></div>"; } html << "<div style=\"margin-bottom:12px;\"><label style=\"display:block;margin-bottom:4px;font-weight:600;\">Email *</label>" << "<input type=\"email\" name=\"_email\" required placeholder=\"your@email.com\" " << "style=\"width:100%;padding:10px;border:1px solid var(--blogi-border,#ddd);border-radius:6px;font-size:1em;\"/></div>" << "</div>" // .question << "<div class=\"step-error\">" << tr(_lang, "Please fill in all fields.") << "</div>" << "<div class=\"wizard-nav\"><span></span>" << "<button type=\"button\" class=\"wizard-btn btn-next\">" << tr(_lang, "Next") << "</button>" << "</div></div>"; // Sort questions by order for rendering std::vector<SurveyQuestion> sortedQuestions = tpl.questions; std::sort(sortedQuestions.begin(), sortedQuestions.end(), [](const SurveyQuestion &a, const SurveyQuestion &b){ return a.order < b.order; }); // Question steps (step 1 .. N) int stepIdx = 1; // Question steps (step 0 .. N-1); participant info step is rendered last int stepIdx = 0; for (const auto &q : sortedQuestions) { html << "<div class=\"wizard-step\" data-step=\"" << stepIdx html << "<div class=\"wizard-step" << (stepIdx == 0 ? " active" : "") << "\" data-step=\"" << stepIdx << "\" data-question-id=\"" << q.id << "\" data-required=\"" << (q.required ? "true" : "false") << "\">" << "<div class=\"step-counter\">" << tr(_lang, "Step") << " " << (stepIdx + 1) << " / " << totalSteps << "</div>" Loading Loading @@ -1630,6 +1602,9 @@ namespace blogi { html << "</div>"; // .question html << "<div class=\"step-error\">" << tr(_lang, "Please answer this question.") << "</div>"; html << "<div class=\"wizard-nav\">"; if (stepIdx == 0) html << "<span></span>"; else html << "<button type=\"button\" class=\"wizard-btn btn-prev\">" << tr(_lang, "Back") << "</button>"; if (stepIdx < (int)totalSteps - 1) html << "<button type=\"button\" class=\"wizard-btn btn-next\">" << tr(_lang, "Next") << "</button>"; Loading @@ -1640,6 +1615,39 @@ namespace blogi { ++stepIdx; } // Final step: Participant info (always required), asked last html << "<div class=\"wizard-step" << (stepIdx == 0 ? " active" : "") << "\" data-step=\"" << stepIdx << "\" data-required=\"true\">" << "<div class=\"step-counter\">" << tr(_lang, "Step") << " " << (stepIdx + 1) << " / " << totalSteps << "</div>" << "<div class=\"question\">" << "<div class=\"question-text required\">" << tr(_lang, "Your Information") << "</div>" << "<div style=\"margin-bottom:12px;\"><label style=\"display:block;margin-bottom:4px;font-weight:600;\">" << tr(_lang, "First Name") << " *</label>" << "<input type=\"text\" name=\"_firstname\" required placeholder=\"" << tr(_lang, "First Name") << "\" " << "style=\"width:100%;padding:10px;border:1px solid var(--blogi-border,#ddd);border-radius:6px;font-size:1em;\"/></div>" << "<div style=\"margin-bottom:12px;\"><label style=\"display:block;margin-bottom:4px;font-weight:600;\">" << tr(_lang, "Last Name") << " *</label>" << "<input type=\"text\" name=\"_lastname\" required placeholder=\"" << tr(_lang, "Last Name") << "\" " << "style=\"width:100%;padding:10px;border:1px solid var(--blogi-border,#ddd);border-radius:6px;font-size:1em;\"/></div>"; if (_companyRequired) { html << "<div style=\"margin-bottom:12px;\"><label style=\"display:block;margin-bottom:4px;font-weight:600;\">" << tr(_lang, "Company") << " *</label>" << "<input type=\"text\" name=\"_company\" required placeholder=\"" << tr(_lang, "Company") << "\" " << "style=\"width:100%;padding:10px;border:1px solid var(--blogi-border,#ddd);border-radius:6px;font-size:1em;\"/></div>"; } else { html << "<div style=\"margin-bottom:12px;\"><label style=\"display:block;margin-bottom:4px;font-weight:600;\">" << tr(_lang, "Company (optional)") << "</label>" << "<input type=\"text\" name=\"_company\" placeholder=\"" << tr(_lang, "Company (optional)") << "\" " << "style=\"width:100%;padding:10px;border:1px solid var(--blogi-border,#ddd);border-radius:6px;font-size:1em;\"/></div>"; } html << "<div style=\"margin-bottom:12px;\"><label style=\"display:block;margin-bottom:4px;font-weight:600;\">Email *</label>" << "<input type=\"email\" name=\"_email\" required placeholder=\"your@email.com\" " << "style=\"width:100%;padding:10px;border:1px solid var(--blogi-border,#ddd);border-radius:6px;font-size:1em;\"/></div>" << "</div>" // .question << "<div class=\"step-error\">" << tr(_lang, "Please fill in all fields.") << "</div>" << "<div class=\"wizard-nav\">"; if (stepIdx == 0) html << "<span></span>"; else html << "<button type=\"button\" class=\"wizard-btn btn-prev\">" << tr(_lang, "Back") << "</button>"; html << "<button type=\"button\" class=\"wizard-btn btn-submit\">" << tr(_lang, "Submit") << "</button>" << "</div></div>"; html << "</form>" << "<div class=\"survey-loading\"><div class=\"survey-spinner\"></div>" << "<div class=\"survey-loading-text\">" << tr(_lang, "Sending...") << "</div></div>" Loading