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. 59
      app/components/pagination_component/pagination_component.html.erb
  3. 19
      app/javascript/src/application/pagination.scss
  4. 4
      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)) Cdao::Subject.where(id: opts[:subject_ids].map(&:to_i))
end 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 end

59
app/components/pagination_component/pagination_component.html.erb

@ -1,33 +1,30 @@
<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="<%=data.present? ? "col-md-8 mb-0 " : "col-md-12 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| %> <% subject.ancestors.each do |ancestor| %>
<% subject.ancestors.each do |ancestor| %> <li class="breadcrumb-item d-inline-flex">
<li class="breadcrumb-item d-inline-flex"> <h4 class="label-breadcrumb"> <%= link_to ancestor.name, custom_url(ancestor.id), class: "text-decoration-none" %> </h4>
<h4> <%= link_to ancestor.name, subject_index_path(ancestor), class: "text-decoration-none" %> </h4> </li>
</li> <% end %>
<% end %> <li class="breadcrumb-item d-inline-flex active">
<h4> <%= subject.name %> </h4>
<li class="breadcrumb-item d-inline-flex active"> </li>
<h4> <%= subject.name %> </h4> <% end %>
</li> </ol>
<% end %> <% else %>
</ol> <h4 style="color: darkred" class="m-0">Search Results</h4>
<% else %> <small style="color: darkred">
<h4 style="color: darkred" class="m-0">Search Results</h4> <%= page_entries_info data, entry_name: 'records' if data.present? %>
<small style="color: darkred"> </small>
<%= page_entries_info data, entry_name: 'records' if data.present? %> <% end %>
</small> </div>
<% end %> <div class="<%=data.present? ? "col-md-4 position-relative" : "d-none"%>">
</div> <div class="text-center pagination justify-content-end">
<div class="col-md-6 position-relative"> <%= (paginate data) if data.present? %>
<div class="text-center pagination justify-content-end">
<%= (paginate data) if data.present? %>
</div>
</div> </div>
</div> </div>
</header> </div>
</div> </header>

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

@ -3,7 +3,20 @@
} }
.pagination-body .pagination span.page-item.page.current.page-link { .pagination-body .pagination span.page-item.page.current.page-link {
border: darkred; border: darkred;
background: darkred !important; background: darkred !important;
color: #fff !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;
} }

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

@ -1,6 +1,6 @@
<div class="container-fluid mt-1 p-0 doctrine-index-body"> <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"/> <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)) %>

Loading…
Cancel
Save