Skip to content

Commit 7f2468c

Browse files
committed
WIP
1 parent 4c052a0 commit 7f2468c

File tree

3 files changed

+75
-1
lines changed

3 files changed

+75
-1
lines changed

app/controllers/projects_controller.rb

+5
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ def index # rubocop:disable Metrics/AbcSize
8989
end
9090

9191
def new
92+
@project = if params[:parent_id]
93+
Project.find(params[:parent_id]).children.build
94+
else
95+
Project.new
96+
end
9297
render layout: "no_menu"
9398
end
9499

app/forms/projects/form.rb

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# frozen_string_literal: true
2+
3+
#-- copyright
4+
# OpenProject is an open source project management software.
5+
# Copyright (C) the OpenProject GmbH
6+
#
7+
# This program is free software; you can redistribute it and/or
8+
# modify it under the terms of the GNU General Public License version 3.
9+
#
10+
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
11+
# Copyright (C) 2006-2013 Jean-Philippe Lang
12+
# Copyright (C) 2010-2013 the ChiliProject Team
13+
#
14+
# This program is free software; you can redistribute it and/or
15+
# modify it under the terms of the GNU General Public License
16+
# as published by the Free Software Foundation; either version 2
17+
# of the License, or (at your option) any later version.
18+
#
19+
# This program is distributed in the hope that it will be useful,
20+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
21+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22+
# GNU General Public License for more details.
23+
#
24+
# You should have received a copy of the GNU General Public License
25+
# along with this program; if not, write to the Free Software
26+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27+
#
28+
# See COPYRIGHT and LICENSE files for more details.
29+
#++
30+
module Projects
31+
class Form < ApplicationForm
32+
include ::CustomFields::CustomFieldRendering
33+
34+
form do |f|
35+
f.group(layout: :horizontal) do |template_group|
36+
# template_group.project_autocompleter(
37+
# scope_name_to_model: false,
38+
# name: "template",
39+
# value: "foo",
40+
# label: "Template",
41+
# autocomplete_options: {
42+
# dropdownPosition: "bottom",
43+
# filters: [
44+
# { name: "user_action", operator: "=", values: ["projects/copy"] },
45+
# { name: "templated", operator: "=", value: true }
46+
# ]
47+
# }
48+
# )
49+
end
50+
51+
f.text_field name: :name, label: attribute_name(:name), required: true
52+
53+
f.project_autocompleter(
54+
name: :parent_id,
55+
label: attribute_name(:parent_id),
56+
autocomplete_options: {
57+
dropdownPosition: "bottom",
58+
filters: [{ name: "user_action", operator: "=", values: ["meetings/create"] }]
59+
}
60+
)
61+
end
62+
end
63+
end

app/views/projects/new.html.erb

+7-1
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,10 @@ See COPYRIGHT and LICENSE files for more details.
3333
header.with_breadcrumbs([{ href: home_path, text: organization_name }, t(:label_project_new)])
3434
end
3535
%>
36-
<%= angular_component_tag "opce-new-project" %>
36+
<%=
37+
primer_form_with(model: @project) do |f|
38+
concat render(Projects::Form.new(f))
39+
concat render(Projects::CustomFields::Form.new(f, project: @project, wrapper_id: "FOO"))
40+
end
41+
%>
42+
<%# angular_component_tag "opce-new-project" %>

0 commit comments

Comments
 (0)