Browse Source

Enahnce ui for doctrine show

pull/34/head
janpaulo 4 years ago
parent
commit
36757e77bd
No known key found for this signature in database
GPG Key ID: 50CA753050F1541C
  1. 6
      app/components/annotation_marks_modal_form_component/annotation_marks_modal_form_component.html.erb
  2. 301
      app/components/document_doctrine_show_component/document_doctrine_show_component.html.erb
  3. 3
      app/components/pagination_component/pagination_component.html.erb
  4. 9
      app/javascript/src/application.scss
  5. 3
      app/views/doctrines/search.html.erb
  6. 2
      app/views/kaminari/_gap.html.erb

6
app/components/annotation_marks_modal_form_component/annotation_marks_modal_form_component.html.erb

@ -3,7 +3,7 @@
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title">Edit Annotations</h5> <h5 class="modal-title">Edit Annotations</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> <button type="button" class="btn-close-x" data-bs-dismiss="modal" aria-label="Close">x</button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
@ -12,7 +12,7 @@
<strong> <%= label_tag :annotation_marks %> </strong> <strong> <%= label_tag :annotation_marks %> </strong>
<%= hidden_field_tag :document_id, document.id %> <%= hidden_field_tag :document_id, document.id %>
<%= hidden_field_tag :document_ids, citing_document_ids %> <%= hidden_field_tag :document_ids, citing_document_ids %>
<%= select_tag "annomark_ids[]", options_from_collection_for_select(Annomark.all, :id, :name, annotation.annomark_ids), class: "form-select default-selectize", multiple: true, prompt: "Please select" %> <%= select_tag "annomark_ids[]", options_from_collection_for_select(Annomark.all, :id, :name, annotation.annomark_ids), class: "form-control default-selectize pe-0 ps-0", multiple: true, prompt: "Please select" %>
</div> </div>
</div> </div>
@ -33,7 +33,7 @@
</div> </div>
</div> </div>
<div class="row tab"> <div class="row tab ms-1 ps-0">
<table class="table table-striped table-hover mb-0"> <table class="table table-striped table-hover mb-0">
<thead> <thead>
<th class="bg-light"> Reference No. </th> <th class="bg-light"> Reference No. </th>

301
app/components/document_doctrine_show_component/document_doctrine_show_component.html.erb

@ -1,192 +1,197 @@
<div class="card"> <hr class="mt-0"/>
<div class="card-header"> <div class="row pe-0">
<div class="col-sm-10">
<h5> <b>Doctrine Details</b> </h5>
</div>
<div class="col-sm-2 d-flex justify-content-end pe-0">
<a class="btn btn-sm btn-secondary me-3" data-bs-toggle="modal" data-bs-target="#doctrineModal"> Edit </a>
<a class="btn btn-sm btn-danger" href="<%= jurisprudence_doctrine_path(document_id, id) %>" data-confirm="Are you sure to delete this record?" data-method="DELETE"> Delete </a>
</div>
</div>
<hr class="mt-3"/>
<div class="">
<div class="container-sm row-flex col-sm-12 mt-2">
<%= render(DoctrineModalFormComponent.new(current_user: current_user, doctrine: doctrine, subjects: all_subjects, opts: { form_url: jurisprudence_doctrine_path(jurisprudence_id: document_id, id: doctrine.id), form_method: "PUT" })) %>
</div>
</div>
<div class="card-body pt-0">
<div class="row"> <div class="row">
<div class="col-sm-10"> <div class="col-sm-2" style="width: 100px;">
<h5> Doctrine Details </h5> <strong> Subjects: </strong>
</div> </div>
<div class="col-sm-2 justify-content-end"> <div class="col-sm-10">
<a class="btn btn-sm btn-secondary" data-bs-toggle="modal" data-bs-target="#doctrineModal"> Edit </a> <%= subjects.map(&:lineage_name).join(" & ") %>
<a class="btn btn-sm btn-danger" href="<%= jurisprudence_doctrine_path(document_id, id) %>" data-confirm="Are you sure to delete this record?" data-method="DELETE"> Delete </a>
</div> </div>
</div> </div>
<div class="container-sm row-flex col-sm-12 mt-2"> <div class="row">
<%= render(DoctrineModalFormComponent.new(current_user: current_user, doctrine: doctrine, subjects: all_subjects, opts: { form_url: jurisprudence_doctrine_path(jurisprudence_id: document_id, id: doctrine.id), form_method: "PUT" })) %> <div class="col-sm-2" style="width: 100px;">
</div> <strong> Content: </strong>
</div>
<div class="card-body">
<div class="row">
<div class="col-sm-2" style="width: 100px;">
<strong> Subjects: </strong>
</div>
<div class="col-sm-10">
<%= subjects.map(&:lineage_name).join(" & ") %>
</div>
</div> </div>
<div class="row"> <div class="col-sm-10">
<div class="col-sm-2" style="width: 100px;"> <%= raw content %>
<strong> Content: </strong>
</div>
<div class="col-sm-10">
<%= raw content %>
</div>
</div> </div>
</div>
<div class="row"> <div class="row">
<div class="col-sm-10"> </div> <div class="col-sm-10"> </div>
<div class="col-sm-2 p-2"> <div class="col-sm-2 p-2">
<button type="button" class="btn btn-primary" data-bs-toggle="collapse" data-bs-target="#caseListsCollapse" aria-expanded="false" aria-controls="collapseExample"> Case Lists </button> <button type="button" class="btn btn-primary d-block ms-auto" data-bs-toggle="collapse" data-bs-target="#caseListsCollapse" aria-expanded="false" aria-controls="collapseExample"> Case Lists </button>
</div>
</div> </div>
</div>
<div class="collapse mb-3" id="caseListsCollapse"> <div class="collapse mb-3 mt-2" id="caseListsCollapse">
<div class="row" data-controller="document" data-document-id="<%= document_id %>" data-doctrine-id="<%= id %>"> <div class="row" data-controller="document" data-document-id="<%= document_id %>" data-doctrine-id="<%= id %>">
<div class="col-sm-10 p-2"> <div class="col-sm-11 p-2">
<%= text_field_tag :q, nil, class: "form-control", placeholder: "Search GR Number", data: { target: "document.input" } %> <%= text_field_tag :q, nil, class: "form-control", placeholder: "Search GR Number", data: { target: "document.input" } %>
</div> </div>
<div class="col-sm-1 p-2"> <div class="col p-2">
<%= button_tag "Search", class: "btn btn-primary", data: { action: "click->document#search" } %> <%= button_tag "Search", class: "btn btn-primary", data: { action: "click->document#search" } %>
</div>
</div> </div>
</div>
<div class="row tab"> <div class="row tab">
<table class="table table-striped table-hover mb-0"> <table class="table table-striped table-hover mb-0" style="width: 98%;margin: 0 auto;">
<thead> <thead>
<th class="bg-light"> Reference No. </th> <th class="bg-light"> Reference No. </th>
<th class="bg-light"> Title </th> <th class="bg-light"> Title </th>
<th class="bg-light"> Date </th> <th class="bg-light"> Date </th>
<th class="bg-light"> </th> <th class="bg-light"> </th>
</thead> </thead>
<tbody id="documentIndexTable"> </tbody> <tbody id="documentIndexTable">
</table>
</tbody>
<div class="modal fade new-annotation-modal" id="newAnnotationModal" tabindex="-1" aria-labelledby="annotationModal" aria-hidden="true"> </table>
<%= form_tag(doctrine_annotations_path(id), method: :post) do%>
<div class="modal-dialog modal-lg modal-dialog-scrollable"> <div class="modal fade new-annotation-modal" id="newAnnotationModal" tabindex="-1" aria-labelledby="annotationModal" aria-hidden="true">
<div class="modal-content"> <%= form_tag(doctrine_annotations_path(id), method: :post) do%>
<div class="modal-header"> <div class="modal-dialog modal-lg modal-dialog-scrollable">
<h5 class="modal-title">New Annotations</h5> <div class="modal-content">
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> <div class="modal-header">
</div> <h5 class="modal-title">New Annotations</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body"> <div class="modal-body">
<div class="row"> <div class="row">
<div class="col-sm-12 p-2"> <div class="col-sm-12 p-2">
<strong> <%= label_tag :annotation_marks %> </strong> <strong> <%= label_tag :annotation_marks %> </strong>
<%= hidden_field_tag :document_id, nil %> <%= hidden_field_tag :document_id, nil %>
<%= hidden_field_tag :document_ids, nil %> <%= hidden_field_tag :document_ids, nil %>
<%= select_tag "annomark_ids[]", options_from_collection_for_select(Annomark.all, :id, :name), class: "form-select default-selectize", multiple: true, prompt: "Please select" %> <%= select_tag "annomark_ids[]", options_from_collection_for_select(Annomark.all, :id, :name), class: "form-select default-selectize", multiple: true, prompt: "Please select" %>
</div>
</div> </div>
</div>
<div class="row"> <div class="row">
<div class="col-sm-12 p-2"> <div class="col-sm-12 p-2">
<strong> <%= label_tag :document_title %> </strong> <strong> <%= label_tag :document_title %> </strong>
<%= text_area_tag :document_title, nil, class: "form-control" %> <%= text_area_tag :document_title, nil, class: "form-control" %>
</div>
</div> </div>
</div>
<div class="row"> <div class="row">
<div class="row" data-controller="document"> <div class="row" data-controller="document">
<div class="col-sm-10 p-2"> <div class="col-sm-10 p-2">
<%= text_field_tag :q, nil, class: "form-control", placeholder: "Search GR Number", data: { target: "document.input" } %> <%= 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 type="button" class="btn btn-primary" data-action="click->document#modalDocumentSearch"> Search </button>
</div>
</div> </div>
<div class="col-sm-1 p-2">
<div class="row tab"> <button type="button" class="btn btn-primary" data-action="click->document#modalDocumentSearch"> Search </button>
<table class="table table-striped table-hover mb-0">
<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>
<tbody id="modalDocumentSearchTable"> </tbody>
</table>
</div> </div>
</div> </div>
<div class="row"> <div class="row tab">
<div class="col-sm-12 p-2"> <table class="table table-striped table-hover mb-0">
<strong> <%= label_tag :phil_rep %> </strong> <thead>
<%= text_field_tag :phil_rep, nil, class: "form-control" %> <th class="bg-light"> Reference No. </th>
</div> <th class="bg-light"> Title </th>
<th class="bg-light"> Date </th>
<th class="bg-light"> </th>
</thead>
<tbody id="modalDocumentSearchTable"> </tbody>
</table>
</div> </div>
</div>
<div class="row"> <div class="row">
<div class="col-sm-12 p-2"> <div class="col-sm-12 p-2">
<strong> <%= label_tag :editor_notes %> </strong> <strong> <%= label_tag :phil_rep %> </strong>
<trix-editor id="editor_notes" placeholder="Editor Notes"> </trix-editor> <%= text_field_tag :phil_rep, nil, class: "form-control" %>
</div>
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="row">
<%= submit_tag "Save", class: "btn btn-primary" %> <div class="col-sm-12 p-2">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> <strong> <%= label_tag :editor_notes %> </strong>
<trix-editor id="editor_notes" placeholder="Editor Notes"> </trix-editor>
</div>
</div> </div>
</div> </div>
<div class="modal-footer">
<%= submit_tag "Save", class: "btn btn-primary" %>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div> </div>
<% end %> </div>
</div> <% end %>
</div> </div>
</div> </div>
</div>
<div class="card row-flex"> <div class="row-flex">
<h5 class="card-header"> Annotations </h5> <div class="annot-header">
<div class="card-body"> <h5> Annotations </h5>
<% doctrine.annotations.order(rank: :asc).each do |annotation| %> </div>
<div class="row"> <div class="">
<div class="col-sm-10"> <% doctrine.annotations.order(rank: :asc).each do |annotation| %>
<p class="pb-0 ms-3"> <div class="row">
<strong> <%= "#{annotation.annomarks.map { |annomark| "(#{annomark.code})" }.join(" ")}" %> </strong> <div class="col-sm-10">
<% document_title = annotation.document.short_title || annotation.document.title %> <p class="pb-0 ms-3">
<% date_or_year = annotation.document.docdate.present? ? annotation.document.docdate.strftime("%B %d, %Y") : annotation.document.year %> <strong> <%= "#{annotation.annomarks.map { |annomark| "(#{annomark.code})" }.join(" ")}" %> </strong>
<% annotated_documents_title = [] %> <% document_title = annotation.document.short_title || annotation.document.title %>
<% annotation.documents.each do |annotated_document| %> <% date_or_year = annotation.document.docdate.present? ? annotation.document.docdate.strftime("%B %d, %Y") : annotation.document.year %>
<% ad_title = annotated_document.short_title || annotated_document.title %> <% annotated_documents_title = [] %>
<% ad_date_or_year = annotated_document.docdate.present? ? annotated_document.docdate.strftime("%B %d, %Y") : annotated_document.year %> <% annotation.documents.each do |annotated_document| %>
<% annotated_documents_title << [" citing #{ad_title}", annotated_document.reference_number, ad_date_or_year].join(", ") %> <% ad_title = annotated_document.short_title || annotated_document.title %>
<% end %> <% ad_date_or_year = annotated_document.docdate.present? ? annotated_document.docdate.strftime("%B %d, %Y") : annotated_document.year %>
<%= raw [document_title, annotation.document.reference_number, date_or_year, annotation.phil_rep, annotated_documents_title].reject(&:blank?).join(', ').html_safe %> <% annotated_documents_title << [" citing #{ad_title}", annotated_document.reference_number, ad_date_or_year].join(", ") %>
</p> <% end %>
</div> <%= raw [document_title, annotation.document.reference_number, date_or_year, annotation.phil_rep, annotated_documents_title].reject(&:blank?).join(', ').html_safe %>
</p>
</div>
<div class="col-sm-2"> <div class="col-sm-2 d-flex justify-content-end align-items-baseline">
<a class="btn btn-sm btn-secondary" data-bs-toggle="modal" data-bs-target="#editAnnotationModal<%= annotation.id %>"> Edit </a> <a class="btn btn-sm btn-secondary me-3" data-bs-toggle="modal" data-bs-target="#editAnnotationModal<%= annotation.id %>"> Edit </a>
<a class="btn btn-sm btn-danger" href="<%= doctrine_annotation_path(doctrine.id, annotation.id) %>" data-confirm="Are you sure to delete this record?" data-method="DELETE"> Delete </a> <a class="btn btn-sm btn-danger" href="<%= doctrine_annotation_path(doctrine.id, annotation.id) %>" data-confirm="Are you sure to delete this record?" data-method="DELETE"> Delete </a>
</div>
</div> </div>
</div>
<% if annotation.editor_notes.present? %> <% if annotation.editor_notes.present? %>
<div class="row"> <div class="row">
<div class="col-sm-1 ms-5 p-0" style="width: 105px;"> <div class="col-sm-1 ms-5 p-0" style="width: 105px;">
<span> Editors Note: </span> <span> Editors Note: </span>
</div>
<div class="col-sm-10 ps-0">
<%= raw annotation.editor_notes %>
</div>
</div> </div>
<% end %>
<div class="col-sm-10 ps-0">
<div class="row annotation-marks-modal-container"> <%= raw annotation.editor_notes %>
<div class="modal fade" id="editAnnotationModal<%= annotation.id %>" tabindex="-1" aria-labelledby="annotationModal" aria-hidden="true">
<%= render AnnotationMarksModalFormComponent.new(current_user: current_user, document: document, annotation: annotation, opts: { form_url: doctrine_annotation_path(id, annotation.id), form_method: "PUT" }) %>
</div> </div>
</div> </div>
<hr/>
<% end %> <% end %>
</div>
<div class="row annotation-marks-modal-container">
<div class="modal fade modal-doctrine-body" id="editAnnotationModal<%= annotation.id %>" tabindex="-1" aria-labelledby="annotationModal" aria-hidden="true">
<%= render AnnotationMarksModalFormComponent.new(current_user: current_user, document: document, annotation: annotation, opts: { form_url: doctrine_annotation_path(id, annotation.id), form_method: "PUT" }) %>
</div>
</div>
<% end %>
</div> </div>
</div> </div>
</div> </div>

3
app/components/pagination_component/pagination_component.html.erb

@ -1,7 +1,7 @@
<div class="col col-md-12"> <div class="col col-md-12">
<header class="header bg-white b-b clearfix"> <header class="header bg-white b-b clearfix">
<div class="row m-t-sm align-items-end pagination-body"> <div class="row m-t-sm align-items-end pagination-body">
<div class="col-md-6 mb-0"> <div class="col-md-6 mb-0<%=opts[:is_subject_breadcrums].present? && subjects.present? ? '' : ' ps-0' %> ">
<% if opts[:is_subject_breadcrums].present? && subjects.present? %> <% if opts[:is_subject_breadcrums].present? && subjects.present? %>
<ol class="breadcrumb mb-0"> <ol class="breadcrumb mb-0">
<% subjects.each do |subject| %> <% subjects.each do |subject| %>
@ -30,5 +30,4 @@
</div> </div>
</div> </div>
</header> </header>
<hr class="mt-0"/>
</div> </div>

9
app/javascript/src/application.scss

@ -94,3 +94,12 @@
.doctrine-index-body .doctrine-content-body { .doctrine-index-body .doctrine-content-body {
padding-left: 15px; padding-left: 15px;
} }
.annot-header {
border-bottom: 1px solid darkred;
border-top: 1px solid darkred;
padding-top: 8px;
margin-bottom: 10px;
padding-left: 5px;
background: #efefef;
}

3
app/views/doctrines/search.html.erb

@ -1,6 +1,6 @@
<div class="container-sm mt-1 p-0 doctrine-index-body"> <div class="container-sm mt-1 p-0 doctrine-index-body">
<div class="container m-2 ps-0"> <%= render PaginationComponent.new(data: @doctrines, opts: { is_subject_breadcrums: true, subject_ids: params[:subject_ids] }) %> </div> <div class="container m-2 ps-0"> <%= render PaginationComponent.new(data: @doctrines, opts: { is_subject_breadcrums: true, subject_ids: params[:subject_ids] }) %> </div>
<hr class="mt-0"/>
<% if params[:is_index_table].to_s.eql?("true") %> <% if params[:is_index_table].to_s.eql?("true") %>
<div class="card-body col-sm-12 tableFixHead p-0 mt-1"> <div class="card-body col-sm-12 tableFixHead p-0 mt-1">
<%= render(DoctrineIndexTableComponent.new(current_user: current_user, search_results: @doctrines)) %> <%= render(DoctrineIndexTableComponent.new(current_user: current_user, search_results: @doctrines)) %>
@ -8,4 +8,5 @@
<% else %> <% else %>
<%= render(DocumentDoctrineIndexComponent.with_collection(@doctrines, current_user: current_user, opts: { is_doctrines_index: true, subject_ids: params[:subject_ids] })) %> <%= render(DocumentDoctrineIndexComponent.with_collection(@doctrines, current_user: current_user, opts: { is_doctrines_index: true, subject_ids: params[:subject_ids] })) %>
<% end %> <% end %>
</div> </div>

2
app/views/kaminari/_gap.html.erb

@ -5,4 +5,4 @@
per_page: number of items to fetch per page per_page: number of items to fetch per page
remote: data-remote remote: data-remote
-%> -%>
<span class="page gap"><%= t('views.pagination.truncate').html_safe %></span> <span class="page gap ms-2 me-2"><%= t('views.pagination.truncate').html_safe %></span>

Loading…
Cancel
Save