Skip to content

Commit

Permalink
refactor concepts by date method code
Browse files Browse the repository at this point in the history
  • Loading branch information
Bilelkihal committed Jun 6, 2024
1 parent f6a674c commit 2087ac9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 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, first_concept_id: nil)
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?(first_concept_id) && auto_click,
children_href: '#', selected: concept.id.eql?(selected_id) && auto_click,
target_frame: 'concept_show', data: data)
end
out
Expand All @@ -132,11 +132,11 @@ def render_concepts_by_dates(auto_click: false)
tmp = {}
tmp[first_year] = first_month_concepts
@concepts_year_month = tmp.merge(@concepts_year_month)
first_concept_id = @concepts_year_month.first.last.first.last.first.id if auto_click
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, first_concept_id: first_concept_id)
out += concepts_li_list(concepts, auto_click: auto_click, selected_id: selected_id)
out += "</ul>"
end
end
Expand Down

0 comments on commit 2087ac9

Please sign in to comment.