Zestawienie dotacji
+ <% @dotations.each do |dotation| %> ++
+
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 2a8b55b..e4b1856 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -25,6 +25,12 @@ class HomeController < ApplicationController def show @dotation = Dotation.friendly.find(params[:id]) @company_sizes = CompanySize.all + respond_to do |format| + format.html + format.pdf do + render pdf: @dotation.safe_id # Excluding ".pdf" extension. + end + end end def emailfilter @@ -38,7 +44,15 @@ class HomeController < ApplicationController end def prepare_pdf - + filters = JSON.parse(cookies[:filter]).transform_keys(&:to_sym) + @company_sizes = CompanySize.all + @dotations = Dotation.search_with_filters(filters).public_dot + .point_desc.end_date_asc + respond_to do |format| + format.pdf do + render pdf: "zestawienie_dotacji_#{Time.now.strftime('%d%m%Y')}" + end + end end private diff --git a/app/views/experts/_expert_show.pdf.erb b/app/views/experts/_expert_show.pdf.erb new file mode 100644 index 0000000..ba66bfc --- /dev/null +++ b/app/views/experts/_expert_show.pdf.erb @@ -0,0 +1,15 @@ +
| <%= dotation.name %> | |
|---|---|
| <%= dotation.formal_name %> | +|
| Składanie wniosków | +od <%= dotation.start_date.strftime("%d-%m-%Y") %> do <%= dotation.end_date.strftime("%d-%m-%Y") %> | +
| Lokalizacja: | +<%= dotation.localization %> | +
| + Wartość projektu + | ++ do <%= change_ammount(dotation.max_amount) %> <%= dotation.max_amount_curr.name %> + | +
| Poziom dofinansowania | +do <%= dotation.max_percent %>% dotacji | +
| Co można dofinansować? | ++ <% max_expense = dotation.expenses.count %> + <% dotation.expenses.limit(5).each_with_index do |expense, index| %> + <%= expense.name %> + <% if index < max_expense - 1 && index < 4 %> + <%= ', ' -%> + <% elsif max_expense > 5 %> + <%= '...' -%> + <% end %> + <% end %> + | +
Wyszukiwana fraza:
diff --git a/app/views/home/_show.pdf.erb b/app/views/home/_show.pdf.erb
new file mode 100644
index 0000000..23fd393
--- /dev/null
+++ b/app/views/home/_show.pdf.erb
@@ -0,0 +1,129 @@
+
| Subiektywna opinia eksperta | |
|---|---|
| + <%= render '/experts/expert_show', expert: dotation.expert %> + | +<%= raw dotation.expert_info %> | +
| + Ogłoszenie aktualnego/najbliższego naboru + | +<%= dotation.announcement_date.strftime("%Y-%m-%d") unless dotation.announcement_date.blank? %> | +
| + Rozpoczęcie aktualnego/najbliższego naboru + | +<%= dotation.start_date.strftime("%Y-%m-%d") unless dotation.start_date.blank? %> | +
| + Zakończenie aktualnego/najbliższego naboru + | +<%= dotation.end_date.strftime("%Y-%m-%d") unless dotation.end_date.blank? %> | +
| + Co można dofinansować? + | +
+
|
+
| + Miejsce realizacji projektu + | +<%= dotation.localization %> | +
| + Minimalna wartość projektu (wydatków) + | +<%= change_ammount(dotation.min_amount) %> <%= dotation.min_amount_curr.name %> | +
| + Maksymalna wartość projektu (wydatków) + | +<%= change_ammount(dotation.max_amount) %> <%= dotation.max_amount_curr.name %> | +
+
|
+
+
+
+ <%= image_tag partner.logo, height: 40 %>
+
+
+
+
+ <%= partner.name %>
+
+ |
+ <%= raw partner.description %> | +