Skip to content

Commit

Permalink
Fix: multiple highlighted terms in concepts date view (#657)
Browse files Browse the repository at this point in the history
* Fix multiple highlighted terms in the date view

* refactor concepts by date method code
  • Loading branch information
Bilelkihal authored Jun 6, 2024
1 parent af5fc5b commit 9c3d761
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions app/helpers/concepts_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ def same_period?(year, month, date)
year.eql?(date.year) && month.eql?(date.strftime('%B'))
end

def concepts_li_list(concepts, auto_click: false)
def concepts_li_list(concepts, auto_click: false, selected_id: nil)
out = ''
concepts.each do |concept|
children_link, data, href = concept_tree_data(@ontology.acronym, concept, request_lang, [])
out += render TreeLinkComponent.new(child: concept, href: href,
children_href: '#', selected: concept.id.eql?(concepts.first.id) && auto_click,
children_href: '#', selected: concept.id.eql?(selected_id) && auto_click,
target_frame: 'concept_show', data: data)
end
out
Expand All @@ -132,15 +132,14 @@ def render_concepts_by_dates(auto_click: false)
tmp = {}
tmp[first_year] = first_month_concepts
@concepts_year_month = tmp.merge(@concepts_year_month)

selected_id = @concepts.first.id if @page.page.eql?(1)
@concepts_year_month.each do |year, month_concepts|
month_concepts.each do |month, concepts|
out += "<ul> #{month + ' ' + year.to_s}"
out += concepts_li_list(concepts, auto_click: auto_click)
out += concepts_li_list(concepts, auto_click: auto_click, selected_id: selected_id)
out += "</ul>"
end
end

raw out
end

Expand Down

0 comments on commit 9c3d761

Please sign in to comment.