Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Create (dummy) submenu for the members page that is rendered via turbo-frame

Henriette Dargea343afde9028
diff --git a/app/controllers/members/menus_controller.rb b/app/controllers/members/menus_controller.rb
new file mode 100644
index 00000000000..398794f557d
--- /dev/null
+++ b/app/controllers/members/menus_controller.rb
@@ -0,0 +1,73 @@
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2023 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+module Members
+ class MenusController < ApplicationController
+ def show
+ @sidebar_menu_items = first_level_menu_items + nested_menu_items
+ render layout: nil
+ end
+
+ def first_level_menu_items
+ [{
+ header: nil,
+ children: [
+ { title: I18n.t('members.menu.all'), href: '' }, # TODO
+ { title: I18n.t('members.menu.locked'), href: '' }, # TODO
+ { title: I18n.t('members.menu.invited'), href: '' } # TODO
+ ]
+ }]
+ end
+
+ def nested_menu_items
+ [{ header: I18n.t('members.menu.project_roles'), children: project_roles_entries },
+ { header: I18n.t('members.menu.wp_shares'), children: permission_menu_entries },
+ { header: I18n.t('members.menu.groups'), children: project_group_entries }]
+ end
+
+ private
+
+ def project_roles_entries
+ # todo
+ [{ title: 'ROLE X', href: '' }]
+ end
+
+ def permission_menu_entries
+ # todo
+ [
+ { title: I18n.t('work_package.sharing.permissions.view'), href: '' },
+ { title: I18n.t('work_package.sharing.permissions.comment'), href: '' },
+ { title: I18n.t('work_package.sharing.permissions.edit'), href: '' }
+ ]
+ end
+
+ def project_group_entries
+ # todo
+ [{ title: 'GROUP X', href: '' }]
+ end
+ end
+end
diff --git a/app/views/members/menus/_menu.html.erb b/app/views/members/menus/_menu.html.erb
new file mode 100644
index 00000000000..e7046ff3b9a
--- /dev/null
+++ b/app/views/members/menus/_menu.html.erb
@@ -0,0 +1,6 @@
+<%= turbo_frame_tag "members_menu",
+ src: project_members_menu_path(@project),
+ target: '_top',
+ data: { turbo: false },
+ loading: :lazy do %>
+<% end %>
diff --git a/app/views/members/menus/show.html.erb b/app/views/members/menus/show.html.erb
new file mode 100644
index 00000000000..b0503447574
--- /dev/null
+++ b/app/views/members/menus/show.html.erb
@@ -0,0 +1,3 @@
+<%= turbo_frame_tag "members_menu" do %>
+ <%= render OpenProject::Common::SubmenuComponent.new(sidebar_menu_items: @sidebar_menu_items) %>
+<% end %>
diff --git a/config/initializers/menus.rb b/config/initializers/menus.rb
index 546bb7b7a6d..c61a9c8f4da 100644
--- a/config/initializers/menus.rb
+++ b/config/initializers/menus.rb
@@ -582,6 +582,12 @@ Redmine::MenuManager.map :project_menu do |menu|
before: :settings,
icon: 'group'
+ menu.push :members_menu,
+ { controller: '/members', action: 'index' },
+ parent: :members,
+ partial: 'members/menus/menu',
+ caption: :label_member_plural
+
menu.push :settings,
{ controller: '/projects/settings/general', action: :show },
caption: :label_project_settings,
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 3929408c187..54aff993b2b 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -313,6 +313,13 @@ en:
no_results_content_text: Add a member to the project
invite_by_mail: "Send invite to %{mail}"
send_invite_to: "Send invite to"
+ menu:
+ all: 'All'
+ invited: 'Invited'
+ locked: 'Locked'
+ project_roles: 'Project roles'
+ wp_shares: 'Work package shares'
+ groups: 'Groups'
my:
access_token:
diff --git a/config/routes.rb b/config/routes.rb
index f59ab05d5db..b4b757a6898 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -294,6 +294,10 @@ OpenProject::Application.routes.draw do
end
end
+ namespace :members do
+ resource :menu
+ end
+
resource :repository, controller: 'repositories', except: [:new] do
# Destroy uses a get request to prompt the user before the actual DELETE request
get :destroy_info