mirror of
https://github.com/discourse/discourse.git
synced 2024-12-01 13:09:33 -06:00
fc296b9a81
What this change? We are currently not fully satisfied with the current way to edit the categories and tags that appears in the sidebar where the user is redirected to the tracking preferences tab in the user's profile causing the user to lose context of the current page. In addition, the dropdown to select categories or tags limits the amount of information we can display. Since editing or adding a custom categories section is already using a modal, we have decided to switch editing the categories and tags that appear in the sidebar to use a modal as well. This commit ships a first pass of the edit categories modal such that we can keep the commit small and reviewable. The incomplete nature of the feature is also reflected in the fact that the feature is hidden behind a new `new_edit_sidebar_categories_tags_interface_groups` site setting.
45 lines
1.3 KiB
Ruby
45 lines
1.3 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
Fabricator(:category) do
|
|
name { sequence(:name) { |n| "Amazing Category #{n}" } }
|
|
skip_category_definition true
|
|
color { SecureRandom.hex(3) }
|
|
user
|
|
end
|
|
|
|
Fabricator(:category_with_definition, from: :category) { skip_category_definition false }
|
|
|
|
Fabricator(:category_with_group_and_permission, from: :category) do
|
|
transient :group
|
|
transient :permission_type
|
|
|
|
name { sequence(:name) { |n| "Private Category #{n}" } }
|
|
slug { sequence(:slug) { |n| "private#{n}" } }
|
|
user
|
|
|
|
after_build do |cat, transients|
|
|
cat.category_groups.build(
|
|
group_id: transients[:group].id,
|
|
permission_type: transients[:permission_type] || CategoryGroup.permission_types[:full],
|
|
)
|
|
end
|
|
end
|
|
|
|
Fabricator(:private_category, from: :category_with_group_and_permission) do
|
|
after_build { |cat, transients| cat.update!(read_restricted: true) }
|
|
end
|
|
|
|
Fabricator(:private_category_with_definition, from: :private_category) do
|
|
skip_category_definition false
|
|
end
|
|
|
|
Fabricator(:link_category, from: :category) do
|
|
before_create { |category, transients| category.topic_featured_link_allowed = true }
|
|
end
|
|
|
|
Fabricator(:mailinglist_mirror_category, from: :category) do
|
|
email_in "list@example.com"
|
|
email_in_allow_strangers true
|
|
mailinglist_mirror true
|
|
end
|