diff --git a/Gemfile.lock b/Gemfile.lock index e84e51c7137..977a0581fb7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -160,6 +160,11 @@ PATH openproject-reporting (1.0.0) costs +PATH + remote: modules/team_planner + specs: + openproject-team_planner (1.0.0) + PATH remote: modules/two_factor_authentication specs: @@ -1060,6 +1065,7 @@ DEPENDENCIES openproject-pdf_export! openproject-recaptcha! openproject-reporting! + openproject-team_planner! openproject-token (~> 2.2.0) openproject-translations! openproject-two_factor_authentication! diff --git a/Gemfile.modules b/Gemfile.modules index d2698da9346..9e169fb2a59 100644 --- a/Gemfile.modules +++ b/Gemfile.modules @@ -44,6 +44,7 @@ group :opf_plugins do gem 'openproject-boards', path: 'modules/boards' gem 'overviews', path: 'modules/overviews' gem 'budgets', path: 'modules/budgets' + gem 'openproject-team_planner', path: 'modules/team_planner' gem 'openproject-bim', path: 'modules/bim' end diff --git a/modules/team_planner/app/controllers/team_planner/base_controller.rb b/modules/team_planner/app/controllers/team_planner/base_controller.rb new file mode 100644 index 00000000000..0a8a5ebaf2a --- /dev/null +++ b/modules/team_planner/app/controllers/team_planner/base_controller.rb @@ -0,0 +1,4 @@ +module ::TeamPlanner + class BaseController < ::ApplicationController + end +end diff --git a/modules/team_planner/app/controllers/team_planner/team_planner_controller.rb b/modules/team_planner/app/controllers/team_planner/team_planner_controller.rb new file mode 100644 index 00000000000..6e7f275d558 --- /dev/null +++ b/modules/team_planner/app/controllers/team_planner/team_planner_controller.rb @@ -0,0 +1,28 @@ +module ::TeamPlanner + class TeamPlannerController < BaseController + before_action :find_optional_project + before_action :authorize + + # The team planner permission alone does not suffice + # to view work packages + before_action :authorize_work_package_permission + + menu_item :team_planner_view + + def index + render layout: 'angular/angular' + end + + current_menu_item :index do + :team_planner_view + end + + private + + def authorize_work_package_permission + unless current_user.allowed_to?(:view_work_packages, @project, global: @project.nil?) + deny_access + end + end + end +end diff --git a/modules/team_planner/app/views/team_planner/team_planner/index.html.erb b/modules/team_planner/app/views/team_planner/team_planner/index.html.erb new file mode 100644 index 00000000000..43b8883cd50 --- /dev/null +++ b/modules/team_planner/app/views/team_planner/team_planner/index.html.erb @@ -0,0 +1 @@ +<% html_title(t('team_planner.label_team_planner')) -%> diff --git a/modules/team_planner/config/locales/en.yml b/modules/team_planner/config/locales/en.yml new file mode 100644 index 00000000000..1d8a62b8383 --- /dev/null +++ b/modules/team_planner/config/locales/en.yml @@ -0,0 +1,7 @@ +# English strings go here +en: + permission_view_team_planner: "View team planner" + project_module_team_planner_view: "Team planner" + + team_planner: + label_team_planner: "Team planner" diff --git a/modules/team_planner/config/routes.rb b/modules/team_planner/config/routes.rb new file mode 100644 index 00000000000..4c2e0d8a958 --- /dev/null +++ b/modules/team_planner/config/routes.rb @@ -0,0 +1,6 @@ +OpenProject::Application.routes.draw do + #scope 'projects/:project_id', as: 'project' do + # get '/team_planner(/*state)', to: 'team_planner/team_planner#index' + #end + get '/projects/:project_id/team_planner', to: 'team_planner/team_planner#index' +end diff --git a/modules/team_planner/lib/open_project/team_planner.rb b/modules/team_planner/lib/open_project/team_planner.rb new file mode 100644 index 00000000000..bd52aedfc54 --- /dev/null +++ b/modules/team_planner/lib/open_project/team_planner.rb @@ -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 TeamPlanner + require 'open_project/team_planner/engine' + end +end diff --git a/modules/team_planner/lib/open_project/team_planner/engine.rb b/modules/team_planner/lib/open_project/team_planner/engine.rb new file mode 100644 index 00000000000..b37497434a2 --- /dev/null +++ b/modules/team_planner/lib/open_project/team_planner/engine.rb @@ -0,0 +1,44 @@ +# OpenProject Team Planner 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::TeamPlanner + class Engine < ::Rails::Engine + engine_name :openproject_team_planner + + include OpenProject::Plugins::ActsAsOpEngine + + register 'openproject-team_planner', + author_url: 'https://www.openproject.org', + bundled: true, + settings: {}, + name: 'OpenProject Team Planner' do + + project_module :team_planner_view, dependencies: :work_package_tracking, order: 60 do + permission :view_team_planner, 'team_planner/team_planner': %i[index], dependencies: :view_work_packages + end + + menu :project_menu, + :team_planner_view, + { controller: '/team_planner/team_planner', action: :index }, + caption: :'team_planner.label_team_planner', + after: :backlogs, + icon: 'icon2 icon-calendar' + end + + end +end diff --git a/modules/team_planner/lib/openproject-team_planner.rb b/modules/team_planner/lib/openproject-team_planner.rb new file mode 100644 index 00000000000..1a33de79006 --- /dev/null +++ b/modules/team_planner/lib/openproject-team_planner.rb @@ -0,0 +1 @@ +require 'open_project/team_planner' diff --git a/modules/team_planner/openproject-team_planner.gemspec b/modules/team_planner/openproject-team_planner.gemspec new file mode 100644 index 00000000000..52de65d2486 --- /dev/null +++ b/modules/team_planner/openproject-team_planner.gemspec @@ -0,0 +1,13 @@ +# encoding: UTF-8 + +Gem::Specification.new do |s| + s.name = 'openproject-team_planner' + s.version = '1.0.0' + s.authors = 'OpenProject GmbH' + s.email = 'info@openproject.com' + s.summary = 'OpenProject Team Planner' + s.description = 'Provides team planner views' + s.license = 'GPLv3' + + s.files = Dir['{app,config,db,lib}/**/*'] +end