From 3deae3f8e6c6a94a85aa43d481273ac445920acb Mon Sep 17 00:00:00 2001 From: Gabriela Navarro Date: Tue, 9 Sep 2014 11:42:04 -0300 Subject: [PATCH] manage_organization: Send email for deleted organization --- app/controllers/my_profile/profile_editor_controller.rb | 5 +++++ app/mailers/user_mailer.rb | 5 +++++ app/views/admin_panel/_organization_search.html.erb | 13 +++++++------ app/views/user_mailer/destroy_organization_mail.html.erb | 12 ++++++++++++ 4 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 app/views/user_mailer/destroy_organization_mail.html.erb diff --git a/app/controllers/my_profile/profile_editor_controller.rb b/app/controllers/my_profile/profile_editor_controller.rb index d68f9e5..79c5b99 100644 --- a/app/controllers/my_profile/profile_editor_controller.rb +++ b/app/controllers/my_profile/profile_editor_controller.rb @@ -70,8 +70,13 @@ class ProfileEditorController < MyProfileController def destroy_profile if request.post? + send_mail_list = @profile.admins + profile_name = @profile.name if @profile.destroy session[:notice] = _('The profile was deleted.') + send_mail_list.each do |u| + UserMailer.destroy_organization_mail(u.user,profile_name).deliver + end redirect_to :controller => 'home' else session[:notice] = _('Could not delete profile') diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index 3b91cdb..380b5ca 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -52,6 +52,11 @@ class UserMailer < ActionMailer::Base send_user_mail(user, subject) end + def destroy_organization_mail(user,profile) + @profile = profile + subject = "[%{environment}] Profile Deleted!" % { :environment => user.environment.name } + send_user_mail(user, subject) + end def ban_user_mail(user) subject = "[%{environment}] User Deactivated!" % { :environment => user.environment.name } send_user_mail(user, subject) diff --git a/app/views/admin_panel/_organization_search.html.erb b/app/views/admin_panel/_organization_search.html.erb index ea5c1b4..4af20d9 100644 --- a/app/views/admin_panel/_organization_search.html.erb +++ b/app/views/admin_panel/_organization_search.html.erb @@ -1,7 +1,8 @@ -
- - <%= text_field_tag 'q', @q, :title => _("Find software") %> - -<%= submit_button(:search, _('Search')) %> -
+
+ + <%= text_field_tag 'q', @q, :title => _("Find profiles"), :style=>"width:85%" %> + + + <%= submit_button(:search, _('Search')) %> +
diff --git a/app/views/user_mailer/destroy_organization_mail.html.erb b/app/views/user_mailer/destroy_organization_mail.html.erb new file mode 100644 index 0000000..2ca88ee --- /dev/null +++ b/app/views/user_mailer/destroy_organization_mail.html.erb @@ -0,0 +1,12 @@ +<%= _('Hello %s,') % @name %> + +<%= _('The profile %s that you are admin was just deleted.') % [@profile] %> + +<%= _('Please contact the administrator') %> +<%= @webmail %> + +<%= _('Greetings,') %> + +-- +<%= _('%s team.') % @environment %> +<%= @url %> -- libgit2 0.21.2