mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +02:00
105842700-file_generation_changed
This commit is contained in:
parent
2748f3be55
commit
cd8feaf553
4 changed files with 15 additions and 7 deletions
|
@ -33,8 +33,11 @@ class Registrant::DomainsController < RegistrantController
|
||||||
end
|
end
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.csv { render text: @domains.result.to_csv }
|
||||||
format.csv { render text: @domains.to_csv }
|
format.pdf do
|
||||||
|
pdf = @domains.result.pdf(render_to_string('registrant/domains/download_list', layout: false))
|
||||||
|
send_data pdf, filename: 'domains'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -783,5 +783,10 @@ class Domain < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.pdf(html)
|
||||||
|
kit = PDFKit.new(html)
|
||||||
|
kit.to_pdf
|
||||||
|
end
|
||||||
end
|
end
|
||||||
# rubocop: enable Metrics/ClassLength
|
# rubocop: enable Metrics/ClassLength
|
||||||
|
|
|
@ -39,8 +39,8 @@
|
||||||
Download
|
Download
|
||||||
%span.caret
|
%span.caret
|
||||||
%ul.dropdown-menu
|
%ul.dropdown-menu
|
||||||
%li= link_to 'PDF', download_list_registrant_domain_path(params[:q], format: "pdf")
|
%li= link_to 'PDF', download_list_registrant_domains_path(params[:q], format: "pdf")
|
||||||
%li= link_to 'CSV', download_list_registrant_domain_path(params[:q], format: "csv")
|
%li= link_to 'CSV', download_list_registrant_domains_path(params[:q], format: "csv")
|
||||||
.col-md-3
|
.col-md-3
|
||||||
.col-md-3
|
.col-md-3
|
||||||
.col-md-3
|
.col-md-3
|
||||||
|
|
|
@ -103,7 +103,7 @@ Rails.application.routes.draw do
|
||||||
root 'domains#index'
|
root 'domains#index'
|
||||||
|
|
||||||
resources :domains do
|
resources :domains do
|
||||||
member do
|
collection do
|
||||||
get :download_list
|
get :download_list
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue