Skip to content

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

Budget errors from contract

Oliver Günther26b8a8a1d4ce
diff --git a/modules/budgets/app/controllers/budgets_controller.rb b/modules/budgets/app/controllers/budgets_controller.rb
index 7127ba4ced4..370428f6f98 100644
--- a/modules/budgets/app/controllers/budgets_controller.rb
+++ b/modules/budgets/app/controllers/budgets_controller.rb
@@ -108,6 +108,7 @@ class BudgetsController < ApplicationController
flash[:notice] = t(:notice_successful_create)
redirect_to(params[:continue] ? { action: 'new' } : { action: 'show', id: @budget })
else
+ @errors = call.errors
render action: 'new', layout: !request.xhr?
end
end
@@ -126,6 +127,7 @@ class BudgetsController < ApplicationController
redirect_to(params[:back_to] || { action: 'show', id: @budget })
else
@budget = call.result
+ @errors = call.errors
render action: 'edit'
end
rescue ActiveRecord::StaleObjectError
diff --git a/modules/budgets/app/views/budgets/_edit.html.erb b/modules/budgets/app/views/budgets/_edit.html.erb
index 4a392b15171..9e195f8027a 100644
--- a/modules/budgets/app/views/budgets/_edit.html.erb
+++ b/modules/budgets/app/views/budgets/_edit.html.erb
@@ -33,7 +33,6 @@ See docs/COPYRIGHT.rdoc for more details.
:html => {:multipart => true,
:id => 'budget_form',
:class => 'form'} do |f| %>
- <%= error_messages_for 'budget' %>
<%= render :partial => 'form', :locals => {:f => f} %>
<div class="generic-table--action-buttons">
<%= styled_button_tag t(:button_submit), class: '-with-icon icon-checkmark -highlight', id: 'budget-table--submit-button'%>
diff --git a/modules/budgets/app/views/budgets/_form.html.erb b/modules/budgets/app/views/budgets/_form.html.erb
index e3162429f05..85339408acd 100644
--- a/modules/budgets/app/views/budgets/_form.html.erb
+++ b/modules/budgets/app/views/budgets/_form.html.erb
@@ -28,6 +28,7 @@ See docs/COPYRIGHT.rdoc for more details.
++#%>
<% resource = budget_attachment_representer(f.object) %>
+<%= error_messages_for_contract @budget, @errors %>
<div class="form--field -required">
<%= f.text_field :subject, required: true, autofocus: true, container_class: '-wide' %>
diff --git a/modules/budgets/app/views/budgets/new.html.erb b/modules/budgets/app/views/budgets/new.html.erb
index 5e8729f9f5e..3f872e89f79 100644
--- a/modules/budgets/app/views/budgets/new.html.erb
+++ b/modules/budgets/app/views/budgets/new.html.erb
@@ -34,7 +34,6 @@ See docs/COPYRIGHT.rdoc for more details.
:url => projects_budgets_path(@project),
:as => :budget,
:html => {:multipart => true, :id => 'budget_form'} do |f| %>
- <%= error_messages_for 'budget' %>
<%= render :partial => 'form', :locals => {:f => f} %>
<%= styled_button_tag t(:button_create), class: '-with-icon icon-checkmark' %>
<%= styled_button_tag t(:button_create_and_continue), :name => 'continue',