Commit 12f83db6 authored by Tim Zallmann's avatar Tim Zallmann

Remove StartupCSS Checks

Updated for test setup, restructured startup setup

Restructured to have a feature flag in place
for startup_css
parent bf4c9023
...@@ -236,11 +236,11 @@ module ApplicationHelper ...@@ -236,11 +236,11 @@ module ApplicationHelper
end end
def use_startup_css? def use_startup_css?
params[:startup_css] == 'true' || cookies['startup_css'] == 'true' Feature.enabled?(:startup_css)
end end
def stylesheet_link_tag_defer(path) def stylesheet_link_tag_defer(path)
if use_startup_css? if use_startup_css? && !Rails.env.test?
stylesheet_link_tag(path, media: "print") stylesheet_link_tag(path, media: "print")
else else
stylesheet_link_tag(path, media: "all") stylesheet_link_tag(path, media: "all")
......
...@@ -49,9 +49,7 @@ ...@@ -49,9 +49,7 @@
= favicon_link_tag favicon, id: 'favicon', data: { original_href: favicon }, type: 'image/png' = favicon_link_tag favicon, id: 'favicon', data: { original_href: favicon }, type: 'image/png'
- if use_startup_css? = render 'layouts/startup_css'
%style{ type: "text/css" }
= Rails.application.assets_manifest.find_sources('startup/startup-general.css').first.to_s.html_safe
- if user_application_theme == 'gl-dark' - if user_application_theme == 'gl-dark'
= stylesheet_link_tag_defer "application_dark" = stylesheet_link_tag_defer "application_dark"
- else - else
...@@ -61,7 +59,7 @@ ...@@ -61,7 +59,7 @@
= stylesheet_link_tag_defer "highlight/themes/#{user_color_scheme}" = stylesheet_link_tag_defer "highlight/themes/#{user_color_scheme}"
= render 'layouts/startup_css' = render 'layouts/startup_css_activation'
= Gon::Base.render_data(nonce: content_security_policy_nonce) = Gon::Base.render_data(nonce: content_security_policy_nonce)
......
- return unless use_startup_css? - return unless use_startup_css?
= javascript_tag nonce: true do %style{ type: "text/css" }
:plain = Rails.application.assets_manifest.find_sources('startup/startup-general.css').first.to_s.html_safe
document.querySelectorAll('link[media="print"]').forEach(linkTag => {
linkTag.addEventListener('load', function() {this.media='all'}, {once: true});
})
- return unless use_startup_css?
= javascript_tag nonce: true do
:plain
document.querySelectorAll('link[media="print"]').forEach(linkTag => {
linkTag.addEventListener('load', function() {this.media='all'}, {once: true});
})
---
name: startup_css
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/39713
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/238718
group: group::editor
type: development
default_enabled: false
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment