diff options
Diffstat (limited to 'app/views/layouts')
-rw-r--r-- | app/views/layouts/_theme.html.haml | 14 | ||||
-rw-r--r-- | app/views/layouts/admin.html.haml | 1 | ||||
-rwxr-xr-x | app/views/layouts/application.html.haml | 17 | ||||
-rw-r--r-- | app/views/layouts/auth.html.haml | 3 | ||||
-rw-r--r-- | app/views/layouts/embedded.html.haml | 14 | ||||
-rw-r--r-- | app/views/layouts/error.html.haml | 7 | ||||
-rw-r--r-- | app/views/layouts/mailer.html.haml | 2 | ||||
-rw-r--r-- | app/views/layouts/modal.html.haml | 3 |
8 files changed, 39 insertions, 22 deletions
diff --git a/app/views/layouts/_theme.html.haml b/app/views/layouts/_theme.html.haml new file mode 100644 index 000000000..5dba77621 --- /dev/null +++ b/app/views/layouts/_theme.html.haml @@ -0,0 +1,14 @@ +- if theme + - if theme[:pack] != 'common' && theme[:common] + = render partial: 'layouts/theme', object: theme[:common] + - if theme[:pack] + - pack_path = theme[:flavour] ? "flavours/#{theme[:flavour]}/#{theme[:pack]}" : "core/#{theme[:pack]}" + = javascript_pack_tag pack_path, crossorigin: 'anonymous' + - if theme[:skin] + - if !theme[:flavour] || theme[:skin] == 'default' + = stylesheet_pack_tag pack_path, media: 'all', crossorigin: 'anonymous' + - else + = stylesheet_pack_tag "skins/#{theme[:flavour]}/#{theme[:skin]}/#{theme[:pack]}", media: 'all', crossorigin: 'anonymous' + - if theme[:preload] + - theme[:preload].each do |link| + %link{ href: asset_pack_path("#{link}.js"), crossorigin: 'anonymous', rel: 'preload', as: 'script' }/ diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml index e7a163c92..3048e0e6a 100644 --- a/app/views/layouts/admin.html.haml +++ b/app/views/layouts/admin.html.haml @@ -1,6 +1,5 @@ - content_for :header_tags do = render_initial_state - = javascript_pack_tag 'public', crossorigin: 'anonymous' - content_for :content do .admin-wrapper diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index fb5ba5cb0..d3f1294c6 100755 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -27,18 +27,25 @@ %title= content_for?(:page_title) ? safe_join([yield(:page_title).chomp.html_safe, title], ' - ') : title - = stylesheet_pack_tag 'common', media: 'all', crossorigin: 'anonymous' - = stylesheet_pack_tag current_theme, media: 'all', crossorigin: 'anonymous' - = javascript_pack_tag 'common', crossorigin: 'anonymous' - = javascript_pack_tag "locale_#{I18n.locale}", crossorigin: 'anonymous' + = javascript_pack_tag "locales", crossorigin: 'anonymous' + - if @theme + - if @theme[:supported_locales].include? I18n.locale.to_s + = javascript_pack_tag "locales/#{@theme[:flavour]}/#{I18n.locale}", crossorigin: 'anonymous' + - elsif @theme[:supported_locales].include? 'en' + = javascript_pack_tag "locales/#{@theme[:flavour]}/en", crossorigin: 'anonymous' = csrf_meta_tags %meta{ name: 'style-nonce', content: request.content_security_policy_nonce } = stylesheet_link_tag '/inert.css', skip_pipeline: true, media: 'all', id: 'inert-style' - = stylesheet_link_tag custom_css_path, skip_pipeline: true, host: root_url, media: 'all' = yield :header_tags + -# These must come after :header_tags to ensure our initial state has been defined. + = render partial: 'layouts/theme', object: @core + = render partial: 'layouts/theme', object: @theme + + = stylesheet_link_tag custom_css_path, skip_pipeline: true, host: root_url, media: 'all' + %body{ class: body_classes } = content_for?(:content) ? yield(:content) : yield diff --git a/app/views/layouts/auth.html.haml b/app/views/layouts/auth.html.haml index 6096eada4..34f6b38ec 100644 --- a/app/views/layouts/auth.html.haml +++ b/app/views/layouts/auth.html.haml @@ -1,6 +1,3 @@ -- content_for :header_tags do - = javascript_pack_tag 'public', crossorigin: 'anonymous' - - content_for :content do .container-alt .logo-container diff --git a/app/views/layouts/embedded.html.haml b/app/views/layouts/embedded.html.haml index e74bff9cc..b8817d566 100644 --- a/app/views/layouts/embedded.html.haml +++ b/app/views/layouts/embedded.html.haml @@ -11,12 +11,16 @@ - if storage_host? %link{ rel: 'dns-prefetch', href: storage_host }/ - = stylesheet_pack_tag 'common', media: 'all', crossorigin: 'anonymous' - = stylesheet_pack_tag Setting.default_settings['theme'], media: 'all', crossorigin: 'anonymous' - = javascript_pack_tag 'common', integrity: true, crossorigin: 'anonymous' - = javascript_pack_tag "locale_#{I18n.locale}", integrity: true, crossorigin: 'anonymous' = render_initial_state - = javascript_pack_tag 'public', integrity: true, crossorigin: 'anonymous' + = javascript_pack_tag "locales", crossorigin: 'anonymous' + - if @theme + - if @theme[:supported_locales].include? I18n.locale.to_s + = javascript_pack_tag "locales/#{@theme[:flavour]}/#{I18n.locale}", crossorigin: 'anonymous' + - elsif @theme[:supported_locales].include? 'en' + = javascript_pack_tag "locales/#{@theme[:flavour]}/en", crossorigin: 'anonymous' + = render partial: 'layouts/theme', object: @core + = render partial: 'layouts/theme', object: @theme + %body.embed = yield diff --git a/app/views/layouts/error.html.haml b/app/views/layouts/error.html.haml index 852a0c69b..55da5de3f 100644 --- a/app/views/layouts/error.html.haml +++ b/app/views/layouts/error.html.haml @@ -5,10 +5,9 @@ %meta{ charset: 'utf-8' }/ %title= safe_join([yield(:page_title), Setting.default_settings['site_title']], ' - ') %meta{ content: 'width=device-width,initial-scale=1', name: 'viewport' }/ - = stylesheet_pack_tag 'common', media: 'all', crossorigin: 'anonymous' - = stylesheet_pack_tag Setting.default_settings['theme'], media: 'all', crossorigin: 'anonymous' - = javascript_pack_tag 'common', crossorigin: 'anonymous' - = javascript_pack_tag 'error', crossorigin: 'anonymous' + = javascript_pack_tag "locales", crossorigin: 'anonymous' + = render partial: 'layouts/theme', object: (@core || { pack: 'common' }) + = render partial: 'layouts/theme', object: (@theme || { pack: 'error', flavour: 'glitch', common: { pack: 'common', flavour: 'glitch', skin: 'default' } }) %body.error .dialog .dialog__illustration diff --git a/app/views/layouts/mailer.html.haml b/app/views/layouts/mailer.html.haml index f26de8d99..d02454fc9 100644 --- a/app/views/layouts/mailer.html.haml +++ b/app/views/layouts/mailer.html.haml @@ -6,7 +6,7 @@ %title/ - = stylesheet_pack_tag 'mailer' + = stylesheet_pack_tag 'core/mailer' %body{ dir: locale_direction } %table.email-table{ cellspacing: 0, cellpadding: 0 } %tbody diff --git a/app/views/layouts/modal.html.haml b/app/views/layouts/modal.html.haml index c0ea211ff..dee7c63d9 100644 --- a/app/views/layouts/modal.html.haml +++ b/app/views/layouts/modal.html.haml @@ -1,6 +1,3 @@ -- content_for :header_tags do - = javascript_pack_tag 'public', crossorigin: 'anonymous' - - content_for :content do - if user_signed_in? && !@hide_header .account-header |