Browse Source

Fix saving of `annotations`

pull/91/head
alexdbondoc17 4 years ago committed by Angel Aviel Domaoan
parent
commit
5f851449da
  1. 1
      app/javascript/controllers/annotations_controller.js
  2. 4
      app/reflexes/annotation_reflex.rb
  3. 19
      app/views/shared/_case_lists_no_results.html.erb

1
app/javascript/controllers/annotations_controller.js

@ -88,6 +88,7 @@ export default class extends ApplicationController {
if(status === "success") {
$(".btn-close-x").trigger("click")
$this.stimulate("AnnotationReflex#render_annotations_views", { page: 1 })
$this.stimulate("AnnotationReflex#render_default_case_lists_search", doctrine_id)
}
})
}

4
app/reflexes/annotation_reflex.rb

@ -17,4 +17,8 @@ class AnnotationReflex < ApplicationReflex
morph "#annotationsIndexView", render(partial: "/shared/annotations_index_view", locals: { annotations: @annotations,
opts: { doctrine_id: search_params[:doctrine_id], current_page: search_params[:page] } })
end
def render_default_case_lists_search(doctrine_id)
morph "#caseListsCollapse", render(partial: "/shared/case_lists_no_results", locals: { doctrine_id: doctrine_id })
end
end

19
app/views/shared/_case_lists_no_results.html.erb

@ -0,0 +1,19 @@
<div class="row" data-controller="document" data-doctrine-id="<%= doctrine_id %>">
<div class="col-sm-11 p-2">
<%= text_field_tag :q, nil, class: "form-control", placeholder: "Search GR Number", data: { target: "document.input" } %>
</div>
<div class="col-sm-1 p-2">
<%= button_tag "Search", class: "btn btn-success", data: { action: "click->document#search" } %>
</div>
</div>
<div class="row tab">
<table class="table table-striped table-hover mb-0" style="width: 98%; margin: 0 auto;">
<thead>
<th class="bg-light"> Reference No. </th>
<th class="bg-light"> Title </th>
<th class="bg-light"> Date </th>
<th class="bg-light"> </th>
</thead>
</table>
</div>
Loading…
Cancel
Save