Skip to content

Commit

Permalink
Add sponsor message + add welcome, refactor later (#336)
Browse files Browse the repository at this point in the history
  • Loading branch information
hundred authored Nov 28, 2023
1 parent 4c87fc8 commit 080cf4d
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 110 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
class Admin::CoachRegistrationsAttendancesController < Admin::CoachRegistrationsController


def update
@registration = CoachRegistration.find(params[:coach_registration_id])
@registration.update!(accepted: true, invitation_sent_at: Time.now, terms_of_service: true)
event = Event.find(params[:event_id])
CoachRegistrationMailer.coach_accepted(event, @registration).deliver_now
redirect_to admin_event_path(params[:event_id])
end

def send_welcome_email
registration = CoachRegistration.find(params[:coach_registration_id])
registration.event.welcome(:welcome_coaches, registration.coach)

redirect_back(fallback_location: admin_event_path(params[:event_id]))
end
end
8 changes: 8 additions & 0 deletions app/controllers/admin/invitations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ def resend_invite
redirect_back(fallback_location: events_path(params[:event_id]))
end

def send_welcome_email
invitation = Invitation.find(params[:id])
event = invitation.invitable
event.welcome(:welcome_message, invitation.invitee)

redirect_back(fallback_location: events_path(params[:event_id]))
end

def show
@invitation = Invitation.find_by_token params[:id]
end
Expand Down
1 change: 0 additions & 1 deletion app/mailers/event_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,5 @@ def setup_for_feedback event, registration
def setup_for_welcome_message event, registration
@event = event
@registration = registration
load_attachments
end
end
14 changes: 5 additions & 9 deletions app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,16 @@ def send_reminder(invitation)
EventMailer.send(:invitation_reminder, self, invitation.invitee, invitation).deliver_now
end

def send_welcome(invitation)
EventMailer.send(:welcome_message, self, invitation.invitee).deliver_now
end

def send_reminders
attending_students.each {|student| send_welcome(student.invitation) }
def welcome_students
attending_students.each {|student| welcome(:welcome_message, student.invitation.invitee) }
end

def welcome_coaches
coaches.each {|coach| welcome(coach) }
coaches.each {|coach| welcome(:welcome_coaches, coach) }
end

def welcome(coach)
EventMailer.send(:welcome_coaches, self, coach).deliver_now
def welcome(type_of_message, recipient)
EventMailer.send(type_of_message, self, recipient).deliver_now
end

def attending_students
Expand Down
2 changes: 2 additions & 0 deletions app/views/admin/shared/_coach_registrations.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@

- if registration.accepted?
%td= registration.comment
%td
= link_to 'Send Welcome', send_welcome_email_admin_event_coach_registration_coach_registrations_attendance_path(@event, registration), method: :post, class: "btn btn-success"

%td= registration.details

Expand Down
5 changes: 4 additions & 1 deletion app/views/admin/shared/_invitations.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,7 @@
- else
-invitation_attendance_label(invitation)
%td
= link_to "Resend Invite", resend_invite_admin_event_invitation_path(invitable, invitation.id), method: :put, class: "btn btn-primary"
= link_to "Resend Invite", resend_invite_admin_event_invitation_path(invitable, invitation.id), method: :post, class: "btn btn-primary"
%td
= link_to "Send Welcome", send_welcome_email_admin_event_invitation_path(invitable, invitation.id), method: :post, class: "btn btn-primary"

6 changes: 3 additions & 3 deletions app/views/event_mailer/welcome_coaches.haml
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@
%p
%b
Please arrive on Friday #{@event.start_date} by 18:30pm. We will finish around 21:15pm.
We will have students arriving between 18:30pm and 19:30pm, usually quite a few people are coming late. We are expecting around 170 students & 120 coaches, so there will be a large number of people.
We will have students arriving between 18:30pm and 19:30pm, usually quite a few people are coming late. We are expecting around 130 students & 70 coaches, so there will be a large number of people.
%br
On your arrival, please sign in at the reception desk.
%br
We will be giving out name badges for the event. If you have any problems, please contact the organisers on 07792 142702.
We will be giving out name badges for the event. If you have any problems, please contact the organisers on 07792142702.

%p
Once you are at the venue:
%br
There will be food, drinks, DJ and good vibe throughout the evening. Great time to chat with people!
There will be food, drinks and good vibe throughout the evening. Great time to chat with people!

%p
What you are expected to do:
Expand Down
94 changes: 9 additions & 85 deletions app/views/shared/mailers/_word_from_sponsors.haml
Original file line number Diff line number Diff line change
Expand Up @@ -14,88 +14,13 @@
%tr
%td{colspan: "2", align: 'left', valign: 'middle'}
%p
Hi There, my name is Sam, I’m CTO here at Smart and I am very excited to be welcoming you when you arrive at our offices on Friday. You’ll find that we are a fun and collaborative bunch of people in our awesome new HQ which is a perfect place to learn how to code. We’ve made a name for ourselves by disrupting the financial industry, this is down to having good quality code and ways of working, but also a great engineering culture which I know you will enjoy witnessing when you visit us. You will also hear from some wonderful women who work in our engineering team and they will tell you how they grew their careers in technology. Oh and fun fact, Maria who runs Rails Girls London also works here at Smart so get ready to meet some truly great and inspirational women.
%p
What do we do? Our mission is to transform retirement, savings and financial well-being, across all generations, around the world. We have millions of customers and look after billions of their money in various currencies in the UK, Ireland, Dubai, USA and even Hong Kong.
Hello, I'm Sam, CTO here at Smart and I am looking forward to welcoming you when you arrive at our offices on Friday. We hosted Rails Girls London last year and based on that I can promise you it will be an amazing experience, the team are incredibly experienced and you will have lots of fun. Plus, this is an extra special Rails Girls London it's their tenth anniversary - just think how many women they have helped get into tech in that time! I'm sure you will hear all about it from Maria who runs Rails Girls London, but also works here at Smart.

%p
📣 Check out this year's hackathon:
%a{href: "https://www.linkedin.com/posts/sambarton_quick-photo-dump-from-todays-hackathon-activity-6933093294205775872-LWGu"} photos
and
%a{href: "https://www.linkedin.com/posts/sambarton_smart-snap-19-smart-hackathon-2022-activity-6955885672024920064-IXOL"} video
This is an awesome event, one we are incredibly proud to be part of and I am genuinely looking forward to meeting you soon!
%br
Like what you see? Why not come and join us:
%a{href: "https://www.smart.co/careers"} smart.co/careers
%table.mailer--separator
%thead
%tr
%tbody
%tr
%td
%b
Cookpad
%td{align: 'right'}
= image_tag email_sponsor_logo(@event, "Cookpad"), class: 'sponsor-logo--item'
%tr
%td{colspan: "2", align: 'left', valign: 'middle'}
%p
Cookpad's mission is simply to "make everyday cooking fun", and with 100 million home cooks using our services globally every month - all via our Rails platform - this is a mission we know has true meaning and value to real people the world over.
%p
Cookpad supports many events, meetups and conferences and we're thrilled to be able to help Rails Girls London again this year with this great event introducing more people to the wonderful world of Ruby on Rails.
%p
If you really enjoy the workshop, want to learn more, and have an interest in helping the world to enjoy everyday cooking, talk to one of our team as we are here to help you build on what you learned today, and potentially take the first steps into a career in software development.
%p
To read more about life at Cookpad, visit
%a{href: "https://careers.cookpad.com"} careers.cookpad.com
or talk to one of the team at the event.
%table.mailer--separator
%thead
%tr
%tbody
%tr
%td
%b
Generation Home
%td{align: 'right'}
= image_tag email_sponsor_logo(@event, "Generation Home"), class: 'sponsor-logo--item'
%tr
%td{colspan: "2", align: 'left', valign: 'middle'}
%p
Hi! It’s
%a{href: "https://www.linkedin.com/in/sophia-guy-white-84254a27/"} Sophia
\- co-founder at
%a{href: "https://www.generationhome.com/"} Generation Home
, and I’ll be joining you at Rails Girls as sponsor and fellow student!
%p
🏠 We're a mortgage lender transforming how people buy homes in the UK.
%br
🚀 Founded in 2020, we're a humble, customer-focused team that's put 1000+ into homes.
%br
We're bringing coaches from our
%a{href: "https://genhome.notion.site/genhome/Gen-H-Handbook-for-Candidates-686e73d3c9a645f88d2e89723556b362?p=5d15ef69766b46519b0e0ce8dbbe6c5e&pm=c"} product engineering team
to help create a more
%a{href: "https://genhome.notion.site/genhome/Gen-H-Handbook-for-Candidates-686e73d3c9a645f88d2e89723556b362?p=7d666644590b4d4c916d0a1eb4d30846&pm=c"} diverse
generation of coders.
%p
Want to learn more about the company or mortgages? Come say hi, check out our
%a{href: "https://boards.eu.greenhouse.io/generationhome"} careers
page, or follow us on
%a{href: "https://www.linkedin.com/company/generationhome"} LinkedIn
and
%a{href: "https://www.instagram.com/generation_home/"} Instagram.
%p
See you there!
%br
Sophia / Gen H
Want a sneak peek at what the event will be like? Here are
%a{href: "https://www.linkedin.com/posts/sambarton_railsgirlsldn-rubyonrails-activity-6997830585876373504-GSpK"} some snaps I took of last years event.
%table.mailer--separator
%thead
Expand All @@ -110,16 +35,15 @@
%tr
%td{colspan: "2", align: 'left', valign: 'middle'}
%p
We are SUPER excited to be sponsoring Rails Girls London and we can’t wait to see how you all get on!
We are SUPER excited to be sponsoring Rails Girls London again this year. We can’t wait to see how you all get on over the weekend!
%p
At Cleo, we’re on a mission to help millions of people improve their financial health. Cleo helps people make better money decisions and habits by providing budgeting, savings and spendings insights that you can’t get anywhere else.
At Cleo, we’re on a mission to help millions of people live beyond their next paycheck.
%p
Backed by some of the most well-known investors in tech, we’ve reached over 4 million users and plan to double that number each year!
Cleo is an AI assistant that helps people make better money decisions and habits. She provides users with budgeting, savings and spendings insights that they can’t get anywhere else. Backed by some of the most well-known investors in tech, we’ve reached over 7 million users and we're looking to grow that number.
%p
We love to meet adaptable, creative and product-focussed engineers! If this sounds like you, check out our open roles:
%a{href: "https://web.meetcleo.com/careers"} web.meetcleo.com/careers
To serve more users, we need more great people. We love to meet adaptable, creative and product-focussed engineers. If this sounds like you, check out our open roles:
%a{href: "https://web.meetcleo.com/careers"} web.meetcleo.com/careers.
7 changes: 5 additions & 2 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,17 @@
resources :invitations, only: [ :show ], :invitable_type => 'Event', :invitable_id => 'event_id' do
post 'create', on: :collection
member do
put 'resend_invite'
post :resend_invite
post :send_welcome_email
end
end
resources :registrations, only: [:show, :new, :create, :edit, :update, :destroy] do
resource :attendance, only: [:create, :destroy]
end
resources :coach_registrations, only: [:show, :new, :create, :update, :destroy] do
resource :coach_registrations_attendance, only: [:update]
resource :coach_registrations_attendance, only: [:update] do
post :send_welcome_email, on: :member
end
resources :suggested_matches, only: [:index, :create, :update]
end
end
Expand Down
16 changes: 8 additions & 8 deletions spec/mailers/previews/event_mailer_preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,23 @@ def coaches_instruction
EventMailer.coaches_instruction(event, coach)
end

def welcome_coaches
event = Event.next_event
coach = event.coaches.first
EventMailer.welcome_coaches(event, coach)
end

def invitation_reminder
event = Event.next_event
invitation = event.invitations.pending_response.first
registration = invitation.invitee
EventMailer.invitation_reminder(event, registration, invitation)
end

def welcome_coaches
event = Event.next_event
coach = event.coaches.first
EventMailer.send(:welcome_coaches, event, coach)
end

def welcome_message
event = Event.next_event
registration = Registration.find(945)
EventMailer.welcome_message(event, registration)
student = event.attending_students.first.invitation
EventMailer.send(:welcome_message, event, student.invitee)
end

def newsletter
Expand Down

0 comments on commit 080cf4d

Please sign in to comment.