diff --git a/Gemfile.lock b/Gemfile.lock
index 280d476779a..a9cf0d43fcc 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -151,6 +151,13 @@ PATH
specs:
grids (1.0.0)
+PATH
+ remote: modules/ifc_models
+ specs:
+ openproject-ifc_models (1.0.0)
+ activerecord-import
+ rubyzip (~> 1.2)
+
PATH
remote: modules/ldap_groups
specs:
@@ -1028,6 +1035,7 @@ DEPENDENCIES
openproject-documents!
openproject-github_integration!
openproject-global_roles!
+ openproject-ifc_models!
openproject-ldap_groups!
openproject-meeting!
openproject-openid_connect!
diff --git a/Gemfile.modules b/Gemfile.modules
index 0fdf6b50373..713365e7e1c 100644
--- a/Gemfile.modules
+++ b/Gemfile.modules
@@ -47,4 +47,5 @@ group :opf_plugins do
gem 'openproject-bim_seeder', path: 'modules/bim_seeder', require: !!(ENV['OPENPROJECT_EDITION'] == 'bim')
gem 'openproject-bcf', path: 'modules/bcf', require: !!(ENV['OPENPROJECT_EDITION'] == 'bim')
+ gem 'openproject-ifc_models', path: 'modules/ifc_models', require: !!(ENV['OPENPROJECT_EDITION'] == 'bim')
end
diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb
index 9987f645407..2906256ca16 100644
--- a/config/initializers/inflections.rb
+++ b/config/initializers/inflections.rb
@@ -43,4 +43,5 @@
ActiveSupport::Inflector.inflections(:en) do |inflect|
inflect.acronym 'OAuth'
inflect.acronym 'OpenID'
+ inflect.acronym 'IFC'
end
diff --git a/modules/ifc_models/Gemfile b/modules/ifc_models/Gemfile
new file mode 100644
index 00000000000..851fabc21dd
--- /dev/null
+++ b/modules/ifc_models/Gemfile
@@ -0,0 +1,2 @@
+source 'https://rubygems.org'
+gemspec
diff --git a/modules/ifc_models/app/controllers/ifc_models/base_controller.rb b/modules/ifc_models/app/controllers/ifc_models/base_controller.rb
new file mode 100644
index 00000000000..96270a4b95f
--- /dev/null
+++ b/modules/ifc_models/app/controllers/ifc_models/base_controller.rb
@@ -0,0 +1,4 @@
+module ::IFCModels
+ class BaseController < ApplicationController
+ end
+end
diff --git a/modules/ifc_models/app/controllers/ifc_models/ifc_models_controller.rb b/modules/ifc_models/app/controllers/ifc_models/ifc_models_controller.rb
new file mode 100644
index 00000000000..25b0a80fa2e
--- /dev/null
+++ b/modules/ifc_models/app/controllers/ifc_models/ifc_models_controller.rb
@@ -0,0 +1,106 @@
+#-- encoding: UTF-8
+
+#-- copyright
+# OpenProject is a project management system.
+# Copyright (C) 2012-2018 the OpenProject Foundation (OPF)
+#
+# 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-2017 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 docs/COPYRIGHT.rdoc for more details.
+#++
+
+module ::IFCModels
+ class IFCModelsController < BaseController
+ include PaginationHelper
+
+ before_action :find_project_by_project_id, only: [:index, :new, :create, :show, :edit, :update, :destroy]
+ before_action :find_ifc_model_object, except: [:index, :new, :create]
+
+ before_action :authorize
+
+ menu_item :ifc_models
+
+ def index
+ @ifc_models = @project.ifc_models.order('created_at DESC').page(page_param).per_page(per_page_param)
+ render 'ifc_models/index'
+ end
+
+ def new
+ @ifc_model = @project.ifc_models.build(ifc_model_params)
+ render 'ifc_models/new'
+ end
+
+ def edit
+ render 'ifc_models/edit'
+ end
+
+ def show
+ render 'ifc_models/show'
+ end
+
+ def create
+ @ifc_model = @project.ifc_models.build(uploader: User.current)
+
+ if add_attachment && @ifc_model.save
+ redirect_to action: :show, id: @ifc_model.id
+ else
+ render 'ifc_models/new'
+ end
+ end
+
+ def update
+ if @ifc_model.update(ifc_model_params)
+ redirect_to action: :show, id: @ifc_model.id
+ else
+ render 'ifc_models/new'
+ end
+ end
+
+ def destroy
+ @ifc_model.destroy
+ redirect_to action: :index
+ end
+
+ private
+
+ def add_attachment
+ if (file = ifc_model_params['ifc_attachment']) && file && file.size.positive?
+ @ifc_model.attachments.build(file: file,
+ container: @ifc_model,
+ description: 'IFC attachment',
+ author: User.current)
+ @ifc_model.title = file.original_filename
+ else
+ flash[:error] = t('ifc_models.could_not_save_file')
+ false
+ end
+ end
+
+ def ifc_model_params
+ params.fetch(:ifc_models_ifc_model, {}).permit('title', 'ifc_attachment')
+ end
+
+ def find_ifc_model_object
+ @ifc_model = IFCModels::IFCModel.find_by(id: params[:id])
+ end
+ end
+end
diff --git a/modules/ifc_models/app/models/ifc_models/ifc_model.rb b/modules/ifc_models/app/models/ifc_models/ifc_model.rb
new file mode 100644
index 00000000000..b94f09a5e20
--- /dev/null
+++ b/modules/ifc_models/app/models/ifc_models/ifc_model.rb
@@ -0,0 +1,25 @@
+module IFCModels
+ class IFCModel < ActiveRecord::Base
+ acts_as_attachable delete_permission: :manage_ifc_models
+
+ has_one :project
+ belongs_to :uploader, class_name: 'User', foreign_key: 'uploader_id'
+
+ def ifc_attachment
+ attachments.first
+ end
+
+ def xkt_attachment
+ attachments.second
+ end
+
+ def delete_ifc_attachment
+ delete_xkt_attachment
+ ifc_attachment&.destroy
+ end
+
+ def delete_xkt_attachment
+ xkt_attachment&.destroy
+ end
+ end
+end
diff --git a/modules/ifc_models/app/views/ifc_models/_form.html.erb b/modules/ifc_models/app/views/ifc_models/_form.html.erb
new file mode 100644
index 00000000000..1e431b60d7e
--- /dev/null
+++ b/modules/ifc_models/app/views/ifc_models/_form.html.erb
@@ -0,0 +1,38 @@
+<%#-- copyright
+OpenProject Documents Plugin
+
+Former OpenProject Core functionality extracted into a plugin.
+
+Copyright (C) 2009-2014 the OpenProject Foundation (OPF)
+
+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 doc/COPYRIGHT.rdoc for more details.
+
+++#%>
+
+<%= error_messages_for 'ifc_model' %>
+
+
+ <%= f.text_field :title, required: true, container_class: '-wide' unless @ifc_model.new_record? %>
+ <%= f.file_field :ifc_attachment if @ifc_model.new_record? %>
+
\ No newline at end of file
diff --git a/modules/ifc_models/app/views/ifc_models/edit.html.erb b/modules/ifc_models/app/views/ifc_models/edit.html.erb
new file mode 100644
index 00000000000..5124e1b9e98
--- /dev/null
+++ b/modules/ifc_models/app/views/ifc_models/edit.html.erb
@@ -0,0 +1,38 @@
+<%#-- copyright
+OpenProject Documents Plugin
+
+Former OpenProject Core functionality extracted into a plugin.
+
+Copyright (C) 2009-2014 the OpenProject Foundation (OPF)
+
+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 doc/COPYRIGHT.rdoc for more details.
+
+++#%>
+
+<%= toolbar title: IFCModels::IFCModel.model_name.human %>
+
+<%= labelled_tabular_form_for @ifc_model, url: ifc_models_project_ifc_model_path(@project, @ifc_model), method: 'PATCH' do |f| -%>
+ <%= render partial: "ifc_models/form", locals: { f: f } %>
+ <%= styled_button_tag t(:button_save), class: "-highlight -with-icon icon-checkmark" %>
+<% end %>
diff --git a/modules/ifc_models/app/views/ifc_models/index.html.erb b/modules/ifc_models/app/views/ifc_models/index.html.erb
new file mode 100644
index 00000000000..7f5792f0cc3
--- /dev/null
+++ b/modules/ifc_models/app/views/ifc_models/index.html.erb
@@ -0,0 +1,107 @@
+<%#-- copyright
+OpenProject is a project management system.
+Copyright (C) 2012-2018 the OpenProject Foundation (OPF)
+
+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-2017 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 docs/COPYRIGHT.rdoc for more details.
+
+++#%>
+<% html_title(t('ifc_models.label_ifc_models')) -%>
+
+<%= toolbar title: t('ifc_models.label_ifc_models') do %>
+ <% if User.current.allowed_to?(:manage_ifc_models, @project) %>
+
+ <%= link_to new_ifc_models_project_ifc_model_path,
+ { class: 'button -alt-highlight',
+ aria: { label: t(:label_project_new) },
+ title: t(:label_project_new) } do %>
+ <%= op_icon('button--icon icon-add') %>
+ <%= IFCModels::IFCModel.model_name.human %>
+ <% end %>
+
+ <% end %>
+<% end %>
+
+<% if @ifc_models.any? %>
+
+
+
+ |
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+
+ <% @ifc_models.each do |ifc_model| %>
+
+ | <%= link_to(ifc_model.title, ifc_models_project_ifc_model_path(@project, ifc_model)) %> |
+ <%= format_date(ifc_model.created_at) %> |
+ <%= link_to_user(ifc_model.uploader.name) %> |
+ <%= ifc_model.xkt_attachment.present? ? t('ifc_models.processing_state.completed') : t('ifc_models.processing_state.in_progress') %> |
+
+ <% if authorize_for('ifc_models/ifc_models', :edit) %>
+ <%= link_to('', edit_ifc_models_project_ifc_model_path(@project, ifc_model), class: 'icon icon-edit', accesskey: accesskey(:edit)) %>
+ <% end %>
+ <% if authorize_for('ifc_models/ifc_models', :destroy) %>
+ <%= link_to('', ifc_models_project_ifc_model_path(@project, ifc_model), class: 'icon icon-delete', data: { confirm: l(:text_are_you_sure) }, method: :delete) %>
+ <% end %>
+ |
+
+ <% end %>
+
+
+ <%= pagination_links_full @ifc_models %>
+<% else %>
+ <%= no_results_box({}) %>
+<% end %>
diff --git a/modules/ifc_models/app/views/ifc_models/new.html.erb b/modules/ifc_models/app/views/ifc_models/new.html.erb
new file mode 100644
index 00000000000..acf9b6dc6c1
--- /dev/null
+++ b/modules/ifc_models/app/views/ifc_models/new.html.erb
@@ -0,0 +1,37 @@
+<%#-- copyright
+OpenProject Documents Plugin
+
+Former OpenProject Core functionality extracted into a plugin.
+
+Copyright (C) 2009-2014 the OpenProject Foundation (OPF)
+
+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 doc/COPYRIGHT.rdoc for more details.
+
+++#%>
+<%= toolbar title: t('ifc_models.label_new_ifc_model') %>
+
+<%= labelled_tabular_form_for @ifc_model, url: ifc_models_project_ifc_models_path(@project), html: { multipart: true } do |f| -%>
+ <%= render :partial => 'ifc_models/form', locals: { f: f } %>
+ <%= styled_button_tag l(:button_create), class: "-highlight -with-icon icon-checkmark" %>
+<% end %>
diff --git a/modules/ifc_models/app/views/ifc_models/show.html.erb b/modules/ifc_models/app/views/ifc_models/show.html.erb
new file mode 100644
index 00000000000..984e6fde467
--- /dev/null
+++ b/modules/ifc_models/app/views/ifc_models/show.html.erb
@@ -0,0 +1,50 @@
+<%#-- copyright
+OpenProject Documents Plugin
+
+Former OpenProject Core functionality extracted into a plugin.
+
+Copyright (C) 2009-2014 the OpenProject Foundation (OPF)
+
+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 doc/COPYRIGHT.rdoc for more details.
+
+++#%>
+
+<% html_title h(@ifc_model.title) -%>
+<%= toolbar title: @ifc_model.title do %>
+ <% if authorize_for('ifc_models/ifc_models', :edit) %>
+
+ <%= link_to(edit_ifc_models_project_ifc_model_path(@project, @ifc_model), class: 'button', accesskey: accesskey(:edit)) do %>
+ <%= op_icon('button--icon icon-edit') %> <%= l(:button_rename) %>
+ <% end %>
+
+ <% end %>
+ <% if authorize_for('ifc_models/ifc_models', :destroy) %>
+
+ <%= link_to(ifc_models_project_ifc_model_path(@project, @ifc_model), class: 'button', data: { confirm: l(:text_are_you_sure) }, method: :delete) do %>
+ <%= op_icon('button--icon icon-delete') %> <%= l(:button_delete) %>
+ <% end %>
+
+ <% end %>
+<% end %>
+
diff --git a/modules/ifc_models/config/locales/en.yml b/modules/ifc_models/config/locales/en.yml
new file mode 100644
index 00000000000..de696358dd0
--- /dev/null
+++ b/modules/ifc_models/config/locales/en.yml
@@ -0,0 +1,13 @@
+# English strings go here for Rails i18n
+en:
+ ifc_models:
+ label_ifc_models: 'IFC models'
+ label_new_ifc_model: 'New IFC model'
+ could_not_save_file': 'Could not save the file.'
+ processing_state:
+ label: 'Processing?'
+ in_progress: 'In progress'
+ completed: 'Completed'
+ project_module_ifc_models: "IFC models"
+ permission_view_ifc_models: "View IFC models"
+ permission_manage_ifc_models: "Import and manage IFC models"
diff --git a/modules/ifc_models/config/routes.rb b/modules/ifc_models/config/routes.rb
new file mode 100644
index 00000000000..f4d30a12fc1
--- /dev/null
+++ b/modules/ifc_models/config/routes.rb
@@ -0,0 +1,43 @@
+#-- copyright
+# OpenProject Backlogs Plugin
+#
+# Copyright (C)2013-2014 the OpenProject Foundation (OPF)
+# Copyright (C)2011 Stephan Eckardt, Tim Felgentreff, Marnen Laibow-Koser, Sandro Munda
+# Copyright (C)2010-2011 friflaj
+# Copyright (C)2010 Maxime Guilbot, Andrew Vit, Joakim Kolsjö, ibussieres, Daniel Passos, Jason Vasquez, jpic, Emiliano Heyns
+# Copyright (C)2009-2010 Mark Maglana
+# Copyright (C)2009 Joe Heck, Nate Lowrie
+#
+# 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 Backlogs is a derivative work based on ChiliProject Backlogs.
+# The copyright follows:
+# Copyright (C) 2010-2011 - Emiliano Heyns, Mark Maglana, friflaj
+# Copyright (C) 2011 - Jens Ulferts, Gregor Schmidt - Finn GmbH - Berlin, Germany
+#
+# 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 doc/COPYRIGHT.rdoc for more details.
+#++
+
+OpenProject::Application.routes.draw do
+ # get '/projects/:project_id/ifc_models', to: 'ifc_models/ifc_models#index'
+ scope '', as: 'ifc_models' do
+ scope 'projects/:project_id', as: 'project' do
+ resources :ifc_models, controller: 'ifc_models/ifc_models'
+ end
+ end
+end
diff --git a/modules/ifc_models/db/migrate/20191029155327_add_ifc_models_plugin.rb b/modules/ifc_models/db/migrate/20191029155327_add_ifc_models_plugin.rb
new file mode 100644
index 00000000000..bd19ddfecd4
--- /dev/null
+++ b/modules/ifc_models/db/migrate/20191029155327_add_ifc_models_plugin.rb
@@ -0,0 +1,11 @@
+class AddIFCModelsPlugin < ActiveRecord::Migration[5.1]
+ def change
+ create_table :ifc_models do |t|
+ t.string :title
+ t.timestamps
+
+ t.references :project, foreign_key: { on_delete: :cascade }, index: true
+ t.references :uploader, index: true
+ end
+ end
+end
diff --git a/modules/ifc_models/lib/open_project/ifc_models.rb b/modules/ifc_models/lib/open_project/ifc_models.rb
new file mode 100644
index 00000000000..2d6fee64cdf
--- /dev/null
+++ b/modules/ifc_models/lib/open_project/ifc_models.rb
@@ -0,0 +1,6 @@
+module OpenProject
+ module IFCModels
+ require "open_project/ifc_models/engine"
+ require "open_project/ifc_models"
+ end
+end
diff --git a/modules/ifc_models/lib/open_project/ifc_models/engine.rb b/modules/ifc_models/lib/open_project/ifc_models/engine.rb
new file mode 100644
index 00000000000..26e77a9e568
--- /dev/null
+++ b/modules/ifc_models/lib/open_project/ifc_models/engine.rb
@@ -0,0 +1,67 @@
+#-- encoding: UTF-8
+
+#-- copyright
+# OpenProject is a project management system.
+# Copyright (C) 2012-2017 the OpenProject Foundation (OPF)
+#
+# 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-2017 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 doc/COPYRIGHT.rdoc for more details.
+#++
+
+require 'open_project/plugins'
+
+module OpenProject::IFCModels
+ class Engine < ::Rails::Engine
+ engine_name :openproject_ifc_models
+
+ include OpenProject::Plugins::ActsAsOpEngine
+
+ register 'openproject-ifc_models',
+ author_url: 'https://openproject.com',
+ settings: {
+ default: {
+ }
+ } do
+
+ project_module :ifc_models do
+ permission :view_ifc_models,
+ { 'ifc_models/ifc_models': %i[index show] }
+ permission :manage_ifc_models,
+ { 'ifc_models/ifc_models': %i[index show destroy edit update create new] },
+ dependencies: %i[view_ifc_models]
+ end
+ end
+
+ initializer 'ifc_models.menu' do
+ ::Redmine::MenuManager.map(:project_menu) do |menu|
+ menu.push(:ifc_models,
+ { controller: '/ifc_models/ifc_models', action: 'index' },
+ caption: :'ifc_models.label_ifc_models',
+ param: :project_id,
+ icon: 'icon2 icon-ifc')
+ end
+ end
+
+ patches %i[Project]
+ end
+end
diff --git a/modules/ifc_models/lib/open_project/ifc_models/patches/project_patch.rb b/modules/ifc_models/lib/open_project/ifc_models/patches/project_patch.rb
new file mode 100644
index 00000000000..eb301c6b85b
--- /dev/null
+++ b/modules/ifc_models/lib/open_project/ifc_models/patches/project_patch.rb
@@ -0,0 +1,37 @@
+#-- copyright
+# OpenProject is a project management system.
+# Copyright (C) 2012-2019 the OpenProject Foundation (OPF)
+#
+# 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-2017 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 docs/COPYRIGHT.rdoc for more details.
+#++
+
+require_dependency 'work_package'
+
+module OpenProject::IFCModels::Patches::ProjectPatch
+ def self.included(base)
+ base.class_eval do
+ has_many :ifc_models, class_name: 'IFCModels::IFCModel', foreign_key: 'project_id'
+ end
+ end
+end
diff --git a/modules/ifc_models/lib/openproject-ifc_models.rb b/modules/ifc_models/lib/openproject-ifc_models.rb
new file mode 100644
index 00000000000..4fc6a6610f8
--- /dev/null
+++ b/modules/ifc_models/lib/openproject-ifc_models.rb
@@ -0,0 +1 @@
+require 'open_project/ifc_models'
diff --git a/modules/ifc_models/openproject-ifc_models.gemspec b/modules/ifc_models/openproject-ifc_models.gemspec
new file mode 100644
index 00000000000..47396c3cebf
--- /dev/null
+++ b/modules/ifc_models/openproject-ifc_models.gemspec
@@ -0,0 +1,18 @@
+# encoding: UTF-8
+
+# Describe your gem and declare its dependencies:
+Gem::Specification.new do |s|
+ s.name = "openproject-ifc_models"
+ s.version = "1.0.0"
+ s.authors = "OpenProject GmbH"
+ s.email = "info@openproject.com"
+ s.homepage = "https://community.openproject.org/"
+ s.summary = "Save and view IFC models in OpenProject."
+ s.description = "This OpenProject plugin allows to store and view IFC models."
+
+ s.files = Dir["{app,config,db,lib}/**/*", "CHANGELOG.md", "README.rdoc"]
+ s.test_files = Dir["spec/**/*"]
+
+ s.add_dependency 'activerecord-import'
+ s.add_dependency 'rubyzip', '~> 1.2'
+end
diff --git a/vendor/openproject-icon-font/README.md b/vendor/openproject-icon-font/README.md
index ddc2efd9ec3..573bc7fa24f 100644
--- a/vendor/openproject-icon-font/README.md
+++ b/vendor/openproject-icon-font/README.md
@@ -20,7 +20,7 @@ Since it seldomly changes, it is only rebuilt manually and on demand.
To rebuild the font (e.g., after changing icons in the source `app/assets/fonts/openproject_icon/src` directory), use the node script `generate.js`.
```
-$ cd app/assets/fonts/openproject_icon
+$ cd vendor/openproject-icon-font/
$ node generate.js
```