diff --git a/app/views/tpi/ascor/_assessment.html.erb b/app/views/tpi/ascor/_assessment.html.erb index 1db2dd630..d0149efaa 100644 --- a/app/views/tpi/ascor/_assessment.html.erb +++ b/app/views/tpi/ascor/_assessment.html.erb @@ -21,46 +21,10 @@
- <% ascor_sub_indicators_for(area, indicators).each do |indicator| %> -
-
-
- <%= "#{indicator.code.split('.').last}. #{indicator.text}" %> -
- <% if ascor_assessment_result_for(indicator, @assessment).source.present? %> -
- <%= link_to 'Source', ascor_assessment_result_for(indicator, @assessment).source %> -
- <% end %> -
- - <% ascor_sub_indicators_for(indicator, metrics).each do |metric| %> - <% next if metric.code == 'EP.1.a.ii' # skipped because EP.1.a.i and EP.1.a.ii are rendered via same React component %> - -
- <% if metric.code == 'EP.1.a.i' %> - <%= render 'tpi/ascor/metrics_ep1a', recent_emissions: @recent_emissions %> - <% else %> -
-
- <%= "#{metric.code.split('.').last}. #{metric.text}" %> -
- <% if ascor_assessment_result_for(metric, @assessment).source.present? %> -
- <%= link_to "Source (#{ascor_assessment_result_for(metric, @assessment).year})", ascor_assessment_result_for(metric, @assessment).source %> -
- <% end %> - <% if ascor_assessment_result_for(metric, @assessment).answer.present? %> -
-
- <%= ascor_assessment_result_for(metric, @assessment).answer %> -
- <% end %> -
- <% end %> -
- <% end %> -
+ <% if ascor_sub_indicators_for(area, indicators).present? %> + <%= render 'tpi/ascor/assessment_indicators', area: area, indicators: ascor_sub_indicators_for(area, indicators), metrics: metrics %> + <% else %> + <%= render 'tpi/ascor/assessment_metrics', metrics: ascor_sub_indicators_for(area, metrics) %> <% end %>
diff --git a/app/views/tpi/ascor/_assessment_indicators.html.erb b/app/views/tpi/ascor/_assessment_indicators.html.erb new file mode 100644 index 000000000..168357b82 --- /dev/null +++ b/app/views/tpi/ascor/_assessment_indicators.html.erb @@ -0,0 +1,16 @@ +<% indicators.each do |indicator| %> +
+
+
+ <%= "#{indicator.code.split('.').last}. #{indicator.text}" %> +
+ <% if ascor_assessment_result_for(indicator, @assessment).source.present? %> +
+ <%= link_to 'Source', ascor_assessment_result_for(indicator, @assessment).source %> +
+ <% end %> +
+ + <%= render 'tpi/ascor/assessment_metrics', metrics: ascor_sub_indicators_for(indicator, metrics) %> +
+<% end %> \ No newline at end of file diff --git a/app/views/tpi/ascor/_assessment_metrics.html.erb b/app/views/tpi/ascor/_assessment_metrics.html.erb new file mode 100644 index 000000000..17815a09a --- /dev/null +++ b/app/views/tpi/ascor/_assessment_metrics.html.erb @@ -0,0 +1,26 @@ +<% metrics.each do |metric| %> + <% next if metric.code == 'EP.1.a.ii' # skipped because EP.1.a.i and EP.1.a.ii are rendered via same React component %> + +
+ <% if metric.code == 'EP.1.a.i' %> + <%= render 'tpi/ascor/metrics_ep1a', recent_emissions: @recent_emissions %> + <% else %> +
+
+ <%= "#{metric.code.split('.').last}. #{metric.text}" %> +
+ <% if ascor_assessment_result_for(metric, @assessment).source.present? %> +
+ <%= link_to "Source (#{ascor_assessment_result_for(metric, @assessment).year})", ascor_assessment_result_for(metric, @assessment).source %> +
+ <% end %> + <% if ascor_assessment_result_for(metric, @assessment).answer.present? %> +
+
+ <%= ascor_assessment_result_for(metric, @assessment).answer %> +
+ <% end %> +
+ <% end %> +
+<% end %> \ No newline at end of file