Commit 3deae3f8e6c6a94a85aa43d481273ac445920acb
1 parent
cbfe27a9
Exists in
merge_deactive_and_ban
manage_organization: Send email for deleted organization
Signed-off-by: David Carlos <ddavidcarlos1392@gmail.com> Signed-off-by: Gabriela Navarro <navarro1703@gmail.com>
Showing
4 changed files
with
29 additions
and
6 deletions
Show diff stats
app/controllers/my_profile/profile_editor_controller.rb
| @@ -70,8 +70,13 @@ class ProfileEditorController < MyProfileController | @@ -70,8 +70,13 @@ class ProfileEditorController < MyProfileController | ||
| 70 | 70 | ||
| 71 | def destroy_profile | 71 | def destroy_profile |
| 72 | if request.post? | 72 | if request.post? |
| 73 | + send_mail_list = @profile.admins | ||
| 74 | + profile_name = @profile.name | ||
| 73 | if @profile.destroy | 75 | if @profile.destroy |
| 74 | session[:notice] = _('The profile was deleted.') | 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 | redirect_to :controller => 'home' | 80 | redirect_to :controller => 'home' |
| 76 | else | 81 | else |
| 77 | session[:notice] = _('Could not delete profile') | 82 | session[:notice] = _('Could not delete profile') |
app/mailers/user_mailer.rb
| @@ -52,6 +52,11 @@ class UserMailer < ActionMailer::Base | @@ -52,6 +52,11 @@ class UserMailer < ActionMailer::Base | ||
| 52 | send_user_mail(user, subject) | 52 | send_user_mail(user, subject) |
| 53 | end | 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 | def ban_user_mail(user) | 60 | def ban_user_mail(user) |
| 56 | subject = "[%{environment}] User Deactivated!" % { :environment => user.environment.name } | 61 | subject = "[%{environment}] User Deactivated!" % { :environment => user.environment.name } |
| 57 | send_user_mail(user, subject) | 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 @@ | @@ -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 %> |