From b7efc22d1d24ac094870775012dcabffc71e6cc8 Mon Sep 17 00:00:00 2001 From: chiu Date: Wed, 20 May 2020 17:34:30 +0800 Subject: [PATCH] add content to edit email --- app/views/email/delete_email.html.erb | 42 ++++++++++++++++++++++++++- app/views/email/edit_email.html.erb | 39 ++++++++++++++++++++++++- 2 files changed, 79 insertions(+), 2 deletions(-) diff --git a/app/views/email/delete_email.html.erb b/app/views/email/delete_email.html.erb index 614b6e7..98fef6e 100644 --- a/app/views/email/delete_email.html.erb +++ b/app/views/email/delete_email.html.erb @@ -4,4 +4,44 @@ <%= email_set_content[now_locale].html_safe rescue nil %> <% end %>
-<%= @data['content'].html_safe %> \ No newline at end of file +<%= @data['content'].html_safe %> + +<% property = Property.where(id: @data['property_id']).first %> +<% if !property.nil? %> +

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

+ <% I18n.with_locale(@data['locale']) do %> + + + + + + + + + <% ['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) %> + + + + + <% end %> + +
+ <%= k=='category' ? t('category') : t("property_hire.#{k}") %>:  + + <% if ['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 %> + <% elsif k=='owners' %> + <%= property.owner_profiles.collect{|v| v.name}.join(', ') %> + <% elsif k == 'category' %> + <%= v.title %> + <% elsif k == 'can_be_hired' %> + <%= v ? t('yes_') : t('no_') %> + <% else %> + <%= v %> + <% end %> +
+ <% end %> +<% end %> \ No newline at end of file diff --git a/app/views/email/edit_email.html.erb b/app/views/email/edit_email.html.erb index af82431..dffc7e9 100644 --- a/app/views/email/edit_email.html.erb +++ b/app/views/email/edit_email.html.erb @@ -1,8 +1,45 @@ -<% email_set = Property.where(id: @data['property_id']).first.hire_email_sets.select{|v| v.field_name == 'edit'} %> +<% property = Property.where(id: @data['property_id']).first %> +<% email_set = property.hire_email_sets.select{|v| v.field_name == 'edit'} %> <% if email_set.length != 0 %> <% if !(email_set[0].content.nil?) %> <%= email_set[0].content[@data['locale']].html_safe %> <% end %> <% else %> <%= t('property_hire.email_edit_success') %> +<% end %> +

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

+<% I18n.with_locale(@data['locale']) do %> + + + + + + + + + <% ['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) %> + + + + + <% end %> + +
+ <%= k=='category' ? t('category') : t("property_hire.#{k}") %>:  + + <% if ['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 %> + <% elsif k=='owners' %> + <%= property.owner_profiles.collect{|v| v.name}.join(', ') %> + <% elsif k == 'category' %> + <%= v.title %> + <% elsif k == 'can_be_hired' %> + <%= v ? t('yes_') : t('no_') %> + <% else %> + <%= v %> + <% end %> +
<% end %> \ No newline at end of file