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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Allow to select template in new form
Oliver Günthera78b70182c23
diff --git a/app/views/projects/_edit.html.erb b/app/views/projects/_edit.html.erbindex 30982e4c180..f665f2de3da 100644--- a/app/views/projects/_edit.html.erb+++ b/app/views/projects/_edit.html.erb@@ -58,6 +58,20 @@ See docs/COPYRIGHT.rdoc for more details.<span class="button--text"><%= t(:label_archive_project) %></span><% end %></li>+ <% unless @project.templated? %>+ <li class="toolbar-item hidden-for-mobile">+ <%= form_for(@project,+ html: { class: 'toolbar-item'},+ url: project_path(@project),+ method: :patch) do |f| %>+ <%= f.hidden_field :templated, value: true %>+ <button class="button" title="<%= t('project.template.make_template') %>">+ <%= op_icon('button--icon icon-duplicate') %>+ <span class="button--text"><%= t('project.template.make_template') %></span>+ </button>+ <% end %>+ </li>+ <% end %><li class="toolbar-item"><%= link_to confirm_destroy_project_path(@project),class: 'button delete',diff --git a/app/views/projects/_form.html.erb b/app/views/projects/_form.html.erbindex 708b421e849..3bcba085223 100644--- a/app/views/projects/_form.html.erb+++ b/app/views/projects/_form.html.erb@@ -38,7 +38,7 @@ See docs/COPYRIGHT.rdoc for more details.<%= call_hook(:view_projects_form, project: project, form: f) %></section>-<% unless project.new_record? %>+<% if project.persisted? %><section class="form--section"><%= render partial: "projects/form/required_storage",locals: { project: project, storage: project.count_required_storage } %>diff --git a/app/views/projects/form/_project_attributes.html.erb b/app/views/projects/form/_project_attributes.html.erbindex 3e00bb71d31..5a1d3222bce 100644--- a/app/views/projects/form/_project_attributes.html.erb+++ b/app/views/projects/form/_project_attributes.html.erb@@ -30,6 +30,12 @@ See docs/COPYRIGHT.rdoc for more details.<%= render partial: "projects/form/attributes/name",locals: { form: form } %>++<% if project.new_record? %>+ <%= render partial: "projects/form/select_template",+ locals: { project: project, form: form } %>+<% end %>+<%= render partial: "customizable/form",locals: { form: form, all_fields: all_fields, only_required: render_advanced } %><% if render_advanced %>@@ -48,7 +54,9 @@ See docs/COPYRIGHT.rdoc for more details.locals: { form: form } %><%= render partial: "projects/form/attributes/public",locals: { form: form } %>- <%= render partial: "projects/form/attributes/status",+<%= render partial: "projects/form/attributes/templated",+ locals: { form: form } %>+<%= render partial: "projects/form/attributes/status",locals: { form: form } %><% unless all_fields %><%= render partial: "customizable/form",diff --git a/app/views/projects/form/_select_template.html.erb b/app/views/projects/form/_select_template.html.erbnew file mode 100644index 00000000000..ff6457f05f3--- /dev/null+++ b/app/views/projects/form/_select_template.html.erb@@ -0,0 +1,38 @@+<%#-- copyright+OpenProject is an open source project management software.+Copyright (C) 2012-2020 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-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.++++#%>++<div class="form--field">+ <%= styled_label_tag 'from_template', l('project.template.use_template') %>+ <div class="form--field-container">+ <%= styled_select_tag :from_template,+ options_for_select(project_options_for_templated),+ prompt: "(#{t(:label_none)})",+ container_class: '-wide' %>+ </div>+</div>