mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Allow plugins to exclude wizard steps (#9275)
This commit is contained in:
committed by
GitHub
parent
0025806b7e
commit
c14f6d4ced
@@ -5,6 +5,8 @@ class Wizard
|
||||
attr_reader :steps, :user
|
||||
attr_accessor :max_topics_to_require_completion
|
||||
|
||||
@@excluded_steps = []
|
||||
|
||||
def initialize(user)
|
||||
@steps = []
|
||||
@user = user
|
||||
@@ -17,6 +19,8 @@ class Wizard
|
||||
end
|
||||
|
||||
def append_step(step)
|
||||
return if @@excluded_steps.include?(step)
|
||||
|
||||
step = create_step(step) if step.is_a?(String)
|
||||
|
||||
yield step if block_given?
|
||||
@@ -36,6 +40,10 @@ class Wizard
|
||||
end
|
||||
end
|
||||
|
||||
def self.exclude_step(step)
|
||||
@@excluded_steps << step
|
||||
end
|
||||
|
||||
def steps_with_fields
|
||||
@steps_with_fields ||= @steps.select(&:has_fields?)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user