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

Re-add global news widget route

Henriette Darge5cab658227e1
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index dcafc202460..0db104a15d0 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -264,6 +264,11 @@ class ApplicationController < ActionController::Base
@project = Project.find(params[:project_id])
end
+ # Find project by project_id if given
+ def find_optional_project
+ @project = Project.find(params[:project_id]) if params[:project_id].present?
+ end
+
# Finds and sets @project based on @object.project
def find_project_from_association
render_404 if @object.blank?
diff --git a/modules/budgets/app/controllers/budgets_controller.rb b/modules/budgets/app/controllers/budgets_controller.rb
index 2e729949eae..11130aa1cd6 100644
--- a/modules/budgets/app/controllers/budgets_controller.rb
+++ b/modules/budgets/app/controllers/budgets_controller.rb
@@ -221,10 +221,6 @@ class BudgetsController < ApplicationController
end
end
- def find_optional_project
- @project = Project.find(params[:project_id]) if params[:project_id].present?
- end
-
def render_item_as_json(element_id, costs, unit, project, permission)
response = {
"#{element_id}_unit_name" => ActionController::Base.helpers.sanitize(unit),
diff --git a/modules/costs/app/controllers/hourly_rates_controller.rb b/modules/costs/app/controllers/hourly_rates_controller.rb
index ae75c8a5f40..fbed7718979 100644
--- a/modules/costs/app/controllers/hourly_rates_controller.rb
+++ b/modules/costs/app/controllers/hourly_rates_controller.rb
@@ -174,10 +174,6 @@ class HourlyRatesController < ApplicationController
@project = Project.find(params[:project_id])
end
- def find_optional_project
- @project = params[:project_id].blank? ? nil : Project.find(params[:project_id])
- end
-
def find_user
@user = params[:id] ? User.find(params[:id]) : User.current
end
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 a098d30861f..1f0c972868f 100644
--- a/modules/grids/app/controllers/grids/base_in_project_controller.rb
+++ b/modules/grids/app/controllers/grids/base_in_project_controller.rb
@@ -1,6 +1,6 @@
module ::Grids
class BaseInProjectController < ::ApplicationController
- before_action :find_project_by_project_id
+ before_action :find_optional_project
before_action :authorize
def show
diff --git a/modules/meeting/app/controllers/recurring_meetings_controller.rb b/modules/meeting/app/controllers/recurring_meetings_controller.rb
index f8d7ae4bb14..592ab364b2f 100644
--- a/modules/meeting/app/controllers/recurring_meetings_controller.rb
+++ b/modules/meeting/app/controllers/recurring_meetings_controller.rb
@@ -309,10 +309,6 @@ class RecurringMeetingsController < ApplicationController
render_400 unless @scheduled_meeting.meeting_id.nil?
end
- def find_optional_project
- @project = Project.find(params[:project_id]) if params[:project_id].present?
- end
-
def find_meeting
@recurring_meeting = RecurringMeeting.visible.find(params[:id])
end
diff --git a/modules/overviews/config/routes.rb b/modules/overviews/config/routes.rb
index ba918c70f4e..b3abccb5a94 100644
--- a/modules/overviews/config/routes.rb
+++ b/modules/overviews/config/routes.rb
@@ -25,6 +25,12 @@ Rails.application.routes.draw do
end
end
+ scope module: "overviews" do
+ namespace :widgets do
+ resource :news, only: %i[show]
+ end
+ end
+
resources :project_phases, controller: "overviews/project_phases", only: %i[edit update] do
put :preview, on: :member
end