Add event feedback QR codes

This commit is contained in:
Petko Bordjukov 2017-10-22 23:24:28 +03:00
parent 3384a73204
commit 47d2ec99b1
6 changed files with 23 additions and 0 deletions

View File

@ -56,6 +56,8 @@ gem 'search_object'
gem 'faraday' gem 'faraday'
gem 'rqrcode'
group :development do group :development do
gem 'spring' gem 'spring'
gem 'spring-commands-rspec' gem 'spring-commands-rspec'

View File

@ -89,6 +89,7 @@ GEM
mime-types (>= 1.16) mime-types (>= 1.16)
mimemagic (>= 0.3.0) mimemagic (>= 0.3.0)
choice (0.2.0) choice (0.2.0)
chunky_png (1.3.8)
coderay (1.1.1) coderay (1.1.1)
coffee-rails (4.2.1) coffee-rails (4.2.1)
coffee-script (>= 2.2.0) coffee-script (>= 2.2.0)
@ -284,6 +285,8 @@ GEM
mime-types (>= 1.16, < 3.0) mime-types (>= 1.16, < 3.0)
netrc (~> 0.7) netrc (~> 0.7)
rmagick (2.16.0) rmagick (2.16.0)
rqrcode (0.10.1)
chunky_png (~> 1.0)
rspec (3.5.0) rspec (3.5.0)
rspec-core (~> 3.5.0) rspec-core (~> 3.5.0)
rspec-expectations (~> 3.5.0) rspec-expectations (~> 3.5.0)
@ -423,6 +426,7 @@ DEPENDENCIES
refile refile
refile-mini_magick refile-mini_magick
rmagick rmagick
rqrcode
rspec-rails rspec-rails
sass-rails sass-rails
search_object search_object

View File

@ -0,0 +1,13 @@
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),
filename: "feedback_qr_code_#{event.id}.svg")
end
end
end
end

View File

@ -10,5 +10,6 @@
json.track_id event.track_id json.track_id event.track_id
json.participant_user_ids event.participations.map(&:participant_id) json.participant_user_ids event.participations.map(&:participant_id)
json.feedback_url new_event_feedback_url(event_id: event.id) json.feedback_url new_event_feedback_url(event_id: event.id)
json.feedback_qr_code_url event_feedback_qr_code_url(event_id: event.id, format: :svg)
end end
end end

View File

@ -2,3 +2,5 @@
# Add new mime types for use in respond_to blocks: # Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf # Mime::Type.register "text/richtext", :rtf
Mime::Type.register "image/svg+xml", :svg

View File

@ -6,6 +6,7 @@ Rails.application.routes.draw do
resource :personal_profile, path: 'profile' resource :personal_profile, path: 'profile'
resources :events do resources :events do
resources :feedbacks, controller: 'event_feedbacks', only: [:new, :create] resources :feedbacks, controller: 'event_feedbacks', only: [:new, :create]
resource :feedback_qr_code, controller: 'event_feedback_qrcodes', only: :show
member do member do
get :confirm get :confirm
end end