diff --git a/app/views/plans/index.html.erb b/app/views/plans/index.html.erb index b1b4e8a..b40d24f 100644 --- a/app/views/plans/index.html.erb +++ b/app/views/plans/index.html.erb @@ -39,47 +39,40 @@ <% if plan.editable_by?(current_user.id) then %> - <%= link_to raw(''), + <%= link_to _('Edit'), plan_path(plan), - class: "dmp_table_link", - title: _('Edit') %> + class: "dmp_table_link" %> <% if plan.administerable_by?(current_user.id) then %> - <%= link_to raw(''), + <%= link_to _('Share'), share_plan_path(plan), - class: "dmp_table_link", - title: _('Share') %> + class: "dmp_table_link" %> <% end %> - <%= link_to raw(''), + <%= link_to _('Export'), show_export_plan_path(plan), - class: "dmp_table_link", - title: _('Export') %> + class: "dmp_table_link" %> - <%= link_to raw(''), + <%= link_to _('Duplicate'), duplicate_plan_path(plan), - class: "dmp_table_link", - title: _('Copy/Duplicate') %> + class: "dmp_table_link" %> <% if plan.owned_by?(current_user.id) then %> - <%= link_to raw(''), + <%= link_to _('Delete'), plan_path(plan), class: "dmp_table_link", - title: _('Delete'), method: :delete, data: {confirm: _('Are you sure you wish to delete this plan? If the plan is being shared with other users, by deleting it from your list, the plan will be deleted from their plan list as well')} %> <% end %> <% else %> - <%= link_to raw(''), + <%= link_to _('View'), plan_path(plan), - class: "dmp_table_link", - title: _('View') %> + class: "dmp_table_link" %> - <%= link_to raw(''), + <%= link_to _('Export'), show_export_plan_path(plan), - class: "dmp_table_link", - title: _('Export') %> + class: "dmp_table_link" %> <% end %> diff --git a/app/views/plans/public_export.pdf.erb b/app/views/plans/public_export.pdf.erb new file mode 100644 index 0000000..b9ab084 --- /dev/null +++ b/app/views/plans/public_export.pdf.erb @@ -0,0 +1,68 @@ + + + + + + <%= @plan.title %> + + + + +

<%= @plan.title %>

+ <% @exported_plan.admin_details.each do |field| + value = @exported_plan.send(field) + if value.present? %> +

<%= admin_field_t(field.to_s) -%> <%= value -%>

+ <% else %> +

<%= admin_field_t(field.to_s) -%> <%= _('-') %>

+ <% end %> + <% end %> + + <% @exported_plan.sections.each do |section| %> + <% questions = @exported_plan.questions_for_section(section.id) + if questions.present? + %> +

<%= section.title %>

+ <% questions.each do |question| %> +
+

<%= raw question.text %>

+ <% answer = @plan.answer(question.id, false) %> + <% if answer.nil? then %> +

<%= _('Question not answered.') -%>

+ <% else %> + <% q_format = question.question_format %> + <% if q_format.option_based? %> + + + <% if question.option_comment_display == true then%> + <% if !answer.text.nil? then %> + <%= raw answer.text.gsub(/(\s||<\/td>| )*(<\/tr>|)/,"") %> + <%end%> + <%end%> + <%else%> + + <% if !answer.text.nil? then %> + <%= raw answer.text.gsub(/(\s||<\/td>| )*(<\/tr>|)/,"") %> + <%end%> + <% end %> + <% end %> +
+ <% end %> + <% end %> + <% end %> + + \ No newline at end of file diff --git a/app/views/plans/public_index.html.erb b/app/views/plans/public_index.html.erb index 0542cfe..423e789 100644 --- a/app/views/plans/public_index.html.erb +++ b/app/views/plans/public_index.html.erb @@ -30,10 +30,9 @@ <%= plan.owner.org.name %> <%= plan.owner.name %> - <%= link_to raw(''), - public_export_path(plan), - class: "dmp_table_link", - title: _('Download PDF') %> + <%= link_to _('PDF'), + public_export_path(plan, format: :pdf), + class: "dmp_table_link" %> <% end %>