add editor to email
This commit is contained in:
parent
1b88e86364
commit
a17980e7a7
|
@ -43,7 +43,7 @@ class Admin::PropertyHiresController < OrbitAdminController
|
|||
property = Property.find(params[:id]) rescue nil
|
||||
email = Array(MemberProfile.find(property.owners)).collect{|v| v.email} rescue []
|
||||
email = User.all.select{|v| v.is_admin? && v.user_name != 'rulingcom'}.collect{|v| v.member_profile.email} if email.length == 0
|
||||
Admin::PropertyHiresHelper::HireMethod.send_mail('delete',email,property.id)
|
||||
Admin::PropertyHiresHelper::HireMethod.send_mail('delete',email,property.id,nil,nil,current_user.id)
|
||||
property.destroy if !property.nil?
|
||||
if params[:page]
|
||||
redirect_to admin_property_hires_path(:page => params[:page])
|
||||
|
@ -58,7 +58,7 @@ class Admin::PropertyHiresController < OrbitAdminController
|
|||
property.update_attributes(property_params)
|
||||
email = Array(MemberProfile.find(property.owners)).collect{|v| v.email} rescue []
|
||||
email = User.all.select{|v| v.is_admin? && v.user_name != 'rulingcom'}.collect{|v| v.member_profile.email} if email.length == 0
|
||||
Admin::PropertyHiresHelper::HireMethod.send_mail('edit',email,property.id)
|
||||
Admin::PropertyHiresHelper::HireMethod.send_mail('edit',email,property.id,nil,nil,current_user.id)
|
||||
if params[:page]
|
||||
redirect_to admin_property_hires_path(:page => params[:page])
|
||||
else
|
||||
|
|
|
@ -63,7 +63,7 @@ module Admin::PropertyHiresHelper
|
|||
a = multiple_lang_tag(key_field,markup,"#{key_index}][#{field}",field_sets,custom_options,end_block,{},markup=='text_area')
|
||||
a.html_safe
|
||||
end
|
||||
def self.send_mail(field_name,email,property_id,send_date=nil,hire_id=nil)
|
||||
def self.send_mail(field_name,email,property_id,send_date=nil,hire_id=nil,user_id=nil)
|
||||
property = Property.where(id: property_id).first
|
||||
if !property.nil?
|
||||
email_set = property.hire_email_sets.select{|v| v.field_name == field_name}
|
||||
|
@ -76,14 +76,14 @@ module Admin::PropertyHiresHelper
|
|||
template:"email/#{field_name}_email.html.erb",
|
||||
mail_sentdate: send_date || Time.current,
|
||||
mail_subject: I18n.t("property_hire.email_#{field_name}_success"),
|
||||
template_data:{'property_id'=>property_id,'content'=>content,'locale'=>I18n.locale.to_s,'hire_id'=>hire_id})
|
||||
template_data:{'property_id'=>property_id,'content'=>content,'locale'=>I18n.locale.to_s,'hire_id'=>hire_id,'user_id'=>user_id})
|
||||
elsif !(email_set[0].disabled)
|
||||
mail = Email.create(mail_to: Array(email),
|
||||
module_app_key:"property_hire",
|
||||
template:"email/#{field_name}_email.html.erb",
|
||||
mail_sentdate: send_date || Time.current,
|
||||
mail_subject: email_set[0].title[I18n.locale],
|
||||
template_data:{'property_id'=>property_id,'email_set_content'=>email_set[0].content.to_yaml,'content'=>content,'locale'=>I18n.locale.to_s,'hire_id'=>hire_id})
|
||||
template_data:{'property_id'=>property_id,'email_set_content'=>email_set[0].content.to_yaml,'content'=>content,'locale'=>I18n.locale.to_s,'hire_id'=>hire_id,'user_id'=>user_id})
|
||||
end
|
||||
begin
|
||||
mail.deliver
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<% property = Property.where(id: @data['property_id']).first %>
|
||||
<% if !property.nil? %>
|
||||
<h3><%= property['title'].collect{|k,v| v}.uniq.join('/') rescue nil %></h3>
|
||||
<%= t('property_hire.editor') %>: <%= User.find(user_id).name rescue nil %>
|
||||
<% I18n.with_locale(@data['locale']) do %>
|
||||
<table>
|
||||
<thead>
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<%= t('property_hire.email_edit_success') %>
|
||||
<% end %>
|
||||
<h3><%= property['title'].collect{|k,v| v}.uniq.join('/') rescue nil %></h3>
|
||||
<%= t('property_hire.editor') %>: <%= User.find(user_id).name rescue nil %>
|
||||
<% I18n.with_locale(@data['locale']) do %>
|
||||
<table>
|
||||
<thead>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
en:
|
||||
property_hire:
|
||||
editor: Editor
|
||||
email_p_hire_success: Hire Success
|
||||
email_edit_success: 'Property Hire Module:Edit Success'
|
||||
email_delete_success: 'Property Hire Module:Delete Success'
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
zh_tw:
|
||||
property_hire:
|
||||
editor: 編輯者
|
||||
email_p_hire_success: 租借成功
|
||||
email_edit_success: '租借模組:編輯成功'
|
||||
email_delete_success: '租借模組:刪除成功'
|
||||
|
|
Loading…
Reference in New Issue