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

Add `calendars#new` and `calendars#create` routes

Aaron Contrerasc8571124e109
diff --git a/modules/calendar/app/controllers/calendar/calendars_controller.rb b/modules/calendar/app/controllers/calendar/calendars_controller.rb
index 7b117921ca4..d1ace74b6ab 100644
--- a/modules/calendar/app/controllers/calendar/calendars_controller.rb
+++ b/modules/calendar/app/controllers/calendar/calendars_controller.rb
@@ -48,6 +48,10 @@ module ::Calendar
render layout: 'angular/angular'
end
+ def new; end
+
+ def create; end
+
def destroy
if @view.destroy
flash[:notice] = t(:notice_successful_delete)
diff --git a/modules/calendar/config/routes.rb b/modules/calendar/config/routes.rb
index 993b095367b..4f9a7307c19 100644
--- a/modules/calendar/config/routes.rb
+++ b/modules/calendar/config/routes.rb
@@ -10,5 +10,5 @@ OpenProject::Application.routes.draw do
end
end
- resources :calendars, only: :index, controller: 'calendar/calendars'
+ resources :calendars, only: %i[index new create], controller: 'calendar/calendars'
end
diff --git a/modules/calendar/spec/routing/calendar_routing_spec.rb b/modules/calendar/spec/routing/calendar_routing_spec.rb
index 3bbd6347ee9..6a82bac7da2 100644
--- a/modules/calendar/spec/routing/calendar_routing_spec.rb
+++ b/modules/calendar/spec/routing/calendar_routing_spec.rb
@@ -47,6 +47,16 @@ RSpec.describe Calendar::CalendarsController do
project_id: '1')
end
+ it do
+ expect(get('/calendars/new')).to route_to(controller: 'calendar/calendars',
+ action: 'new')
+ end
+
+ it do
+ expect(post('/calendars')).to route_to(controller: 'calendar/calendars',
+ action: 'create')
+ end
+
it do
expect(delete('/projects/1/calendars/2')).to route_to(controller: 'calendar/calendars',
action: 'destroy',