Skip to content

Commit

Permalink
enable morphing for turbo drive - hacky
Browse files Browse the repository at this point in the history
  • Loading branch information
ulferts committed Dec 5, 2024
1 parent 847fce5 commit 7b8e8cc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ def locale_first_week_of_year
# To avoid the menu flickering, disable it
# by default unless we're in test mode
def initial_menu_styles(side_displayed)
Rails.env.test? || !side_displayed ? "" : "display:none"
Rails.env.test? || request.headers["Accept"].include?("text/vnd.turbo-stream.html") || !side_displayed ? "" : "display:none"
end

def initial_menu_classes(side_displayed, show_decoration)
Expand Down
13 changes: 8 additions & 5 deletions app/views/layouts/base.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ See COPYRIGHT and LICENSE files for more details.
<meta name="current_menu_item" content="<%= current_menu_item %>"/>
<%# Disable prefetching for now %>
<meta name="turbo-prefetch" content="false">
<meta name="turbo-refresh-method" content="morph">
<meta name="turbo-refresh-scroll" content="preserve">
</head>
<%= content_tag :body,
class: "#{body_css_classes} __overflowing_element_container __overflowing_body",
Expand All @@ -57,15 +59,16 @@ See COPYRIGHT and LICENSE files for more details.
</p>
</div>
</noscript>
<opce-toasts-container></opce-toasts-container>
<opce-modal-overlay></opce-modal-overlay>
<opce-spot-drop-modal-portal></opce-spot-drop-modal-portal>
<opce-toasts-container data-turbo-permanent></opce-toasts-container>
<opce-modal-overlay data-turbo-permanent></opce-modal-overlay>
<opce-spot-drop-modal-portal data-turbo-permanent></opce-spot-drop-modal-portal>
<% main_menu = render_main_menu(local_assigns.fetch(:menu_name, nil), @project) %>
<% side_displayed = content_for?(:sidebar) || content_for?(:main_menu) || !main_menu.blank? %>
<% initial_classes = initial_menu_classes(side_displayed, show_decoration) %>
<div id="wrapper" style="<%= initial_menu_styles(side_displayed) %>" class="<%= initial_classes %>">
<% if show_decoration %>
<header class="op-app-header<%= ' op-app-header_development' if OpenProject::Configuration.development_highlight_enabled? %>">
<header class="op-app-header<%= ' op-app-header_development' if OpenProject::Configuration.development_highlight_enabled? %>"
data-turbo-permanent>
<div class="op-app-header--start">
<h1 class="hidden-for-sighted">
<%= t(:label_top_menu) %>
Expand Down Expand Up @@ -95,7 +98,7 @@ See COPYRIGHT and LICENSE files for more details.
class="main-menu"
data-controller="menus--main"
data-application-target="dynamic"
>
data-turbo-permanent>
<h1 class="hidden-for-sighted"><%= t(:label_main_menu) %></h1>
<opce-main-menu-resizer></opce-main-menu-resizer>
<div id="menu-sidebar">
Expand Down

0 comments on commit 7b8e8cc

Please sign in to comment.