Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-30 04:30:29 +01:00
51553bc71d
* DEV: validate liquid templates on wizard save * minor fix * code improvements and spec * version bump * fixed failing specs * FIX: handle displaying backend validation errors on frontend * fixed linting * improved error display * validate raw description for steps * refactor conditional * Identify attribute with liquid template error and pass syntax error Co-authored-by: angusmcleod <angus@mcleod.org.au> Co-authored-by: Angus McLeod <angusmcleod@users.noreply.github.com>
586 Zeilen
14 KiB
JSON
586 Zeilen
14 KiB
JSON
{
|
|
"id": "super_mega_fun_wizard",
|
|
"name": "Super Mega Fun Wizard",
|
|
"background": "#333333",
|
|
"save_submissions": true,
|
|
"after_signup": false,
|
|
"prompt_completion": false,
|
|
"theme_id": 2,
|
|
"steps": [
|
|
{
|
|
"id": "step_1",
|
|
"title": "Text",
|
|
"raw_description": "Text inputs!",
|
|
"fields": [
|
|
{
|
|
"id": "step_1_field_1",
|
|
"label": "Text",
|
|
"description": "Text field description.",
|
|
"type": "text",
|
|
"min_length": "3",
|
|
"prefill": [
|
|
{
|
|
"type": "assignment",
|
|
"output": "I am prefilled",
|
|
"output_type": "text",
|
|
"output_connector": "set"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "step_1_field_2",
|
|
"label": "Textarea",
|
|
"type": "textarea",
|
|
"min_length": ""
|
|
},
|
|
{
|
|
"id": "step_1_field_3",
|
|
"label": "Composer",
|
|
"type": "composer"
|
|
},
|
|
{
|
|
"id": "step_1_field_4",
|
|
"label": "I'm only text",
|
|
"description": "",
|
|
"type": "text_only"
|
|
},
|
|
{
|
|
"id": "step_1_field_5",
|
|
"label": "I'm a preview",
|
|
"description": "",
|
|
"type": "composer_preview",
|
|
"preview_template": "w{step_1_field_1}"
|
|
}
|
|
],
|
|
"description": "Text inputs!"
|
|
},
|
|
{
|
|
"id": "step_2",
|
|
"title": "Values",
|
|
"raw_description": "Because I couldn't think of another name for this step :)",
|
|
"fields": [
|
|
{
|
|
"id": "step_2_field_1",
|
|
"label": "Date",
|
|
"type": "date",
|
|
"format": "YYYY-MM-DD"
|
|
},
|
|
{
|
|
"id": "step_2_field_2",
|
|
"label": "Time",
|
|
"type": "time",
|
|
"format": "HH:mm"
|
|
},
|
|
{
|
|
"id": "step_2_field_3",
|
|
"label": "Date & Time",
|
|
"type": "date_time",
|
|
"format": ""
|
|
},
|
|
{
|
|
"id": "step_2_field_4",
|
|
"label": "Number",
|
|
"type": "number"
|
|
},
|
|
{
|
|
"id": "step_2_field_5",
|
|
"label": "Checkbox",
|
|
"type": "checkbox"
|
|
},
|
|
{
|
|
"id": "step_2_field_6",
|
|
"label": "Url",
|
|
"type": "url"
|
|
},
|
|
{
|
|
"id": "step_2_field_7",
|
|
"label": "Upload",
|
|
"type": "upload",
|
|
"file_types": ".jpg,.jpeg,.png"
|
|
}
|
|
],
|
|
"description": "Because I couldn't think of another name for this step :)"
|
|
},
|
|
{
|
|
"id": "step_3",
|
|
"title": "Combo-boxes",
|
|
"raw_description": "Unfortunately not the edible type :sushi: ",
|
|
"fields": [
|
|
{
|
|
"id": "step_3_field_1",
|
|
"label": "Custom Dropdown",
|
|
"type": "dropdown",
|
|
"content": [
|
|
{
|
|
"type": "association",
|
|
"pairs": [
|
|
{
|
|
"index": 0,
|
|
"key": "choice1",
|
|
"key_type": "text",
|
|
"value": "Choice 1",
|
|
"value_type": "text",
|
|
"connector": "equal"
|
|
},
|
|
{
|
|
"index": 1,
|
|
"key": "choice2",
|
|
"key_type": "text",
|
|
"value": "Choice 2",
|
|
"value_type": "text",
|
|
"connector": "association"
|
|
},
|
|
{
|
|
"index": 2,
|
|
"key": "choice3",
|
|
"key_type": "text",
|
|
"value": "Choice 3",
|
|
"value_type": "text",
|
|
"connector": "association"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "step_3_field_2",
|
|
"label": "Tag",
|
|
"type": "tag"
|
|
},
|
|
{
|
|
"id": "step_3_field_3",
|
|
"label": "Category",
|
|
"type": "category",
|
|
"limit": 1,
|
|
"property": "id"
|
|
},
|
|
{
|
|
"id": "step_3_field_4",
|
|
"label": "Group",
|
|
"type": "group"
|
|
},
|
|
{
|
|
"id": "step_3_field_5",
|
|
"label": "User Selector",
|
|
"description": "",
|
|
"type": "user_selector"
|
|
},
|
|
{
|
|
"id": "step_3_field_6",
|
|
"label": "Conditional User Selector",
|
|
"description": "Shown when checkbox in step_2_field_5 is true",
|
|
"type": "user_selector"
|
|
}
|
|
],
|
|
"description": "Unfortunately not the edible type :sushi: "
|
|
}
|
|
],
|
|
"actions": [
|
|
{
|
|
"id": "action_9",
|
|
"run_after": "step_1",
|
|
"type": "create_group",
|
|
"title": [
|
|
{
|
|
"type": "assignment",
|
|
"output": "New Group Member",
|
|
"output_type": "text",
|
|
"output_connector": "set"
|
|
}
|
|
],
|
|
"custom_fields": [
|
|
{
|
|
"type": "association",
|
|
"pairs": [
|
|
{
|
|
"index": 0,
|
|
"key": "group_custom_field",
|
|
"key_type": "text",
|
|
"value": "step_3_field_1",
|
|
"value_type": "wizard_field",
|
|
"connector": "association"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"name": [
|
|
{
|
|
"type": "assignment",
|
|
"output": "step_1_field_1",
|
|
"output_type": "wizard_field",
|
|
"output_connector": "set"
|
|
}
|
|
],
|
|
"full_name": [
|
|
{
|
|
"type": "assignment",
|
|
"output": "step_1_field_1",
|
|
"output_type": "wizard_field",
|
|
"output_connector": "set"
|
|
}
|
|
],
|
|
"usernames": [
|
|
{
|
|
"type": "assignment",
|
|
"output_type": "user",
|
|
"output_connector": "set",
|
|
"output": [
|
|
"angus1"
|
|
]
|
|
}
|
|
],
|
|
"owner_usernames": [
|
|
{
|
|
"type": "assignment",
|
|
"output_type": "user",
|
|
"output_connector": "set",
|
|
"output": [
|
|
"angus"
|
|
]
|
|
}
|
|
],
|
|
"grant_trust_level": [
|
|
{
|
|
"type": "assignment",
|
|
"output": "3",
|
|
"output_type": "text",
|
|
"output_connector": "set"
|
|
}
|
|
],
|
|
"mentionable_level": [
|
|
{
|
|
"type": "assignment",
|
|
"output": "1",
|
|
"output_type": "text",
|
|
"output_connector": "set"
|
|
}
|
|
],
|
|
"messageable_level": [
|
|
{
|
|
"type": "assignment",
|
|
"output": "2",
|
|
"output_type": "text",
|
|
"output_connector": "set"
|
|
}
|
|
],
|
|
"visibility_level": [
|
|
{
|
|
"type": "assignment",
|
|
"output": "3",
|
|
"output_type": "text",
|
|
"output_connector": "set"
|
|
}
|
|
],
|
|
"members_visibility_level": [
|
|
{
|
|
"type": "assignment",
|
|
"output": "99",
|
|
"output_type": "text",
|
|
"output_connector": "set"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "action_6",
|
|
"run_after": "step_1",
|
|
"type": "add_to_group",
|
|
"group": [
|
|
{
|
|
"type": "assignment",
|
|
"output": "action_9",
|
|
"output_type": "wizard_action",
|
|
"output_connector": "set"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "action_8",
|
|
"run_after": "step_1",
|
|
"type": "create_category",
|
|
"custom_fields": [
|
|
{
|
|
"type": "association",
|
|
"pairs": [
|
|
{
|
|
"index": 0,
|
|
"key": "category_custom_field",
|
|
"key_type": "text",
|
|
"value": "CC Val",
|
|
"value_type": "text",
|
|
"connector": "association"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"name": [
|
|
{
|
|
"type": "assignment",
|
|
"output": "step_1_field_1",
|
|
"output_type": "wizard_field",
|
|
"output_connector": "set"
|
|
}
|
|
],
|
|
"slug": [
|
|
{
|
|
"type": "assignment",
|
|
"output": "step_1_field_1",
|
|
"output_type": "wizard_field",
|
|
"output_connector": "set"
|
|
}
|
|
],
|
|
"permissions": [
|
|
{
|
|
"type": "association",
|
|
"pairs": [
|
|
{
|
|
"index": 0,
|
|
"key": "action_9",
|
|
"key_type": "wizard_action",
|
|
"value": "2",
|
|
"value_type": "text",
|
|
"connector": "association"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "action_5",
|
|
"run_after": "step_1",
|
|
"type": "watch_categories",
|
|
"notification_level": "tracking",
|
|
"wizard_user": true,
|
|
"categories": [
|
|
{
|
|
"type": "assignment",
|
|
"output": "action_8",
|
|
"output_type": "wizard_action",
|
|
"output_connector": "set"
|
|
}
|
|
],
|
|
"mute_remainder": [
|
|
{
|
|
"type": "assignment",
|
|
"output": "true",
|
|
"output_type": "text",
|
|
"output_connector": "set"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "action_1",
|
|
"run_after": "step_3",
|
|
"type": "create_topic",
|
|
"skip_redirect": true,
|
|
"post": "step_1_field_2",
|
|
"title": [
|
|
{
|
|
"type": "assignment",
|
|
"output": "step_1_field_1",
|
|
"output_type": "wizard_field",
|
|
"output_connector": "set"
|
|
}
|
|
],
|
|
"category": [
|
|
{
|
|
"type": "assignment",
|
|
"output": "step_3_field_3",
|
|
"output_type": "wizard_field",
|
|
"output_connector": "set"
|
|
}
|
|
],
|
|
"tags": [
|
|
{
|
|
"type": "assignment",
|
|
"output": "step_3_field_2",
|
|
"output_type": "wizard_field",
|
|
"output_connector": "set"
|
|
}
|
|
],
|
|
"custom_fields": [
|
|
{
|
|
"type": "association",
|
|
"pairs": [
|
|
{
|
|
"index": 0,
|
|
"key": "post_field",
|
|
"key_type": "text",
|
|
"value": "Post custom field value",
|
|
"value_type": "text",
|
|
"connector": "association"
|
|
},
|
|
{
|
|
"index": 1,
|
|
"key": "topic.topic_field",
|
|
"key_type": "text",
|
|
"value": "Topic custom field value",
|
|
"value_type": "text",
|
|
"connector": "association"
|
|
},
|
|
{
|
|
"index": 2,
|
|
"key": "topic.topic_json_field{}.key_1",
|
|
"key_type": "text",
|
|
"value": "Key 1 value",
|
|
"value_type": "text",
|
|
"connector": "association"
|
|
},
|
|
{
|
|
"index": 3,
|
|
"key": "topic.topic_json_field{}.key_2",
|
|
"key_type": "text",
|
|
"value": "Key 2 value",
|
|
"value_type": "text",
|
|
"connector": "association"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"visible": [
|
|
{
|
|
"type": "conditional",
|
|
"output": "true",
|
|
"output_type": "text",
|
|
"output_connector": "then",
|
|
"pairs": [
|
|
{
|
|
"index": 0,
|
|
"key": "name",
|
|
"key_type": "user_field",
|
|
"value": "Angus",
|
|
"value_type": "text",
|
|
"connector": "equal"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "action_4",
|
|
"run_after": "step_2",
|
|
"type": "update_profile",
|
|
"profile_updates": [
|
|
{
|
|
"type": "association",
|
|
"pairs": [
|
|
{
|
|
"index": 0,
|
|
"key": "profile_background",
|
|
"key_type": "user_field",
|
|
"value": "step_2_field_7",
|
|
"value_type": "wizard_field",
|
|
"connector": "association"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "action_2",
|
|
"run_after": "step_2",
|
|
"type": "send_message",
|
|
"post_builder": true,
|
|
"post_template": "I will interpolate some wizard fields w{step_1_field_1} w{step_1_field_2}",
|
|
"title": [
|
|
{
|
|
"type": "assignment",
|
|
"output": "Message title",
|
|
"output_type": "text",
|
|
"output_connector": "set"
|
|
}
|
|
],
|
|
"recipient": [
|
|
{
|
|
"type": "assignment",
|
|
"output_type": "user",
|
|
"output_connector": "set",
|
|
"output": [
|
|
"angus1"
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "action_11",
|
|
"run_after": "step_2",
|
|
"type": "send_message",
|
|
"post_builder": true,
|
|
"post_template": "I will interpolate some wizard fields w{step_1_field_1} w{step_1_field_2}",
|
|
"title": [
|
|
{
|
|
"type": "assignment",
|
|
"output": "Multiple Recipients title",
|
|
"output_type": "text",
|
|
"output_connector": "set"
|
|
}
|
|
],
|
|
"recipient": [
|
|
{
|
|
"type": "assignment",
|
|
"output_type": "user",
|
|
"output_connector": "set",
|
|
"output": [
|
|
"angus1",
|
|
"faiz",
|
|
"cool_group",
|
|
"cool_group_1"
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "action_3",
|
|
"run_after": "step_2",
|
|
"type": "open_composer",
|
|
"post_builder": true,
|
|
"post_template": "I am interpolating some user fields u{name} u{username} u{email}",
|
|
"title": [
|
|
{
|
|
"type": "assignment",
|
|
"output": "Title of the composer topic",
|
|
"output_type": "text",
|
|
"output_connector": "set"
|
|
}
|
|
],
|
|
"category": [
|
|
{
|
|
"type": "assignment",
|
|
"output": "action_8",
|
|
"output_type": "wizard_action",
|
|
"output_connector": "set",
|
|
"pairs": [
|
|
{
|
|
"index": 0,
|
|
"key": "step_2_field_5",
|
|
"key_type": "wizard_field",
|
|
"value": "true",
|
|
"value_type": "text",
|
|
"connector": "is"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"tags": [
|
|
{
|
|
"type": "assignment",
|
|
"output": "tag1",
|
|
"output_type": "text",
|
|
"output_connector": "set"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "action_10",
|
|
"run_after": "step_3",
|
|
"type": "route_to",
|
|
"url": [
|
|
{
|
|
"type": "assignment",
|
|
"output": "https://google.com",
|
|
"output_type": "text",
|
|
"output_connector": "set"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|