mirror of
https://github.com/opf/openproject.git
synced 2026-06-13 19:20:00 +00:00
Create calendar module
This commit is contained in:
@@ -68,6 +68,11 @@ PATH
|
||||
specs:
|
||||
budgets (1.0.0)
|
||||
|
||||
PATH
|
||||
remote: modules/calendar
|
||||
specs:
|
||||
openproject-calendar (1.0.0)
|
||||
|
||||
PATH
|
||||
remote: modules/costs
|
||||
specs:
|
||||
@@ -1040,6 +1045,7 @@ DEPENDENCIES
|
||||
openproject-backlogs!
|
||||
openproject-bim!
|
||||
openproject-boards!
|
||||
openproject-calendar!
|
||||
openproject-documents!
|
||||
openproject-github_integration!
|
||||
openproject-job_status!
|
||||
|
||||
@@ -45,6 +45,7 @@ group :opf_plugins do
|
||||
gem 'overviews', path: 'modules/overviews'
|
||||
gem 'budgets', path: 'modules/budgets'
|
||||
gem 'openproject-team_planner', path: 'modules/team_planner'
|
||||
gem 'openproject-calendar', path: 'modules/calendar'
|
||||
|
||||
gem 'openproject-bim', path: 'modules/bim'
|
||||
end
|
||||
|
||||
@@ -34,5 +34,5 @@ Disallow: <%= project_work_packages_path(p) %>
|
||||
Disallow: <%= project_activity_index_path(p) %>
|
||||
<% end -%>
|
||||
<% end %>
|
||||
Disallow: /work_packages/calendar
|
||||
Disallow: /calendar
|
||||
Disallow: /activity
|
||||
|
||||
@@ -436,11 +436,6 @@ Redmine::MenuManager.map :project_menu do |menu|
|
||||
last: true,
|
||||
caption: :label_all_open_wps
|
||||
|
||||
menu.push :calendar,
|
||||
{ controller: '/work_packages/calendars', action: 'index' },
|
||||
caption: :label_calendar,
|
||||
icon: 'icon2 icon-calendar'
|
||||
|
||||
menu.push :news,
|
||||
{ controller: '/news', action: 'index' },
|
||||
caption: :label_news_plural,
|
||||
|
||||
@@ -344,10 +344,5 @@ OpenProject::AccessControl.map do |map|
|
||||
require: :loggedin
|
||||
end
|
||||
|
||||
map.project_module :calendar, dependencies: :work_package_tracking do |cal|
|
||||
cal.permission :view_calendar,
|
||||
'work_packages/calendars': [:index]
|
||||
end
|
||||
|
||||
map.project_module :activity
|
||||
end
|
||||
|
||||
@@ -29,5 +29,3 @@
|
||||
require Rails.root.join('config/constants/views')
|
||||
|
||||
Constants::Views.add :WorkPackagesTable
|
||||
Constants::Views.add :WorkPackagesCalendar,
|
||||
contract_strategy: 'Views::CalendarStrategy'
|
||||
|
||||
@@ -2266,7 +2266,6 @@ en:
|
||||
permission_select_custom_fields: "Select custom fields"
|
||||
permission_select_project_modules: "Select project modules"
|
||||
permission_manage_types: "Select types"
|
||||
permission_view_calendar: "View calendar"
|
||||
permission_view_changesets: "View repository revisions in OpenProject"
|
||||
permission_view_commit_author_statistics: "View commit author statistics"
|
||||
permission_view_work_package_watchers: "View watchers list"
|
||||
@@ -2306,7 +2305,6 @@ en:
|
||||
|
||||
project_module_activity: "Activity"
|
||||
project_module_forums: "Forums"
|
||||
project_module_calendar: "Calendar"
|
||||
project_module_work_package_tracking: "Work package tracking"
|
||||
project_module_news: "News"
|
||||
project_module_repository: "Repository"
|
||||
|
||||
@@ -256,10 +256,6 @@ OpenProject::Application.routes.draw do
|
||||
# work as a catchall for everything under /wiki
|
||||
get 'wiki' => 'wiki#show'
|
||||
|
||||
namespace :work_packages do
|
||||
resources :calendar, controller: 'calendars', only: [:index]
|
||||
end
|
||||
|
||||
resources :work_packages, only: [] do
|
||||
collection do
|
||||
get '/report/:detail' => 'work_packages/reports#report_details'
|
||||
@@ -437,7 +433,6 @@ OpenProject::Application.routes.draw do
|
||||
|
||||
namespace :work_packages do
|
||||
match 'auto_complete' => 'auto_completes#index', via: %i[get post]
|
||||
resources :calendar, controller: 'calendars', only: [:index]
|
||||
resource :bulk, controller: 'bulk', only: %i[edit update destroy]
|
||||
# FIXME: this is kind of evil!! We need to remove this soonest and
|
||||
# cover the functionality. Route is being used in work-package-service.js:331
|
||||
|
||||
@@ -133,7 +133,7 @@ export class PathHelperService {
|
||||
}
|
||||
|
||||
public projectCalendarPath(projectId:string) {
|
||||
return `${this.projectPath(projectId)}/work_packages/calendar`;
|
||||
return `${this.projectPath(projectId)}/calendar`;
|
||||
}
|
||||
|
||||
public projectMembershipsPath(projectId:string) {
|
||||
|
||||
@@ -106,7 +106,7 @@ module OpenProject::Backlogs
|
||||
:backlogs,
|
||||
{ controller: '/rb_master_backlogs', action: :index },
|
||||
caption: :project_module_backlogs,
|
||||
before: :calendar,
|
||||
after: :work_packages,
|
||||
icon: 'icon2 icon-backlogs'
|
||||
|
||||
menu :project_menu,
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
module ::Calendar
|
||||
class BaseController < ::ApplicationController
|
||||
end
|
||||
end
|
||||
+7
-5
@@ -28,11 +28,13 @@
|
||||
# See COPYRIGHT and LICENSE files for more details.
|
||||
#++
|
||||
|
||||
class WorkPackages::CalendarsController < ApplicationController
|
||||
menu_item :calendar
|
||||
before_action :find_optional_project
|
||||
module ::Calendar
|
||||
class CalendarController < ApplicationController
|
||||
menu_item :calendar
|
||||
before_action :find_optional_project
|
||||
|
||||
def index
|
||||
render layout: 'angular/angular'
|
||||
def index
|
||||
render layout: 'angular/angular'
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
<%=
|
||||
angular_component_tag 'op-view-select',
|
||||
inputs: {
|
||||
projectId: (@project ? @project.id.to_s : ''),
|
||||
menuItems: [parent_name, name],
|
||||
baseRoute: 'work-packages.calendar',
|
||||
viewType: 'WorkPackagesCalendar',
|
||||
}
|
||||
%>
|
||||
@@ -0,0 +1,4 @@
|
||||
# English strings go here
|
||||
en:
|
||||
permission_view_calendar: "View calendar"
|
||||
project_module_calendar_view: "Calendar"
|
||||
@@ -0,0 +1,7 @@
|
||||
OpenProject::Application.routes.draw do
|
||||
scope 'projects/:project_id', as: 'project' do
|
||||
resources :calendar, controller: 'calendar/calendar', only: [:index]
|
||||
end
|
||||
|
||||
resources :calendar, controller: 'calendar/calendar', only: [:index]
|
||||
end
|
||||
@@ -0,0 +1,33 @@
|
||||
#-- 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 COPYRIGHT and LICENSE files for more details.
|
||||
#++
|
||||
|
||||
module OpenProject
|
||||
module Calendar
|
||||
require 'open_project/calendar/engine'
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,54 @@
|
||||
# OpenProject Calendar module
|
||||
#
|
||||
# Copyright (C) 2021 OpenProject GmbH
|
||||
#
|
||||
# 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.
|
||||
|
||||
module OpenProject::Calendar
|
||||
class Engine < ::Rails::Engine
|
||||
engine_name :openproject_calendar
|
||||
|
||||
include OpenProject::Plugins::ActsAsOpEngine
|
||||
|
||||
register 'openproject-calendar',
|
||||
author_url: 'https://www.openproject.org',
|
||||
bundled: true,
|
||||
settings: {},
|
||||
name: 'OpenProject Calendar' do
|
||||
project_module :calendar_view, dependencies: :work_package_tracking do
|
||||
permission :view_calendar,
|
||||
{ 'calendar/calendar': %i[index] }
|
||||
end
|
||||
|
||||
menu :project_menu,
|
||||
:calendar_view,
|
||||
{ controller: '/calendar/calendar', action: 'index' },
|
||||
caption: :label_calendar,
|
||||
icon: 'icon2 icon-calendar',
|
||||
after: :work_packages
|
||||
|
||||
menu :project_menu,
|
||||
:calendar_menu,
|
||||
{ controller: '/calendar/calendar', action: 'index' },
|
||||
parent: :calendar_view,
|
||||
partial: 'calendar/calendar/menu',
|
||||
last: true,
|
||||
caption: :label_calendar
|
||||
end
|
||||
|
||||
add_view :WorkPackagesCalendar,
|
||||
contract_strategy: 'Calendar::Views::ContractStrategy'
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1 @@
|
||||
require 'open_project/calendar'
|
||||
@@ -0,0 +1,13 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
s.name = 'openproject-calendar'
|
||||
s.version = '1.0.0'
|
||||
s.authors = 'OpenProject GmbH'
|
||||
s.email = 'info@openproject.com'
|
||||
s.summary = 'OpenProject Calendar'
|
||||
s.description = 'Provides calendar views'
|
||||
s.license = 'GPLv3'
|
||||
|
||||
s.files = Dir['{app,config,db,lib}/**/*']
|
||||
end
|
||||
+3
-3
@@ -28,7 +28,7 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe WorkPackages::CalendarsController, type: :controller do
|
||||
describe Calendar::CalendarController, type: :controller do
|
||||
let(:project) do
|
||||
FactoryBot.build_stubbed(:project).tap do |p|
|
||||
allow(Project)
|
||||
@@ -42,7 +42,7 @@ describe WorkPackages::CalendarsController, type: :controller do
|
||||
FactoryBot.build_stubbed(:user).tap do |user|
|
||||
allow(user)
|
||||
.to receive(:allowed_to?) do |permission, p, global:|
|
||||
permission[:controller] == 'work_packages/calendars' &&
|
||||
permission[:controller] == '/calendar/calendar' &&
|
||||
permission[:action] == 'index' &&
|
||||
(p.nil? || p == project)
|
||||
end
|
||||
@@ -57,7 +57,7 @@ describe WorkPackages::CalendarsController, type: :controller do
|
||||
|
||||
it { is_expected.to be_successful }
|
||||
|
||||
it { is_expected.to render_template('work_packages/calendars/index') }
|
||||
it { is_expected.to render_template('calendar/calendar/index') }
|
||||
end
|
||||
|
||||
context 'cross-project' do
|
||||
+8
-8
@@ -28,15 +28,15 @@
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe WorkPackages::CalendarsController, type: :routing do
|
||||
it 'should connect GET /work_packages/calendar to work_package/calendar#index' do
|
||||
expect(get('/work_packages/calendar')).to route_to(controller: 'work_packages/calendars',
|
||||
action: 'index')
|
||||
describe Calendar::CalendarController, type: :routing do
|
||||
it 'should connect GET /calendar to calendar#index' do
|
||||
expect(get('/calendar')).to route_to(controller: 'calendar/calendar',
|
||||
action: 'index')
|
||||
end
|
||||
|
||||
it 'should connect GET /project/1/work_packages/calendar to work_package/calendar#index' do
|
||||
expect(get('/projects/1/work_packages/calendar')).to route_to(controller: 'work_packages/calendars',
|
||||
action: 'index',
|
||||
project_id: '1')
|
||||
it 'should connect GET /project/1/calendar to calendar#index' do
|
||||
expect(get('/projects/1/calendar')).to route_to(controller: 'calendar/calendar',
|
||||
action: 'index',
|
||||
project_id: '1')
|
||||
end
|
||||
end
|
||||
@@ -50,7 +50,7 @@ describe 'project menu', type: :feature do
|
||||
# `url_for controller: 'cost_reports'` will yield different results ...
|
||||
#
|
||||
# when on `/projects/ponyo/work_packages`: `/projects/ponyo/cost_reports` (correct)
|
||||
# when on `/projects/ponyo/work_packages/calendar`: `/work_packages/cost_reports?project_id=ponyo`
|
||||
# when on `/projects/ponyo/calendar`: `/work_packages/cost_reports?project_id=ponyo`
|
||||
#
|
||||
# This is only relevant for project menu entries, not global ones (`project_id` param is nil)*.
|
||||
# Meaning that you have to make sure to force the absolute URL in a project menu entry
|
||||
@@ -80,7 +80,7 @@ describe 'project menu', type: :feature do
|
||||
end
|
||||
|
||||
context "when on the project's calendar" do
|
||||
let(:current_path) { '/projects/ponyo/work_packages/calendar' }
|
||||
let(:current_path) { '/projects/ponyo/calendar' }
|
||||
|
||||
it_behaves_like 'it leads to the project costs reports'
|
||||
end
|
||||
@@ -111,7 +111,7 @@ describe 'project menu', type: :feature do
|
||||
end
|
||||
|
||||
context "when on the project's calendar" do
|
||||
let(:current_path) { '/projects/ponyo/work_packages/calendar' }
|
||||
let(:current_path) { '/projects/ponyo/calendar' }
|
||||
|
||||
it_behaves_like 'it leads to the cost reports'
|
||||
end
|
||||
|
||||
@@ -40,7 +40,7 @@ module OpenProject::TeamPlanner
|
||||
:team_planner_view,
|
||||
{ controller: '/team_planner/team_planner', action: :index },
|
||||
caption: :'team_planner.label_team_planner',
|
||||
after: :backlogs,
|
||||
after: :work_packages,
|
||||
icon: 'icon2 icon-calendar',
|
||||
badge: 'label_menu_badge.pre_alpha'
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ describe 'robots.txt', type: :feature do
|
||||
end
|
||||
|
||||
it 'disallows global paths and paths from public project' do
|
||||
expect(page).to have_content('Disallow: /work_packages/calendar')
|
||||
expect(page).to have_content('Disallow: /calendar')
|
||||
expect(page).to have_content('Disallow: /activity')
|
||||
|
||||
expect(page).to have_content("Disallow: /projects/#{project.identifier}/repository")
|
||||
|
||||
Reference in New Issue
Block a user