From f3fc82d9dccd6ba2316f08615a0dcdede6e64816 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Wed, 29 Sep 2010 09:50:18 -0700 Subject: [PATCH] [#4567] Replace inline errors with regular Redmine error messages --- app/controllers/contracts_controller.rb | 4 +++- app/views/contracts/edit.html.erb | 2 ++ app/views/contracts/new.html.erb | 2 ++ app/views/deliverables/edit.html.erb | 2 ++ app/views/deliverables/new.html.erb | 2 ++ init.rb | 1 + 6 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/controllers/contracts_controller.rb b/app/controllers/contracts_controller.rb index 27729f7..4f152d7 100644 --- a/app/controllers/contracts_controller.rb +++ b/app/controllers/contracts_controller.rb @@ -8,7 +8,9 @@ class ContractsController < InheritedResources::Base before_filter :require_admin, :only => :destroy def create - create! { contract_url(@project, resource) } + create! do |success, failure| + success.html { redirect_to contract_url(@project, resource) } + end end def update diff --git a/app/views/contracts/edit.html.erb b/app/views/contracts/edit.html.erb index 9e01f21..51e6201 100644 --- a/app/views/contracts/edit.html.erb +++ b/app/views/contracts/edit.html.erb @@ -6,6 +6,8 @@ <%= content_tag(:h2, h(l(:text_edit_contract_name, :name => resource.name))) %> +<%= error_messages_for 'contract' %> + <% semantic_form_for resource, :url => contract_path(@project, resource), :html => {:class => 'tabular'} do |form| %> <%= render :partial => 'form', :object => form, :locals => {:cancel_path => contract_path(@project, resource)} %> <% end %> diff --git a/app/views/contracts/new.html.erb b/app/views/contracts/new.html.erb index 679ed0b..3af1abc 100644 --- a/app/views/contracts/new.html.erb +++ b/app/views/contracts/new.html.erb @@ -1,5 +1,7 @@ <%= content_tag(:h2, l(:text_new_contract)) %> +<%= error_messages_for 'contract' %> + <% semantic_form_for resource, :html => {:class => 'tabular'} do |form| %> <%= render :partial => 'form', :object => form, :locals => {:cancel_path => contracts_path} %> <% end %> diff --git a/app/views/deliverables/edit.html.erb b/app/views/deliverables/edit.html.erb index 479083d..d2660a3 100644 --- a/app/views/deliverables/edit.html.erb +++ b/app/views/deliverables/edit.html.erb @@ -2,6 +2,8 @@ <%= content_tag(:h2, h(l(:text_edit_deliverable_title, :title => resource.title))) %> +<%= error_messages_for 'deliverable' %> + <% semantic_form_for [@project, @contract, setup_nested_deliverable_records(resource)], :url => contract_deliverable_path(@project, @contract, resource), :html => {:class => 'deliverable tabular'} do |form| %> <%= render :partial => 'form', :object => form, :locals => {:cancel_path => contract_path(@project, @contract)} %> <% end %> diff --git a/app/views/deliverables/new.html.erb b/app/views/deliverables/new.html.erb index 9a0bef8..6a68049 100644 --- a/app/views/deliverables/new.html.erb +++ b/app/views/deliverables/new.html.erb @@ -2,6 +2,8 @@ <%= content_tag(:h2, l(:text_new_deliverable)) %> +<%= error_messages_for 'deliverable' %> + <% semantic_form_for [@project, @contract, setup_nested_deliverable_records(resource)], :url => contract_deliverables_path(@project, @contract), :html => {:class => 'deliverable tabular'} do |form| %> <%= render :partial => 'form', :object => form, :locals => {:cancel_path => contract_path(@project, @contract)} %> <% end %> diff --git a/init.rb b/init.rb index 672f973..0d3be6e 100644 --- a/init.rb +++ b/init.rb @@ -77,6 +77,7 @@ Dispatcher.to_prepare :redmine_contracts do Formtastic::SemanticFormBuilder.all_fields_required_by_default = false Formtastic::SemanticFormBuilder.required_string = " *" + Formtastic::SemanticFormBuilder.inline_errors = :none require_dependency 'payment_term' # Load so Enumeration will pick up the subclass in dev