ruby on rails - Nested Partials - Use Presenter Pattern? -
i have view getting unruly. i'd move more of view other partials result in nested partials...which wary of. i've heard of presenter pattern , implement here don't know how go it. row contain loop don't think can extract easily. advice appreciated!
<div class="row"> <h2>applicant</h2> <%= render partial: 'people/summary', locals: { person: @applicant.identity } %> <%= link_to "edit", edit_person_path(@applicant.identity), class: "btn btn-info"%> </div> <%= render partial: 'divrow', locals: { var1: "household members" } %> <%= render partial: 'structure', locals: { path: "new_household_member_path" } %> <div class="row"> <h2>residence history</h2> <% @applicant.residences.each |r| %> <div class="col-md-4"> <p> <%= render partial: 'residences/summary', locals: { residence: r } %> <%= link_to "edit", edit_residence_path(r), class: "btn btn-info"%> <%= link_to 'delete', r, method: :delete, class: "btn btn-danger", data: { confirm: 'are sure?' } %> </p> </div> <% end %> </div> <%= render partial: 'structure', locals: { path: "new_residence_path" } %> <div class="row"> <h2>income</h2> <% @applicant.incomes.each |i| %> <p> <%= render partial: "incomes/summary", locals: { income: } %> <%= link_to "edit", edit_income_path(i), class: "btn btn-info"%> <%= link_to 'delete', i, method: :delete, class: "btn btn-danger", data: { confirm: 'are sure?' } %> </p> <% end %> </div> <%= render partial: 'structure', locals: { path: "new_income_path" } %> <div class="row"> <h2>employment</h2> <% @applicant.employments.each |e| %> <div class="col-md-4"> <p> <%= render partial: "employments/summary", locals: { employment: e } %> <%= link_to "edit", edit_employment_path(e), class: "btn btn-info"%> <%= link_to 'delete', e, method: :delete, class: "btn btn-danger", data: { confirm: 'are sure?' } %> </p> </div> <% end %> </div> <%= render partial: 'structure', locals: { path: "new_employment_path" } %> <div class="row"> <h2>criminal history</h2> <% @applicant.criminal_histories.each |e| %> <div class="col-md-4"> <p> <%= render partial: "criminal_histories/summary", locals: { criminal_history: e } %> <%= link_to "edit", edit_criminal_history_path(e), class: "btn btn-info"%> <%= link_to 'delete', e, method: :delete, class: "btn btn-danger", data: { confirm: 'are sure?' } %> </p> </div> <% end %> </div> <%= render partial: 'structure', locals: { path: "new_criminal_history_path" } %>
Comments
Post a Comment