diff --git a/app/components/document_advanced_search_component/document_advanced_search_component.html.erb b/app/components/document_advanced_search_component/document_advanced_search_component.html.erb
index 12d8fb6..0d0d2d1 100644
--- a/app/components/document_advanced_search_component/document_advanced_search_component.html.erb
+++ b/app/components/document_advanced_search_component/document_advanced_search_component.html.erb
@@ -15,7 +15,7 @@
- <%= select_tag :year, options_for_select(years, params[:year]), class: "form-select" %>
+ <%= select_tag :year, options_for_select(years, params[:year]), class: "form-select", include_blank: true %>
@@ -27,4 +27,4 @@
-<% end %>
\ No newline at end of file
+<% end %>
diff --git a/app/components/subject_index_form_component.rb b/app/components/subject_index_form_component.rb
index e094aa2..e4a2333 100644
--- a/app/components/subject_index_form_component.rb
+++ b/app/components/subject_index_form_component.rb
@@ -7,6 +7,10 @@ class SubjectIndexFormComponent < BaseComponent
@parent_id = @opts[:parent_id]
end
+ def parent
+ Cdao::Subject.find(parent_id)
+ end
+
def current_library
Cdao::Library.first
end
diff --git a/app/components/subject_index_form_component/subject_index_form_component.html.erb b/app/components/subject_index_form_component/subject_index_form_component.html.erb
index 27aa534..5ded64e 100644
--- a/app/components/subject_index_form_component/subject_index_form_component.html.erb
+++ b/app/components/subject_index_form_component/subject_index_form_component.html.erb
@@ -7,11 +7,13 @@
- <% if parent_id.present? %>
+ <% if parent_id.present? || subject_index.persisted? %>
<%= label_tag :subjects %>
-
+
<% end %>
diff --git a/app/controllers/concerns/doctrine_search.rb b/app/controllers/concerns/doctrine_search.rb
index ff23f14..efa4e22 100644
--- a/app/controllers/concerns/doctrine_search.rb
+++ b/app/controllers/concerns/doctrine_search.rb
@@ -13,6 +13,14 @@ module DoctrineSearch
with(:created_at).between(Date.parse(search_params[:created_at])..Time.zone.today.to_date)
end
+ if search_params[:created_at_start].present? && search_params[:created_at_end].blank?
+ with(:created_at).between(Date.parse(search_params[:created_at_start])..Time.zone.today.to_date)
+ end
+
+ if search_params[:created_at_start].present? && search_params[:created_at_end].present?
+ with(:created_at).between(Date.parse(search_params[:created_at_start])..Date.parse(search_params[:created_at_end]))
+ end
+
without(:id).any_of(search_params[:exclude_ids]) if search_params[:exclude_ids].present?
paginate page: search_params[:page] || 1, per_page: search_params[:per_page] || 20
diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb
index 47b63d5..46e387b 100644
--- a/app/controllers/reports_controller.rb
+++ b/app/controllers/reports_controller.rb
@@ -12,6 +12,6 @@ class ReportsController < ApplicationController
private
def search_params
- params.permit(:created_at, :q, :page, :per_page, exclude_ids: [], subject_ids: [], user_ids: [])
+ params.permit(:created_at, :created_at_start, :created_at_end, :q, :page, :per_page, exclude_ids: [], subject_ids: [], user_ids: [])
end
end
diff --git a/app/models/cdao/subject.rb b/app/models/cdao/subject.rb
index a170873..25da037 100644
--- a/app/models/cdao/subject.rb
+++ b/app/models/cdao/subject.rb
@@ -41,7 +41,7 @@ class Cdao::Subject < Cdao::Base
end
def lineage_name
- path.map(&:name).join("; ")
+ path.map(&:name).join(" > ")
end
def name_with_product_names
diff --git a/app/views/reports/index.html.erb b/app/views/reports/index.html.erb
index 555fd7d..35a9f1e 100644
--- a/app/views/reports/index.html.erb
+++ b/app/views/reports/index.html.erb
@@ -11,9 +11,15 @@
-
- <%= text_field_tag :created_at, params[:created_at], class: "form-control default-flatpickr" %>
+
+ <%= text_field_tag :created_at_start, params[:created_at_start], class: "form-control default-flatpickr" %>
+
+
+
+ <%= text_field_tag :created_at_end, params[:created_at_end], class: "form-control default-flatpickr" %>
+
+
diff --git a/app/views/subject_indexes/show.html.erb b/app/views/subject_indexes/show.html.erb
index 935e905..ccd954c 100644
--- a/app/views/subject_indexes/show.html.erb
+++ b/app/views/subject_indexes/show.html.erb
@@ -25,7 +25,10 @@
Edit
-
Delete
+
+ <% if !@subject_index.has_children? %>
+
Delete
+ <% end %>