From 77861d20827f064e837054347732fb8ac1af4999 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Wed, 15 Jul 2009 12:51:44 -0300 Subject: [PATCH] ActionItem1167: hide not informed city and state --- app/controllers/public/contact_controller.rb | 4 ++-- app/views/contact/sender/mail.rhtml | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/public/contact_controller.rb b/app/controllers/public/contact_controller.rb index 2b99d48..6ca8773 100644 --- a/app/controllers/public/contact_controller.rb +++ b/app/controllers/public/contact_controller.rb @@ -10,8 +10,8 @@ class ContactController < PublicController if request.post? && params[self.icaptcha_field].blank? @contact = Contact.new(params[:contact]) @contact.dest = profile - @contact.city = (!params[:city].blank? && City.exists?(params[:city])) ? City.find(params[:city]).name : _('Missing') - @contact.state = (!params[:state].blank? && State.exists?(params[:state])) ? State.find(params[:state]).name : _('Missing') + @contact.city = (!params[:city].blank? && City.exists?(params[:city])) ? City.find(params[:city]).name : nil + @contact.state = (!params[:state].blank? && State.exists?(params[:state])) ? State.find(params[:state]).name : nil if @contact.deliver flash[:notice] = _('Contact successfully sent') redirect_to :action => 'new' diff --git a/app/views/contact/sender/mail.rhtml b/app/views/contact/sender/mail.rhtml index 9bb30f3..ecacb82 100644 --- a/app/views/contact/sender/mail.rhtml +++ b/app/views/contact/sender/mail.rhtml @@ -1,6 +1,8 @@ <%= _('Name: %s') % @name %> <%= _('e-Mail: %s') % @email %> -<%= _('City and state: %s-%s') % [@city, @state] %> +<% if @city || @state %> + <%= _('City and state: %s/%s') % [@city || '?', @state || '?'] %> +<% end %> <%= _('Message:') %> -- -- libgit2 0.21.2