Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Multiple highlighted terms in the date view #657

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading