Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Commit

Permalink
Merge pull request #252 from TechforgoodCAST/dev
Browse files Browse the repository at this point in the history
v0.3.20
  • Loading branch information
jdudley1123 authored Apr 2, 2020
2 parents a734f26 + 91d9514 commit 6a6b9ba
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/controllers/support_requests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def create
@request = authorize @offer.support_requests.create(support_request_params)

if @request.save
NotificationsMailer.support_requested(@request).deliver_now
NotificationsMailer.support_requested(@request, @project).deliver_now
redirect_to project_url(@project)
flash[:notice] = 'Support request sent! You should hear back soon.'
else
Expand Down
3 changes: 2 additions & 1 deletion app/mailers/notifications_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ def debrief_overdue(iteration)
mail to: emails, subject: 'Debrief overdue!'
end

def support_requested(support_request)
def support_requested(support_request, project)
@request = support_request
@project = project
@beneficiary = @request.on_behalf_of || @request.requester
@offer = support_request.offer
@mentor = emails_by_role(@request, %w[mentor])
Expand Down
2 changes: 1 addition & 1 deletion app/views/notifications_mailer/support_requested.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h1>New support request</h1>

<p><%= @request.requester.full_name %> (cc'd) from CharityName has just expressed interest in a <%= @request.offer.title %> with you (<%= @request.offer.provider.name %>).</p>
<p><%= @request.requester.full_name %> (cc'd) from <%= @project.title %> has just expressed interest in a <%= @request.offer.title %> with you (<%= @request.offer.provider.name %>).</p>

<p>Reply to this email to let them know if this is something you can help them with.</p>

Expand Down
2 changes: 1 addition & 1 deletion app/views/offers/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</div>

<div class="mb-6">
<p>Run by: <%= link_to @offer.provider.name, @offer.provider.website, class: 'link', target: '_blank' %></p>
<p>Provided by: <%= link_to @offer.provider.name, @offer.provider.website, class: 'link', target: '_blank' %></p>
<p>Duration: <%= @offer.duration_description %></p>
</div>

Expand Down
2 changes: 2 additions & 0 deletions app/views/topics/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@
</div>
<% end %>
</div>
<% unless @project.members('mentor').empty? %>
<div class="mx-12">
<p>If the support you're looking for isn't listed here, get in touch with your coach <%= @project.members('mentor')[0].full_name %>.</p>
</div>
<% end %>
</div>
</div>
</div>
6 changes: 5 additions & 1 deletion app/views/topics/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
<% offers.each do |offer| %>
<div>
<h3 class="mb-3"><%= offer.title %></h3>

<div class="mb-6">
<p>Provided by: <%= link_to offer.provider.name, offer.provider.website, class: 'link', target: '_blank' %></p>
<p>Duration: <%= offer.duration_description %></p>
</div>

<div class="rich-text border-none p-0 mb-5">
<%= offer.short_description&.html_safe %>
</div>
Expand Down
2 changes: 1 addition & 1 deletion test/mailers/notifications_mailer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class NotificationsMailerTest < ActionMailer::TestCase
@offer = build(:offer)
@request = build(:support_request, requester: @user, message: 'Test', offer: @offer, project: @project)

mail = NotificationsMailer.support_requested(@request)
mail = NotificationsMailer.support_requested(@request, @project)
assert_equal('New support request', mail.subject)
assert_equal([@offer.provider_email], mail.to)
assert_equal([@user.email], mail.cc)
Expand Down

0 comments on commit 6a6b9ba

Please sign in to comment.