You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

77 lines
3.8 KiB

<div>
<div class="card-header pb-0" style="border-bottom: 1px solid darkred;">
<div class="row">
<div class="col-sm-10">
<% if @subject_index.is_root? %>
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item d-inline-flex active">
<h4 class="mb-0"> <%= @subject_index.name %> </h4>
</li>
</ol>
<% else %>
<ol class="breadcrumb subject-index-body-show mb-0">
<% @subject_index.ancestors.each do |ancestor| %>
<li class="breadcrumb-item d-inline-flex">
<h4> <%= link_to ancestor.name, subject_index_path(ancestor.id), class: "text-decoration-none text-black" %> </h4>
</li>
<% end %>
<li class="breadcrumb-item d-inline-flex active">
<h4> <%= @subject_index.name %> </h4>
</li>
</ol>
<% end %>
</div>
<div class="col-sm-2 d-flex justify-content-end align-items-center pe-0">
<a class="btn btn-secondary me-3 btn-sm mb-1" href="<%= edit_subject_index_path(@subject_index) %>"> Edit </a>
<% if !@subject_index.has_children? %>
<a class="btn btn-danger btn-sm" href="<%= subject_index_path(@subject_index) %>" data-confirm="Are you sure to delete this record?" data-method="DELETE"> Delete </a>
<% end %>
</div>
</div>
</div>
<div class="card-body">
<div>
<div class="" style="border-bottom: 1px solid #b2b2b2;">
<div class="row">
<div class="col-sm-11"> <h5 class="mb-0"> Sub Levels </h5> </div>
<div class="col-sm-1 d-flex justify-content-end align-items-end"> <a class="btn btn-success p-1 btn-sm ps-3 pe-3 mb-1" href="<%= new_subject_index_path(parent_id: @subject_index) %>"> Add </a> </div>
</div>
</div>
<div class="card-body subject-body-index" style="position: relative;">
<div class="accordion accordion-flush subject-index-body" id="mainPanelBody" >
<% @subject_index.children.order(name: :asc).each do |root| %>
<div class="accordion-item">
<div class="accordion-header d-flex justify-content-between">
<% if root.children.present? %>
<div class="accordion-button collapsed m-0 p-0" data-bs-toggle="collapse" data-bs-target="#<%= ["rootLevel", root.id].join %>"
data-controller="subjects" data-subject-parent-id="<%= root.id %>"
data-accordion-target="#<%= ['subjectsAccordionBody', root.id].join %>"
data-action="click->subjects#loadSubjectsAccordion">
<%= link_to root.name, subject_index_path(root.id), class: "accordion-link text-decoration-none text-dark d-block sub1 clickable-link" %>
<%= link_to '<i class="fas fa-folder-plus"></i>'.html_safe, new_subject_index_path(parent_id: root.id), class: "text-decoration-none d-block sub1 clickable-link position-absolute end-0 me-5" %>
</div>
<% else %>
<%= link_to root.name, subject_index_path(root.id), class: "accordion-link text-decoration-none text-dark d-block sub1 clickable-link" %>
<%= link_to '<i class="fas fa-folder-plus"></i>'.html_safe, new_subject_index_path(parent_id: root.id), class: "text-decoration-none d-block sub1 clickable-link position-absolute end-0 accordion-action-button-margin non-toggle" %>
<% end %>
</div>
<div class="accordion-collapse collapse" id="<%= ["rootLevel", root.id].join %>" data-bs-parent="#mainPanelBody">
<div class="accordion-body pt-1 pb-1 sub-body1" id="<%= ['subjectsAccordionBody', root.id].join %>">
<div class="text-center">
<div class="spinner-border text-danger" role="status">
<span class="visually-hidden">Loading...</span>
</div>
</div>
</div>
</div>
</div>
<% end %>
</div>
</div>
</div>
</div>
</div>