mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 21:25:39 +02:00
Convert HAML to ERB
This commit is contained in:
parent
199085f8ac
commit
7fbf21daf8
6 changed files with 75 additions and 62 deletions
|
@ -20,8 +20,10 @@ class Registrant::DomainsController < RegistrantController
|
||||||
send_data raw_csv, filename: 'domains.csv', type: "#{Mime[:csv]}; charset=utf-8"
|
send_data raw_csv, filename: 'domains.csv', type: "#{Mime[:csv]}; charset=utf-8"
|
||||||
end
|
end
|
||||||
format.pdf do
|
format.pdf do
|
||||||
@domains = domains
|
view = ActionView::Base.new(ActionController::Base.view_paths, domains: domains)
|
||||||
raw_pdf = domains.pdf(render_to_string('registrant/domains/download_list', layout: false))
|
raw_html = view.render(file: 'registrant/domains/download_list', layout: false)
|
||||||
|
raw_pdf = domains.pdf(raw_html)
|
||||||
|
|
||||||
send_data raw_pdf, filename: 'domains.pdf'
|
send_data raw_pdf, filename: 'domains.pdf'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -45,8 +45,11 @@ class Registrar
|
||||||
send_data raw_csv, filename: 'contacts.csv', type: "#{Mime[:csv]}; charset=utf-8"
|
send_data raw_csv, filename: 'contacts.csv', type: "#{Mime[:csv]}; charset=utf-8"
|
||||||
end
|
end
|
||||||
format.pdf do
|
format.pdf do
|
||||||
@contacts = contacts
|
view = ActionView::Base.new(ActionController::Base.view_paths, contacts: contacts)
|
||||||
raw_pdf = contacts.pdf(render_to_string('registrar/contacts/download_list', layout: false))
|
view.class_eval { include ::ApplicationHelper }
|
||||||
|
raw_html = view.render(file: 'registrar/contacts/download_list', layout: false)
|
||||||
|
raw_pdf = contacts.pdf(raw_html)
|
||||||
|
|
||||||
send_data raw_pdf, filename: 'contacts.pdf'
|
send_data raw_pdf, filename: 'contacts.pdf'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
!!!
|
|
||||||
%html
|
|
||||||
%head
|
|
||||||
%meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"}
|
|
||||||
%title Contacts
|
|
||||||
%body
|
|
||||||
.col-md-12
|
|
||||||
.table-responsive
|
|
||||||
%table.table.table-hover.table-bordered.table-condensed
|
|
||||||
%thead
|
|
||||||
%tr
|
|
||||||
%th{class: 'col-xs-2'}
|
|
||||||
=t(:name)
|
|
||||||
%th{class: 'col-xs-2'}
|
|
||||||
=t('.registrant')
|
|
||||||
%th{class: 'col-xs-2'}
|
|
||||||
=t(:valid_to)
|
|
||||||
%th{class: 'col-xs-2'}
|
|
||||||
=t(:registrar_name)
|
|
||||||
%tbody
|
|
||||||
- @domains.each do |x|
|
|
||||||
%tr
|
|
||||||
%td= x.name
|
|
||||||
%td= x.registrant
|
|
||||||
%td= l(x.valid_to, format: :short)
|
|
||||||
%td= x.registrar
|
|
||||||
.row
|
|
||||||
.col-md-6
|
|
32
app/views/registrant/domains/download_list.html.erb
Normal file
32
app/views/registrant/domains/download_list.html.erb
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-hover table-bordered table-condensed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="col-xs-2"><%= t(:name) %></th>
|
||||||
|
<th class="col-xs-2"><%= t('.registrant') %></th>
|
||||||
|
<th class="col-xs-2"><%= t(:valid_to) %></th>
|
||||||
|
<th class="col-xs-2"><%= t(:registrar_name) %></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<% @domains.each do |x| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= x.name %></td>
|
||||||
|
<td><%= x.registrant %></td>
|
||||||
|
<td><%= l(x.valid_to, format: :short) %></td>
|
||||||
|
<td><%= x.registrar %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -1,30 +0,0 @@
|
||||||
!!!
|
|
||||||
%html
|
|
||||||
%head
|
|
||||||
%meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"}
|
|
||||||
%title Contacts
|
|
||||||
%body
|
|
||||||
.row
|
|
||||||
.col-md-12
|
|
||||||
.table-responsive
|
|
||||||
%table.table.table-hover.table-bordered.table-condensed
|
|
||||||
%thead
|
|
||||||
%tr
|
|
||||||
%th{class: 'col-xs-2'}
|
|
||||||
=t(:name)
|
|
||||||
%th{class: 'col-xs-2'}
|
|
||||||
=t(:id)
|
|
||||||
%th{class: 'col-xs-2'}
|
|
||||||
=t(:ident)
|
|
||||||
%th{class: 'col-xs-2'}
|
|
||||||
=t(:created_at)
|
|
||||||
%th{class: 'col-xs-2'}
|
|
||||||
=t(:registrar_name)
|
|
||||||
%tbody
|
|
||||||
- @contacts.each do |contact|
|
|
||||||
%tr
|
|
||||||
%td= contact
|
|
||||||
%td= contact.code
|
|
||||||
%td= ident_for(contact)
|
|
||||||
%td= l(contact.created_at, format: :short)
|
|
||||||
%td= contact.registrar
|
|
34
app/views/registrar/contacts/download_list.html.erb
Normal file
34
app/views/registrar/contacts/download_list.html.erb
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-hover table-bordered table-condensed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="col-xs-2"><%= t(:name) %></th>
|
||||||
|
<th class="col-xs-2"><%= t(:id) %></th>
|
||||||
|
<th class="col-xs-2"><%= t(:ident) %></th>
|
||||||
|
<th class="col-xs-2"><%= t(:created_at) %></th>
|
||||||
|
<th class="col-xs-2"><%= t(:registrar_name) %></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<% @contacts.each do |contact| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= contact %></td>
|
||||||
|
<td><%= contact.code %></td>
|
||||||
|
<td><%= ident_for(contact) %></td>
|
||||||
|
<td><%= l(contact.created_at, format: :short) %></td>
|
||||||
|
<td><%= contact.registrar %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Add table
Add a link
Reference in a new issue