10/9/2019 - 4:58 PM

Modal Refreshing

Refresh Modal Content

  • When modal is opened, an ajax request is sent to load the content of the modal
    • modal opened -> route -> action that contains locals(variables) to be rendered
    • -> view that is rendered (whether .js or .erb)
    • place the contents to be rendered in a partial _partial_name.html.erb
    • If renders .js:
      • This view should render a partial that contains HTML to be inserted into the modal via $().html(j render partial: '')
  • Any other routes that want to update the contents of this modal can now render a .js view,
    provided all the locals are valid, can also $().html(j render partial: '') the above partial, so as to update the modal