mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 00:37:44 +08:00
DEV: Update member access wizard step to use toggle group (#28013)
We want to change the design of the "member experience" step of the wizard from using checkbox switches to using radio toggle groups.
This commit is contained in:
@ -59,41 +59,38 @@ class Wizard
|
||||
|
||||
@wizard.append_step("privacy") do |step|
|
||||
step.emoji = "hugs"
|
||||
|
||||
step.add_field(
|
||||
id: "login_required",
|
||||
type: "checkbox",
|
||||
icon: "unlock",
|
||||
value: SiteSetting.login_required,
|
||||
)
|
||||
type: "radio",
|
||||
value: SiteSetting.login_required ? "private" : "public",
|
||||
) do |field|
|
||||
field.add_choice("public")
|
||||
field.add_choice("private")
|
||||
end
|
||||
|
||||
step.add_field(
|
||||
id: "invite_only",
|
||||
type: "checkbox",
|
||||
icon: "user-plus",
|
||||
value: SiteSetting.invite_only,
|
||||
)
|
||||
type: "radio",
|
||||
value: SiteSetting.invite_only ? "invite_only" : "sign_up",
|
||||
) do |field|
|
||||
field.add_choice("sign_up", icon: "user-plus")
|
||||
field.add_choice("invite_only", icon: "paper-plane")
|
||||
end
|
||||
|
||||
step.add_field(
|
||||
id: "must_approve_users",
|
||||
type: "checkbox",
|
||||
icon: "user-shield",
|
||||
value: SiteSetting.must_approve_users,
|
||||
)
|
||||
|
||||
if defined?(::Chat)
|
||||
step.add_field(
|
||||
id: "chat_enabled",
|
||||
type: "checkbox",
|
||||
icon: "d-chat",
|
||||
value: SiteSetting.chat_enabled,
|
||||
)
|
||||
type: "radio",
|
||||
value: SiteSetting.must_approve_users ? "yes" : "no",
|
||||
) do |field|
|
||||
field.add_choice("no")
|
||||
field.add_choice("yes")
|
||||
end
|
||||
|
||||
step.on_update do |updater|
|
||||
updater.update_setting(:login_required, updater.fields[:login_required])
|
||||
updater.update_setting(:invite_only, updater.fields[:invite_only])
|
||||
updater.update_setting(:must_approve_users, updater.fields[:must_approve_users])
|
||||
updater.update_setting(:chat_enabled, updater.fields[:chat_enabled]) if defined?(::Chat)
|
||||
updater.update_setting(:login_required, updater.fields[:login_required] == "private")
|
||||
updater.update_setting(:invite_only, updater.fields[:invite_only] == "invite_only")
|
||||
updater.update_setting(:must_approve_users, updater.fields[:must_approve_users] == "yes")
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user