Browse Source

Merge pull request #57 from lexintegritastech/feature-enhance-ui

Fix breadcrumb link
pull/58/head
Alexander D. Bondoc 4 years ago committed by GitHub
parent
commit
1263afb8fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      app/components/pagination_component.rb
  2. 9
      app/components/pagination_component/pagination_component.html.erb
  3. 13
      app/javascript/src/application/pagination.scss
  4. 2
      app/views/doctrines/search.html.erb

8
app/components/pagination_component.rb

@ -10,4 +10,12 @@ class PaginationComponent < BaseComponent
Cdao::Subject.where(id: opts[:subject_ids].map(&:to_i))
end
def custom_url(id)
return search_doctrines_path(is_index_table: true, subject_ids: [id]) if opts[:is_index_table].present? && opts[:is_index_table].to_s.eql?("true")
return search_doctrines_path( is_index_table: false, subject_ids: [id]) if opts[:is_index_table].present? && opts[:is_index_table].to_s.eql?("false")
search_doctrines_path(id)
end
end

9
app/components/pagination_component/pagination_component.html.erb

@ -1,16 +1,14 @@
<div class="col col-md-12">
<header class="header bg-white b-b clearfix">
<div class="row m-t-sm align-items-end pagination-body">
<div class="col-md-6 mb-0<%=opts[:is_subject_breadcrums].present? && subjects.present? ? '' : ' ps-0' %> ">
<div class="<%=data.present? ? "col-md-8 mb-0 " : "col-md-12 mb-0"%>">
<% if opts[:is_subject_breadcrums].present? && subjects.present? %>
<ol class="breadcrumb mb-0">
<% subjects.each do |subject| %>
<% subject.ancestors.each do |ancestor| %>
<li class="breadcrumb-item d-inline-flex">
<h4> <%= link_to ancestor.name, subject_index_path(ancestor), class: "text-decoration-none" %> </h4>
<h4 class="label-breadcrumb"> <%= link_to ancestor.name, custom_url(ancestor.id), class: "text-decoration-none" %> </h4>
</li>
<% end %>
<li class="breadcrumb-item d-inline-flex active">
<h4> <%= subject.name %> </h4>
</li>
@ -23,11 +21,10 @@
</small>
<% end %>
</div>
<div class="col-md-6 position-relative">
<div class="<%=data.present? ? "col-md-4 position-relative" : "d-none"%>">
<div class="text-center pagination justify-content-end">
<%= (paginate data) if data.present? %>
</div>
</div>
</div>
</header>
</div>

13
app/javascript/src/application/pagination.scss

@ -7,3 +7,16 @@ border: darkred;
background: darkred !important;
color: #fff !important;
}
.label-breadcrumb a {
color: #1d1a1a;
font-size: 20px;
}
.label-breadcrumb a:hover {
color: darkred;
}
.breadcrumb-item.active h4 {
color: darkred !important;
}

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

@ -1,5 +1,5 @@
<div class="container-fluid 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-fluid m-2 p-0"> <%= render PaginationComponent.new(data: @doctrines, opts: { is_subject_breadcrums: true, subject_ids: params[:subject_ids], is_index_table: params[:is_index_table] }) %> </div>
<hr class="mt-0"/>
<% if params[:is_index_table].to_s.eql?("true") %>
<div class="card-body col-sm-12 tableFixHead p-0 mt-1">

Loading…
Cancel
Save