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

Extract upsale pages into CustomComponents and render them on individual rails routes instead of Angular

Henriette Darge092d5cd60040
diff --git a/app/controllers/angular_controller.rb b/app/controllers/angular_controller.rb
index 40e623c9027..3ffbaa8afff 100644
--- a/app/controllers/angular_controller.rb
+++ b/app/controllers/angular_controller.rb
@@ -29,7 +29,7 @@
class AngularController < ApplicationController
before_action :require_login
- no_authorization_required! :empty_layout, :notifications_layout
+ no_authorization_required! :empty_layout
def empty_layout
# Frontend will handle rendering
@@ -37,12 +37,6 @@ class AngularController < ApplicationController
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
-
def login_back_url_params
params.permit(:state)
end
diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb
index e2bb53b7e26..742ce9f8e9f 100644
--- a/app/controllers/notifications_controller.rb
+++ b/app/controllers/notifications_controller.rb
@@ -29,18 +29,16 @@
class NotificationsController < ApplicationController
before_action :require_login
before_action :filtered_query, only: :mark_all_read
- no_authorization_required! :index, :split_view, :mark_all_read
+ no_authorization_required! :index, :split_view, :mark_all_read, :date_alerts, :share_upsale
def index
- # Frontend will handle rendering
- # but we will need to render with notification specific layout
- render layout: "angular/notifications"
+ render_notifications_layout
end
def split_view
respond_to do |format|
format.html do
- render :index, layout: "angular/notifications"
+ render :index, layout: "notifications"
end
end
end
@@ -55,10 +53,22 @@ class NotificationsController < ApplicationController
redirect_back fallback_location: notifications_path
end
+ def date_alerts
+ render_notifications_layout
+ end
+
+ def share_upsale
+ render_notifications_layout
+ end
+
private
- def default_breadcrumb
- t("js.notifications.title")
+ def default_breadcrumb; end
+
+ def render_notifications_layout
+ # Frontend will handle rendering
+ # but we will need to render with notification specific layout
+ render layout: "notifications"
end
def filtered_query
diff --git a/app/views/layouts/angular/notifications.html.erb b/app/views/layouts/notifications.html.erb
similarity index 100%
rename from app/views/layouts/angular/notifications.html.erb
rename to app/views/layouts/notifications.html.erb
diff --git a/app/views/notifications/date_alerts.html.erb b/app/views/notifications/date_alerts.html.erb
new file mode 100644
index 00000000000..7bd17ca6e45
--- /dev/null
+++ b/app/views/notifications/date_alerts.html.erb
@@ -0,0 +1,5 @@
+<% html_title t("js.notifications.title") %>
+
+<% content_for :content_body do %>
+ <%= angular_component_tag "opce-ian-date-alerts-upsale" %>
+<% end %>
diff --git a/app/views/notifications/share_upsale.html.erb b/app/views/notifications/share_upsale.html.erb
new file mode 100644
index 00000000000..6b72a636ae6
--- /dev/null
+++ b/app/views/notifications/share_upsale.html.erb
@@ -0,0 +1,5 @@
+<% html_title t("js.notifications.title") %>
+
+<% content_for :content_body do %>
+ <%= angular_component_tag "opce-share-upsale" %>
+<% end %>
diff --git a/config/routes.rb b/config/routes.rb
index 0d82903b420..e5ad775555e 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -723,9 +723,9 @@ Rails.application.routes.draw do
end
scope :notifications do
- get "/share_upsale" => "angular#notifications_layout", as: "notifications_share_upsale"
- get "/date_alerts" => "angular#notifications_layout", as: "notifications_date_alert_upsale"
- get "(/*state)", to: "angular#notifications_layout", as: :notifications_center
+ get "/share_upsale" => "notifications#share_upsale", as: "notifications_share_upsale"
+ get "/date_alerts" => "notifications#date_alerts", as: "notifications_date_alert_upsale"
+ get "/", to: "notifications#index", as: :notifications_center
end
# OAuthClient needs a "callback" URL that Nextcloud calls with a "code" (see OAuth2 RFC)
diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts
index b80abff7fb7..f6b3ac91ba5 100644
--- a/frontend/src/app/app.module.ts
+++ b/frontend/src/app/app.module.ts
@@ -171,6 +171,8 @@ import {
import {
WorkPackageSplitViewEntryComponent,
} from 'core-app/features/work-packages/routing/wp-split-view/wp-split-view-entry.component';
+import { InAppNotificationsDateAlertsUpsaleComponent } from 'core-app/features/in-app-notifications/date-alerts-upsale/ian-date-alerts-upsale.component';
+import { ShareUpsaleComponent } from 'core-app/features/enterprise/share-upsale/share-upsale.component';
export function initializeServices(injector:Injector) {
return () => {
@@ -369,6 +371,8 @@ export class OpenProjectModule {
registerCustomElement('opce-notification-settings', NotificationsSettingsPageComponent, { injector });
registerCustomElement('opce-reminder-settings', ReminderSettingsPageComponent, { injector });
registerCustomElement('opce-notification-center', InAppNotificationCenterComponent, { injector });
+ registerCustomElement('opce-ian-date-alerts-upsale', InAppNotificationsDateAlertsUpsaleComponent, { injector });
+ registerCustomElement('opce-share-upsale', ShareUpsaleComponent, { injector });
registerCustomElement('opce-wp-split-view', WorkPackageSplitViewEntryComponent, { injector });
}
}