Browse Source

Remove syllabus

pull/75/head
Angel Aviel Domaoan 4 years ago
parent
commit
7f7adcff07
  1. 11
      app/components/document_advanced_search_component/document_advanced_search_component.html.erb
  2. 6
      app/controllers/concerns/jurisprudence_search.rb
  3. 2
      app/controllers/documents_controller.rb
  4. 2
      app/models/cdao/citation_finder.rb
  5. 8
      app/models/cdao/jurisprudence.rb

11
app/components/document_advanced_search_component/document_advanced_search_component.html.erb

@ -12,17 +12,12 @@
<label for="exampleFormControlInput1" class="form-label text-white">Title</label> <label for="exampleFormControlInput1" class="form-label text-white">Title</label>
<%= text_field_tag :title, params[:short_title], class: "form-control mb-0" %> <%= text_field_tag :title, params[:short_title], class: "form-control mb-0" %>
</div> </div>
<% if opts[:is_decisions_index].present? %> <% if opts[:is_decisions_index].present? %>
<div class="mb-2"> <div class="mb-2">
<label for="exampleFormControlInput1" class="form-label text-white">Ponente</label> <label for="exampleFormControlInput1" class="form-label text-white">Ponente</label>
<%= text_field_tag :ponente, params[:ponente], class: "form-control mb-0" %> <%= text_field_tag :ponente, params[:ponente], class: "form-control mb-0" %>
</div> </div>
<div class="mb-2">
<label for="exampleFormControlInput1" class="form-label text-white">Syllabus</label>
<%= text_field_tag :syllabus, params[:syllabus], class: "form-control mb-0" %>
</div>
<% end %> <% end %>
<div class="d-flex align-items-end"> <div class="d-flex align-items-end">
@ -30,7 +25,7 @@
<label for="exampleFormControlInput1" class="form-label text-white">Year</label> <label for="exampleFormControlInput1" class="form-label text-white">Year</label>
<%= select_tag :year_start, options_for_select(years, params[:year_start]), class: "form-select", include_blank: true %> <%= select_tag :year_start, options_for_select(years, params[:year_start]), class: "form-select", include_blank: true %>
</div> </div>
<div class="mb-2 w-100 ps-2"> <div class="mb-2 w-100 ps-2">
<%= select_tag :year_end, options_for_select(years, params[:year_end]), class: "form-select", include_blank: true %> <%= select_tag :year_end, options_for_select(years, params[:year_end]), class: "form-select", include_blank: true %>
</div> </div>
@ -40,7 +35,7 @@
<label for="exampleFormControlInput1" class="form-label text-white">Citation Finder</label> <label for="exampleFormControlInput1" class="form-label text-white">Citation Finder</label>
<%= text_field_tag :citation_finder, params[:citation_finder], class: "form-control mb-0" %> <%= text_field_tag :citation_finder, params[:citation_finder], class: "form-control mb-0" %>
</div> </div>
<div class="d-flex justify-content-end mt-3"> <div class="d-flex justify-content-end mt-3">
<button type="reset" class="btn btn-success me-2 mb-2"><i class="fas fa-sync"></i> Refresh</button> <button type="reset" class="btn btn-success me-2 mb-2"><i class="fas fa-sync"></i> Refresh</button>
<button type="submit" class="btn btn-danger mb-2">Search</button> <button type="submit" class="btn btn-danger mb-2">Search</button>

6
app/controllers/concerns/jurisprudence_search.rb

@ -5,7 +5,7 @@ module JurisprudenceSearch
search = Cdao::Jurisprudence.search do search = Cdao::Jurisprudence.search do
fulltext search_params[:q], fields: fulltext_fields if search_params[:q].present? fulltext search_params[:q], fields: fulltext_fields if search_params[:q].present?
%i[reference_number title short_title ponente syllabus].each do |field| %i[reference_number title short_title ponente].each do |field|
fulltext search_params[field], fields: [field], query_phrase_slop: 1 if search_params[field].present? fulltext search_params[field], fields: [field], query_phrase_slop: 1 if search_params[field].present?
end end
@ -22,9 +22,9 @@ module JurisprudenceSearch
with(:citation_finders_names).any_of(search_params[:citation_finder]) if search_params[:citation_finder].present? with(:citation_finders_names).any_of(search_params[:citation_finder]) if search_params[:citation_finder].present?
without(:id).any_of(search_params[:exclude_ids]) if search_params[:exclude_ids].present? without(:id).any_of(search_params[:exclude_ids]) if search_params[:exclude_ids].present?
with(:is_only_in_premium_libraries, false) with(:is_only_in_premium_libraries, false)
order_by :doc_date, :desc order_by :doc_date, :desc
order_by :year, :desc order_by :year, :desc

2
app/controllers/documents_controller.rb

@ -33,7 +33,7 @@ class DocumentsController < ApplicationController
private private
def search_params def search_params
params.permit(:reference_number, :title, :short_title, :ponente, :syllabus, params.permit(:reference_number, :title, :short_title, :ponente,
:year_start, :year_end, :citation_finder, :subject_ids, :year_start, :year_end, :citation_finder, :subject_ids,
:q, :page, :per_page) :q, :page, :per_page)
end end

2
app/models/cdao/citation_finder.rb

@ -4,7 +4,7 @@ class Cdao::CitationFinder < Cdao::Base
TYPES = %w[SCRA PhilRep].freeze TYPES = %w[SCRA PhilRep].freeze
belongs_to :jurisprudence, class_name: "Cdao::Jurisprudence", optional: false belongs_to :jurisprudence, class_name: "Cdao::Jurisprudence", optional: false
delegate :title, :content, :ponente, :syllabus, :reference_number, :docdate, to: :jurisprudence delegate :title, :content, :ponente, :reference_number, :docdate, to: :jurisprudence
def display_name def display_name
@display_name || set_display_name @display_name || set_display_name

8
app/models/cdao/jurisprudence.rb

@ -72,7 +72,7 @@ class Cdao::Jurisprudence < Cdao::Base
doc.url Rails.application.routes.url_helpers.jurisprudence_path(self) doc.url Rails.application.routes.url_helpers.jurisprudence_path(self)
end end
end end
def subjects def subjects
doctrines.map(&:subjects).flatten.uniq doctrines.map(&:subjects).flatten.uniq
end end
@ -112,7 +112,7 @@ class Cdao::Jurisprudence < Cdao::Base
end end
end end
end end
names names
end end
@ -124,7 +124,7 @@ class Cdao::Jurisprudence < Cdao::Base
def scra def scra
return "" if citation_finders.blank? return "" if citation_finders.blank?
citation_finders.where(citation_source_id: 0).map(&:display_name).join(' | ') citation_finders.where(citation_source_id: 0).map(&:display_name).join(' | ')
end end
@ -133,11 +133,9 @@ class Cdao::Jurisprudence < Cdao::Base
text :title, stored: true text :title, stored: true
text :short_title, stored: true text :short_title, stored: true
text :ponente, stored: true text :ponente, stored: true
text :syllabus, stored: true
string :reference_number string :reference_number
string :ponente string :ponente
string :syllabus
string :title do string :title do
(title.present? ? title.first(32760).strip : short_title || "").titleize (title.present? ? title.first(32760).strip : short_title || "").titleize
end end

Loading…
Cancel
Save