From e8e37e0a6095ee1e670d6223ae2f658755ffa8fc Mon Sep 17 00:00:00 2001 From: Siddhant Bajaj Date: Sun, 4 Jun 2017 03:33:01 +0530 Subject: [PATCH] Fixed Export Pdf button on admin registration page --- app/controllers/admin/registrations_controller.rb | 7 +++++++ app/views/admin/registrations/index.html.haml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/registrations_controller.rb b/app/controllers/admin/registrations_controller.rb index 2afb8f6a..4d17ee38 100644 --- a/app/controllers/admin/registrations_controller.rb +++ b/app/controllers/admin/registrations_controller.rb @@ -30,6 +30,13 @@ module Admin end end + def show + @file_name = "ticket_for_#{@conference.short_title}" + respond_to do |format| + format.pdf {} + end + end + def destroy if can? :destroy, @registration @registration.destroy diff --git a/app/views/admin/registrations/index.html.haml b/app/views/admin/registrations/index.html.haml index 7e366621..0646744b 100644 --- a/app/views/admin/registrations/index.html.haml +++ b/app/views/admin/registrations/index.html.haml @@ -70,7 +70,7 @@ method: :get, class: 'btn btn-primary' = link_to 'Delete', admin_conference_registration_path(@conference.short_title, registration), method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete the Registration for #{registration.name}?" } - = link_to 'Export Ticket', conference_conference_registration_path(@conference.short_title, format: :pdf), class: 'btn btn-success' + = link_to 'Export Ticket', admin_conference_registration_path(@conference.short_title, registration, format: :pdf), class: 'btn btn-success' - @registrations.each_with_index do |registration, index| .questions{class: "question#{index}", style: 'display:none;'} = render partial: 'questions', locals: { registration: registration }