Commit 3deae3f8e6c6a94a85aa43d481273ac445920acb

Authored by Gabriela Navarro
1 parent cbfe27a9

manage_organization: Send email for deleted organization

Signed-off-by: David Carlos <ddavidcarlos1392@gmail.com>
Signed-off-by: Gabriela Navarro <navarro1703@gmail.com>
app/controllers/my_profile/profile_editor_controller.rb
... ... @@ -70,8 +70,13 @@ class ProfileEditorController &lt; MyProfileController
70 70  
71 71 def destroy_profile
72 72 if request.post?
  73 + send_mail_list = @profile.admins
  74 + profile_name = @profile.name
73 75 if @profile.destroy
74 76 session[:notice] = _('The profile was deleted.')
  77 + send_mail_list.each do |u|
  78 + UserMailer.destroy_organization_mail(u.user,profile_name).deliver
  79 + end
75 80 redirect_to :controller => 'home'
76 81 else
77 82 session[:notice] = _('Could not delete profile')
... ...
app/mailers/user_mailer.rb
... ... @@ -52,6 +52,11 @@ class UserMailer &lt; ActionMailer::Base
52 52 send_user_mail(user, subject)
53 53 end
54 54  
  55 + def destroy_organization_mail(user,profile)
  56 + @profile = profile
  57 + subject = "[%{environment}] Profile Deleted!" % { :environment => user.environment.name }
  58 + send_user_mail(user, subject)
  59 + end
55 60 def ban_user_mail(user)
56 61 subject = "[%{environment}] User Deactivated!" % { :environment => user.environment.name }
57 62 send_user_mail(user, subject)
... ...
app/views/admin_panel/_organization_search.html.erb
1   -<div class="search-field">
2   -<span class="formfield">
3   - <%= text_field_tag 'q', @q, :title => _("Find software") %>
4   -</span>
5   -<%= submit_button(:search, _('Search')) %>
6   -</div>
  1 + <div class="search-field">
  2 + <span class="formfield">
  3 + <%= text_field_tag 'q', @q, :title => _("Find profiles"), :style=>"width:85%" %>
  4 + </span>
  5 +
  6 + <%= submit_button(:search, _('Search')) %>
  7 + </div>
7 8  
... ...
app/views/user_mailer/destroy_organization_mail.html.erb 0 → 100644
... ... @@ -0,0 +1,12 @@
  1 +<%= _('Hello %s,') % @name %>
  2 +
  3 +<%= _('The profile %s that you are admin was just deleted.') % [@profile] %>
  4 +
  5 +<%= _('Please contact the administrator') %>
  6 +<%= @webmail %>
  7 +
  8 +<%= _('Greetings,') %>
  9 +
  10 +--
  11 +<%= _('%s team.') % @environment %>
  12 +<%= @url %>
... ...