diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index 7319500..bc1afce 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -1,6 +1,6 @@ class MembersController < ApplicationController before_action :require_login - before_action :set_member, only: %i[ show edit update delete destroy ] + before_action :set_member, only: %i[ show edit update delete destroy resend_registration ] helper_method :sort_params include MemberFilter @@ -38,6 +38,12 @@ class MembersController < ApplicationController end end + def resend_registration + NotificationMailer.with(member: @member).registration.deliver_now! + + redirect_to @member, notice: "Payment reminder sent." + end + # PATCH/PUT /members/1 def update if @member.update(member_params) diff --git a/app/views/members/show.html.erb b/app/views/members/show.html.erb index d43ceda..fc6104a 100644 --- a/app/views/members/show.html.erb +++ b/app/views/members/show.html.erb @@ -19,12 +19,15 @@ <%= t('members.attributes.reduced_ifthenpay_link') %><% if @member.reduced_ifthenpay_link %><%= link_to @member.reduced_ifthenpay_link, @member.reduced_ifthenpay_link %><% end %> -
- <%= link_to t('members.show.actions.edit'), edit_member_path(@member) %> -
-
- <%= link_to t('members.show.actions.delete'), delete_member_path(@member) %> -
+
<%= link_to t('members.show.actions.edit'), edit_member_path(@member) %>
+
<%= link_to t('members.show.actions.delete'), delete_member_path(@member) %>
+<%- if @member.status == "pending" %> +
+ <%= form_with url: resend_registration_member_path(@member) do |form| %> + <%= form.submit t('members.show.actions.resend_registration') %> + <% end %> +
+<%- end %>

<%= t('members.show.contribution_history') %>

diff --git a/config/locales/en.yml b/config/locales/en.yml index f2ed6bb..609b887 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -24,6 +24,7 @@ en: title: "Member details" actions: edit: "Edit" + resend_registration: "Send initial payment email reminder" edit: title: "Edit member details" actions: diff --git a/config/locales/pt.yml b/config/locales/pt.yml index f5e66d8..7a64cf8 100644 --- a/config/locales/pt.yml +++ b/config/locales/pt.yml @@ -40,6 +40,7 @@ pt: edit_contribution: "Editar" delete_contribution: "Apagar" deliver_notification: "Enviar agora" + resend_registration: "Enviar lembrete para pagamento inicial" contribution_history: "Histórico de contribuições" notifications: "Notificações por correio electrónico" contribution_actions: "Acções" diff --git a/config/routes.rb b/config/routes.rb index b9a2591..718a03d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -9,6 +9,7 @@ Rails.application.routes.draw do resources :members do member do get :delete + post :resend_registration end resources :contributions, only: [:new, :create] end