I'm trying to conditionally render a section of a partial, if the render includes a particular parameter "has_footer".
In _modal.html.erb, I have the following:
<div id="<%= id %>" class="modal hide fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-header">
<button type="button" class="btn-modal-close" data-dismiss="modal" aria-hidden="true">×</button>
<header><%= title %></header>
</div>
<div class="modal-body">
<%= render partial: content %>
</div>
<% if params[:has_footer] %>
<div class="modal-footer">
<button class="btn-modal-save">Save</button>
<button class="btn-modal-cancel" data-dismiss="modal" aria-hidden="true">Cancel</button>
</div>
<% end %>
</div>
And I render the partial like this:
<%= render "pages/modal", :has_footer, id: "modal-add-campaign", title: "Add Campaign", content: "pages/modal_add_campaign" %>
Basically, I want to display the div "modal-footer" only if I include the ":has_footer" parameter in my render command.
Any help, please?