Skip to content

Commit

Permalink
Prevent rendering menus when in a global create context
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-contreras committed Jun 16, 2023
1 parent 9a1d4a1 commit 3116e45
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/views/layouts/_common_head.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<% relative_url_root = OpenProject::Configuration['rails_relative_url_root'] || '' %>
<meta name="app_base_path" content="<%= relative_url_root %>"/>
<base href="<%= relative_url_root %>/" />
<% if @project %>
<% if @global_create_context.nil? && @project %>
<meta name="current_project"
data-project-name="<%= h @project.name %>"
data-project-id="<%= @project.id %>"
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/base.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ See COPYRIGHT and LICENSE files for more details.
<op-toasts-container></op-toasts-container>
<op-modal-overlay></op-modal-overlay>
<spot-drop-modal-portal></spot-drop-modal-portal>
<% main_menu = render_main_menu(local_assigns.fetch(:menu_name, nil), @project) %>
<% main_menu = render_main_menu(local_assigns.fetch(:menu_name, nil), @global_create_context.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 %>">
Expand Down
7 changes: 7 additions & 0 deletions modules/meeting/app/controllers/meetings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

class MeetingsController < ApplicationController
around_action :set_time_zone
before_action :set_global_create_context, only: %i[new]
before_action :find_optional_project, only: %i[index new create]
before_action :build_meeting, only: %i[new create]
before_action :find_meeting, except: %i[index new create]
Expand Down Expand Up @@ -124,6 +125,12 @@ def set_time_zone(&)
Time.use_zone(zone, &)
end

def set_global_create_context
if global_create_context?
@global_create_context = true
end
end

def build_meeting
@meeting = Meeting.new
if meeting_params.present?
Expand Down

0 comments on commit 3116e45

Please sign in to comment.