Add if statement around render partial code block

I need to add if statement/s to control the appearance of two sentences based on the return value of other if stmts that control the appearance of the cta buttons.

For example: If all the cta if stmts return false than only show one sentence. Else show two sentences.

I only need to show “Now please continue with:” if any of the if stmts for the ctas is true. If Not show “Thank you for completing section 1 of the application! Now please continue with:”

I don’t completely understand the render partial code and how to wrap an if stmt around the render partial block of code.

Thanks in advance for any help!

<i__ src=“/images/status_0.png” alt=“status” usemap=“#statusmap” />

Thank you for completing section 1 of the application!

Now please continue with:

<%= render :partial => “#{@view_prefix}/order_status_map” %>

    <% @action_count = 0 %> <%= render_common :partial => :gdoc_cta if @order.program.g_docs_required? %> <%= render :partial => "#{@view_prefix}/1st_certification_cta" if @order.1st_certification_required? %> <%= render :partial => "#{@view_prefix}/copayer_cta" %>

@kimkhan, you can wrap calls to render as follows:

<% if @order.program.gdocs_required? %>
  <%= render 'gdoc_cta' %>
<% end %>

render 'gdoc_cta' will look for a file named _gdoc_cta in the same directory as this view. Check out this Rails Guide for more info on the how to use render in your view.

To get the behavior you are looking for, I think you want something like this:

Thank you for completing section 1 of the  application!

<% if @order.program.g_docs_required? || @order.1st_certification_required? %>
  Now please continue with:
  <% if @order.g_docs_required? %>
    <%= render 'gdoc_cta' %>
  <% end %>

  <% if @order.1st_certification_required? %>
    <%= render '1st_certification_cta' %>
  <% end %>
<% end %>
1 Like

Thank you. This looks perfect I will test this technique. I appreciate the reference to the render info.