mirror of
https://github.com/discourse/discourse.git
synced 2025-03-02 07:57:41 +08:00

* FEATURE: revamped wizard * UX: Wizard redesign (#17381) * UX: Step 1-2 * swap out images * UX: Finalize all steps * UX: mobile * UX: Fix test * more test * DEV: remove unneeded wizard components * DEV: fix wizard tests * DEV: update rails tests for new wizard * Remove empty hbs files that were created because of rebase * Fixes for rebase * Fix wizard image link * More rebase fixes * Fix rails tests * FIX: Update preview for new color schemes: (#17481) * UX: make layout more responsive, update images * fix typo * DEV: move discourse logo svg to template only component * DEV: formatting improvements * Remove unneeded files * Add tests for privacy step * Fix banner image height for step "ready" Co-authored-by: Jordan Vidrine <30537603+jordanvidrine@users.noreply.github.com> Co-authored-by: awesomerobot <kris.aubuchon@discourse.org>
60 lines
1.5 KiB
JavaScript
60 lines
1.5 KiB
JavaScript
export default function (helpers) {
|
|
const { parsePostData, response } = helpers;
|
|
|
|
this.get("/wizard.json", () => {
|
|
return response({
|
|
wizard: {
|
|
start: "hello-world",
|
|
completed: true,
|
|
steps: [
|
|
{
|
|
id: "hello-world",
|
|
title: "hello there",
|
|
index: 0,
|
|
description: "hello!",
|
|
fields: [
|
|
{
|
|
id: "full_name",
|
|
type: "text",
|
|
required: true,
|
|
description: "Your name",
|
|
},
|
|
],
|
|
next: "styling",
|
|
},
|
|
{
|
|
id: "styling",
|
|
title: "Second step",
|
|
index: 1,
|
|
fields: [{ id: "some-title", type: "text" }],
|
|
previous: "hello-world",
|
|
next: "last-step",
|
|
},
|
|
{
|
|
id: "last-step",
|
|
index: 2,
|
|
fields: [
|
|
{ id: "snack", type: "dropdown", required: true },
|
|
{ id: "theme-preview", type: "component" },
|
|
{ id: "an-image", type: "image" },
|
|
],
|
|
previous: "styling",
|
|
},
|
|
],
|
|
},
|
|
});
|
|
});
|
|
|
|
this.put("/wizard/steps/:id", (request) => {
|
|
const body = parsePostData(request.requestBody);
|
|
|
|
if (body.fields.full_name === "Server Fail") {
|
|
return response(422, {
|
|
errors: [{ field: "full_name", description: "Invalid name" }],
|
|
});
|
|
} else {
|
|
return response(200, { success: true });
|
|
}
|
|
});
|
|
}
|