From 49b85190f2908e2ac44630b2dde748f0bd0edc66 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sat, 12 Oct 2019 20:56:16 +0300 Subject: [PATCH] Add feedback link QR code to confirmation emails --- .../public/event_feedback_qrcodes_controller.rb | 3 +-- app/helpers/application_helper.rb | 8 ++++++++ app/mailers/event_mailer.rb | 5 ++++- app/views/event_mailer/confirmation_request.bg.text.erb | 3 +++ app/views/event_mailer/confirmation_request.en.text.erb | 4 +++- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/app/controllers/public/event_feedback_qrcodes_controller.rb b/app/controllers/public/event_feedback_qrcodes_controller.rb index 5d2586d..c3bad51 100644 --- a/app/controllers/public/event_feedback_qrcodes_controller.rb +++ b/app/controllers/public/event_feedback_qrcodes_controller.rb @@ -1,11 +1,10 @@ class Public::EventFeedbackQrcodesController < Public::ApplicationController def show event = current_conference.events.joins(:proposition).approved.find(params[:event_id]) - @qr = RQRCode::QRCode.new(new_event_feedback_url(event_id: event.id), level: :l) respond_to do |format| format.svg do - render(inline: @qr.as_svg(shape_rendering: "crispEdges", module_size: 11, fill: "ffffff", offset: 10), + render(inline: helpers.feedback_qr_code_as_svg(event.id), filename: "feedback_qr_code_#{event.id}.svg") end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a9fbfa1..978f2f3 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -85,4 +85,12 @@ module ApplicationHelper when 6 then t('ratings.excellent') end end + + def feedback_qr_code(event_id) + RQRCode::QRCode.new(new_event_feedback_url(event_id: event_id), level: :l) + end + + def feedback_qr_code_as_svg(event_id) + feedback_qr_code(event_id).as_svg(shape_rendering: "crispEdges", module_size: 11, fill: "ffffff", offset: 10) + end end diff --git a/app/mailers/event_mailer.rb b/app/mailers/event_mailer.rb index 3df9c14..023dc3c 100644 --- a/app/mailers/event_mailer.rb +++ b/app/mailers/event_mailer.rb @@ -2,7 +2,10 @@ class EventMailer < ActionMailer::Base def confirmation_request(event) @event = event I18n.locale = @event.proposer.language - + attachments['feedback-link-qr-code.svg'] = { + mime_type: 'image/svg+xml', + content: helpers.feedback_qr_code_as_svg(@event.id) + } mail to: @event.proposer.email, from: "program@openfest.org", subject: I18n.t("event_mailer.acceptance_notification.subject", diff --git a/app/views/event_mailer/confirmation_request.bg.text.erb b/app/views/event_mailer/confirmation_request.bg.text.erb index 35909fc..ce5b0ce 100644 --- a/app/views/event_mailer/confirmation_request.bg.text.erb +++ b/app/views/event_mailer/confirmation_request.bg.text.erb @@ -9,6 +9,9 @@ Моля, потвърдете участието си възможно най-скоро като кликнете на следния линк: <%= confirm_event_url @event, host: @event.conference.host_name, protocol: 'https' %> +Моля, добавете прикаченият към този e-mail QR код в презентацията си. Той +съдържа връзка към формуляра за обратна връзка за предложеното от Вас събитие. + Моля пишете на ofvideo@openfest.org, ако имате специфични изисквания, например: * да ви осигурим лаптоп за презентация; diff --git a/app/views/event_mailer/confirmation_request.en.text.erb b/app/views/event_mailer/confirmation_request.en.text.erb index 739bebe..5027dbc 100644 --- a/app/views/event_mailer/confirmation_request.en.text.erb +++ b/app/views/event_mailer/confirmation_request.en.text.erb @@ -9,8 +9,10 @@ It has not been scheduled yet. Please confirm your participation as soon as you can by following the following link: <%= confirm_event_url @event, host: @event.conference.host_name, protocol: 'https' %> +Please make sure you include the QR code attached to this email in your +presentation. It contains a link to the feedback form for your <%= @event.event_type.name.downcase %>. -Please email ofvideo@openfest.org if you hav any specific requirements, for example: +Please email ofvideo@openfest.org if you have any specific requirements, for example: * You need us to provide you with a laptop for your presentation; * You need to play sound for your presentation;