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

Show a custom sidebar on the notifications page. (Currently this is just the WP query sidebar as a placeholder. This will be replaced later.)

Henriette Darge2282f0ef2bc8
diff --git a/app/controllers/angular_controller.rb b/app/controllers/angular_controller.rb
index 131a858184f..ab376188bb6 100644
--- a/app/controllers/angular_controller.rb
+++ b/app/controllers/angular_controller.rb
@@ -34,6 +34,12 @@ class AngularController < ApplicationController
def empty_layout
# Frontend will handle rendering
# but we will need to render with layout
- render html: '', layout: 'angular'
+ render html: '', layout: 'angular/angular'
+ end
+
+ def notifications_layout
+ # Frontend will handle rendering
+ # but we will need to render with notification specific layout
+ render html: '', layout: 'angular/notifications'
end
end
diff --git a/app/controllers/api_docs_controller.rb b/app/controllers/api_docs_controller.rb
index d6767e3c44e..6a68efbe970 100644
--- a/app/controllers/api_docs_controller.rb
+++ b/app/controllers/api_docs_controller.rb
@@ -34,6 +34,6 @@ class APIDocsController < ApplicationController
def index
render_404 unless Setting.apiv3_docs_enabled?
- render layout: 'angular', inline: ''
+ render layout: 'angular/angular', inline: ''
end
end
diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb
index 8052b5d6902..2c13de152ac 100644
--- a/app/controllers/my_controller.rb
+++ b/app/controllers/my_controller.rb
@@ -84,7 +84,7 @@ class MyController < ApplicationController
# Configure user's mail notifications
def notifications
render html: '',
- layout: 'angular',
+ layout: 'angular/angular',
locals: { menu_name: :my_menu }
end
diff --git a/app/controllers/work_packages/calendars_controller.rb b/app/controllers/work_packages/calendars_controller.rb
index ffcc6b3dde8..f46ae172175 100644
--- a/app/controllers/work_packages/calendars_controller.rb
+++ b/app/controllers/work_packages/calendars_controller.rb
@@ -33,6 +33,6 @@ class WorkPackages::CalendarsController < ApplicationController
before_action :find_optional_project
def index
- render layout: 'angular'
+ render layout: 'angular/angular'
end
end
diff --git a/app/controllers/work_packages_controller.rb b/app/controllers/work_packages_controller.rb
index 936bd4a5f0a..d447d85db8c 100644
--- a/app/controllers/work_packages_controller.rb
+++ b/app/controllers/work_packages_controller.rb
@@ -46,7 +46,9 @@ class WorkPackagesController < ApplicationController
def show
respond_to do |format|
format.html do
- render :show, locals: { work_package: work_package, menu_name: project_or_wp_query_menu }, layout: 'angular'
+ render :show,
+ locals: { work_package: work_package, menu_name: project_or_wp_query_menu },
+ layout: 'angular/angular'
end
format.any(*WorkPackage::Exporter.single_formats) do
@@ -66,8 +68,9 @@ class WorkPackagesController < ApplicationController
def index
respond_to do |format|
format.html do
- render :index, locals: { query: @query, project: @project, menu_name: project_or_wp_query_menu },
- layout: 'angular'
+ render :index,
+ locals: { query: @query, project: @project, menu_name: project_or_wp_query_menu },
+ layout: 'angular/angular'
end
format.any(*WorkPackage::Exporter.list_formats) do
diff --git a/app/views/layouts/angular.html.erb b/app/views/layouts/angular/angular.html.erb
similarity index 100%
rename from app/views/layouts/angular.html.erb
rename to app/views/layouts/angular/angular.html.erb
diff --git a/app/views/layouts/angular/notifications.html.erb b/app/views/layouts/angular/notifications.html.erb
new file mode 100644
index 00000000000..f6f6a4f2689
--- /dev/null
+++ b/app/views/layouts/angular/notifications.html.erb
@@ -0,0 +1,40 @@
+<%#-- copyright
+OpenProject is an open source project management software.
+Copyright (C) 2012-2021 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 docs/COPYRIGHT.rdoc for more details.
+
+++#%>
+
+<%= content_for :header_tags do %>
+ <%= nonced_javascript_tag do %>
+ <%= include_gon(need_tag: false) -%>
+ <% end %>
+<% end -%>
+
+<%= content_for :content_body do %>
+ <openproject-base></openproject-base>
+<% end -%>
+
+<%= render template: "layouts/base", locals: local_assigns.merge({ menu_name: :notifications_menu }) %>
diff --git a/config/initializers/menus.rb b/config/initializers/menus.rb
index b5db92a8102..b2cb30af33d 100644
--- a/config/initializers/menus.rb
+++ b/config/initializers/menus.rb
@@ -115,6 +115,12 @@ Redmine::MenuManager.map :application_menu do |menu|
last: true
end
+Redmine::MenuManager.map :notifications_menu do |menu|
+ menu.push :work_packages_query_select,
+ { controller: '/work_packages', action: 'index' },
+ partial: 'work_packages/menu_query_select'
+end
+
Redmine::MenuManager.map :my_menu do |menu|
menu_push = menu.push :account,
{ controller: '/my', action: 'account' },
diff --git a/config/routes.rb b/config/routes.rb
index 932b06c875d..56ef71138d4 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -576,7 +576,7 @@ OpenProject::Application.routes.draw do
root to: 'account#login'
scope :notifications do
- get '(/*state)', to: 'angular#empty_layout', as: :notifications_center
+ get '(/*state)', to: 'angular#notifications_layout', as: :notifications_center
end
# Development route for styleguide
diff --git a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.ts b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.ts
index db1cb1f8f13..7a12cfa829a 100644
--- a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.ts
+++ b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.ts
@@ -30,8 +30,6 @@ export class InAppNotificationCenterComponent implements OnInit {
map((items) => Object.values(items)),
);
- notificationsCount$ = this.ianQuery.selectCount();
-
hasNotifications$ = this.ianQuery.hasNotifications$;
hasMoreThanPageSize$ = this.ianQuery.hasMoreThanPageSize$;
diff --git a/modules/boards/app/controllers/boards/boards_controller.rb b/modules/boards/app/controllers/boards/boards_controller.rb
index 1a1947be925..7399425a4f7 100644
--- a/modules/boards/app/controllers/boards/boards_controller.rb
+++ b/modules/boards/app/controllers/boards/boards_controller.rb
@@ -10,7 +10,7 @@ module ::Boards
menu_item :board_view
def index
- render layout: 'angular'
+ render layout: 'angular/angular'
end
current_menu_item :index do
diff --git a/modules/grids/app/controllers/grids/base_in_project_controller.rb b/modules/grids/app/controllers/grids/base_in_project_controller.rb
index 0a10e6ff760..1458a8b8b55 100644
--- a/modules/grids/app/controllers/grids/base_in_project_controller.rb
+++ b/modules/grids/app/controllers/grids/base_in_project_controller.rb
@@ -4,7 +4,7 @@ module ::Grids
before_action :authorize
def show
- render layout: 'angular'
+ render layout: 'angular/angular'
end
end
end