From 8342a17aca547026fef7c58f7b30cbe5bcb65ec6 Mon Sep 17 00:00:00 2001 From: chiu Date: Wed, 20 May 2020 20:20:19 +0800 Subject: [PATCH] fix error --- app/views/email/delete_email.html.erb | 9 +++++---- app/views/email/edit_email.html.erb | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/views/email/delete_email.html.erb b/app/views/email/delete_email.html.erb index 0ab848e..e380c5c 100644 --- a/app/views/email/delete_email.html.erb +++ b/app/views/email/delete_email.html.erb @@ -9,7 +9,6 @@ <% property = Property.where(id: @data['property_id']).first %> <% if !property.nil? %>

<%= property['title'].collect{|k,v| v}.uniq.join('/') rescue nil %>

- <%= t('property_hire.editor') %>: <%= User.find(user_id).name rescue nil %> <% I18n.with_locale(@data['locale']) do %> @@ -19,14 +18,16 @@ - <% ['property_usage','note','category','property_location','property_number','can_be_hired','purchase_date','owners','other_owner','owner_email','owner_phone','price'].each do |k| %> - <% v = property.send(k) %> + <% ['editor','property_usage','note','category','property_location','property_number','can_be_hired','purchase_date','owners','other_owner','owner_email','owner_phone','price'].each do |k| %> + <% v = property.send(k) rescue nil %>
<%= k=='category' ? t('category') : t("property_hire.#{k}") %>:  - <% if ['purchase_date'].include?(k) %> + <% if k == 'editor' %> + <%= User.find(user_id).name rescue nil %> + <% elsif ['purchase_date'].include?(k) %> <%= v.strftime('%Y/%m/%d %H:%M') rescue nil %> <% elsif ['property_usage','note'].include?(k) %> <%= property[k].collect{|k,v| v}.uniq.join('/') rescue nil %> diff --git a/app/views/email/edit_email.html.erb b/app/views/email/edit_email.html.erb index 3290086..62d936d 100644 --- a/app/views/email/edit_email.html.erb +++ b/app/views/email/edit_email.html.erb @@ -8,7 +8,6 @@ <%= t('property_hire.email_edit_success') %> <% end %>

<%= property['title'].collect{|k,v| v}.uniq.join('/') rescue nil %>

-<%= t('property_hire.editor') %>: <%= User.find(user_id).name rescue nil %> <% I18n.with_locale(@data['locale']) do %> @@ -18,14 +17,16 @@ - <% ['property_usage','note','category','property_location','property_number','can_be_hired','purchase_date','owners','other_owner','owner_email','owner_phone','price'].each do |k| %> - <% v = property.send(k) %> + <% ['editor','property_usage','note','category','property_location','property_number','can_be_hired','purchase_date','owners','other_owner','owner_email','owner_phone','price'].each do |k| %> + <% v = property.send(k) rescue nil %>
<%= k=='category' ? t('category') : t("property_hire.#{k}") %>:  - <% if ['purchase_date'].include?(k) %> + <% if k == 'editor' %> + <%= User.find(user_id).name rescue nil %> + <% elsif ['purchase_date'].include?(k) %> <%= v.strftime('%Y/%m/%d %H:%M') rescue nil %> <% elsif ['property_usage','note'].include?(k) %> <%= property[k].collect{|k,v| v}.uniq.join('/') rescue nil %>