+ <% end %>
+ <% end %>
<% end %>
diff --git a/modules/reporting/lib/widget/base.rb b/modules/reporting/lib/widget/base.rb
index 986ceff39187..dd824e757ee3 100644
--- a/modules/reporting/lib/widget/base.rb
+++ b/modules/reporting/lib/widget/base.rb
@@ -93,6 +93,12 @@ def cached?
cache? && Rails.cache.exist?(cache_key)
end
+ protected
+
+ def render_view_component(component, &)
+ component.render_in(controller.view_context, &)
+ end
+
private
def cache?
diff --git a/modules/reporting/lib/widget/settings/fieldset.rb b/modules/reporting/lib/widget/settings/fieldset.rb
index 5a3ba97ffe3c..d817b6a7a585 100644
--- a/modules/reporting/lib/widget/settings/fieldset.rb
+++ b/modules/reporting/lib/widget/settings/fieldset.rb
@@ -36,20 +36,12 @@ def render_with_options(options, &)
super
end
- def render
- hash = self.hash
- write(content_tag(:fieldset,
- id: @id,
- class: "form--fieldset -collapsible") do
- html = content_tag(:legend,
- show_at_id: hash.to_s,
- icon: "#{@type}-legend-icon",
- tooltip: "#{@type}-legend-tip",
- class: "form--fieldset-legend",
- id: hash.to_s) do
- content_tag(:a, href: "#") { I18n.t(@label) }
- end
- html + yield
- end)
+ def render(&)
+ write(
+ render_view_component Primer::OpenProject::CollapsibleSection.new(id: @id, display: :block, mb: 3) do |section|
+ section.with_title_content(I18n.t(@label))
+ section.with_collapsible_content(&)
+ end
+ )
end
end
diff --git a/spec/features/global_roles/global_role_crud_spec.rb b/spec/features/global_roles/global_role_crud_spec.rb
index d22a9e4c6ebf..575705a53f75 100644
--- a/spec/features/global_roles/global_role_crud_spec.rb
+++ b/spec/features/global_roles/global_role_crud_spec.rb
@@ -45,14 +45,16 @@
it "can create global role with that perm" do
# When I go to the new page of "Role"
visit new_role_path
- # Then I should not see block with "#global_permissions"
- expect(page).to have_no_css(".form--fieldset-legend", text: "GLOBAL")
+
+ expect(page).to have_unchecked_field "Global role"
+ # Then I should not see region with global permissions
+ expect(page).not_to have_region "Global"
# When I check "Global role"
check "Global role"
- # Then I should see block with "#global_permissions"
- expect(page).to have_css(".form--fieldset-legend", text: "GLOBAL")
+ # Then I should see region with global permissions
+ expect(page).to have_region "Global"
# And I should see "Global group"
- expect(page).to have_text "GLOBAL GROUP"
+ expect(page).to have_region "Global group"
# And I should see "Glob test"
expect(page).to have_text "Glob test"
# And I should not see "Issues can be assigned to this role"