ceef3f4bc9
* Re structure builder logic to allow for step conditionality Concerns - Performance. Look at whether the additional build in the steps controller can be reduced - Does not work if applied to the last step. - Certain conditions will not work with the first step(?) - How should this be scoped to known functionality? * Add indexes and conditions to steps and fields * Complete and add spec * Complete backend * Complete step conditionality and field indexing * Fix failing spec * Update coverage * Apply rubocop * Apply prettier * Apply prettier to wizard js * Fix schema issues created in merge * Remove setting label for force_final * Improve client wizard cache naming * Improve steps controller and spec conditionality * Improve final step attribute naming * Fix failing spec * Linting * Add one more final step test * Linting * Fix eslint issues * Apply prettier * Linting, syntax, merge and copy cleanups * Update wizard-admin.scss * Fix template linting * Rubocop fixes
59 Zeilen
1,2 KiB
Ruby
59 Zeilen
1,2 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
class CustomWizard::WizardSerializer < CustomWizard::BasicWizardSerializer
|
|
|
|
attributes :start,
|
|
:background,
|
|
:theme_id,
|
|
:completed,
|
|
:required,
|
|
:permitted,
|
|
:uncategorized_category_id
|
|
|
|
has_many :steps, serializer: ::CustomWizard::StepSerializer, embed: :objects
|
|
has_one :user, serializer: ::BasicUserSerializer, embed: :objects
|
|
has_many :categories, serializer: ::BasicCategorySerializer, embed: :objects
|
|
has_many :groups, serializer: ::BasicGroupSerializer, embed: :objects
|
|
|
|
def completed
|
|
object.completed?
|
|
end
|
|
|
|
def include_completed?
|
|
object.completed? &&
|
|
(!object.respond_to?(:multiple_submissions) || !object.multiple_submissions) &&
|
|
!scope.is_admin?
|
|
end
|
|
|
|
def permitted
|
|
object.permitted?
|
|
end
|
|
|
|
def start
|
|
object.start
|
|
end
|
|
|
|
def include_start?
|
|
include_steps? && object.start.present?
|
|
end
|
|
|
|
def include_steps?
|
|
!include_completed?
|
|
end
|
|
|
|
def include_categories?
|
|
object.needs_categories
|
|
end
|
|
|
|
def include_groups?
|
|
object.needs_groups
|
|
end
|
|
|
|
def uncategorized_category_id
|
|
SiteSetting.uncategorized_category_id
|
|
end
|
|
|
|
def include_uncategorized_category_id?
|
|
object.needs_categories
|
|
end
|
|
end
|