From a152a12b5f6b02e210402fb91d31171397c9fbe4 Mon Sep 17 00:00:00 2001 From: janpaulo Date: Thu, 24 Feb 2022 11:13:33 +0800 Subject: [PATCH] Fix breadcrumb link --- app/components/pagination_component.rb | 8 +++ .../pagination_component.html.erb | 59 +++++++++---------- .../src/application/pagination.scss | 19 +++++- app/views/doctrines/search.html.erb | 4 +- 4 files changed, 54 insertions(+), 36 deletions(-) diff --git a/app/components/pagination_component.rb b/app/components/pagination_component.rb index 61d33ee..1fb9ea7 100644 --- a/app/components/pagination_component.rb +++ b/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 diff --git a/app/components/pagination_component/pagination_component.html.erb b/app/components/pagination_component/pagination_component.html.erb index a6d80f5..37e8bfa 100644 --- a/app/components/pagination_component/pagination_component.html.erb +++ b/app/components/pagination_component/pagination_component.html.erb @@ -1,33 +1,30 @@ -
-
-
-
- <% if opts[:is_subject_breadcrums].present? && subjects.present? %> - - <% else %> -

Search Results

- - <%= page_entries_info data, entry_name: 'records' if data.present? %> - - <% end %> -
-
- +
+
+
"> + <% if opts[:is_subject_breadcrums].present? && subjects.present? %> + + <% else %> +

Search Results

+ + <%= page_entries_info data, entry_name: 'records' if data.present? %> + + <% end %> +
+
"> +
-
-
+
+
diff --git a/app/javascript/src/application/pagination.scss b/app/javascript/src/application/pagination.scss index e1915f9..f1e6c09 100644 --- a/app/javascript/src/application/pagination.scss +++ b/app/javascript/src/application/pagination.scss @@ -3,7 +3,20 @@ } .pagination-body .pagination span.page-item.page.current.page-link { -border: darkred; -background: darkred !important; -color: #fff !important; + 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; } \ No newline at end of file diff --git a/app/views/doctrines/search.html.erb b/app/views/doctrines/search.html.erb index a7a5b61..2ca4a61 100644 --- a/app/views/doctrines/search.html.erb +++ b/app/views/doctrines/search.html.erb @@ -1,6 +1,6 @@
-
<%= render PaginationComponent.new(data: @doctrines, opts: { is_subject_breadcrums: true, subject_ids: params[:subject_ids] }) %>
-
+
<%= render PaginationComponent.new(data: @doctrines, opts: { is_subject_breadcrums: true, subject_ids: params[:subject_ids], is_index_table: params[:is_index_table] }) %>
+
<% if params[:is_index_table].to_s.eql?("true") %>
<%= render(DoctrineIndexTableComponent.new(current_user: current_user, search_results: @doctrines)) %>